From ec14d51769edafb4e8a5ff694154064060dfea91 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn <alexxcons@xfce.org> Date: Sat, 16 May 2020 23:05:45 +0200 Subject: [PATCH] remove all GtkActionEntries, they are not used any more (Issue #293) --- thunar/thunar-abstract-icon-view.c | 35 ----- thunar/thunar-launcher.c | 71 ---------- thunar/thunar-renamer-dialog.c | 35 ----- thunar/thunar-shortcuts-pane.c | 43 ------ thunar/thunar-standard-view.c | 94 ------------- thunar/thunar-standard-view.h | 2 - thunar/thunar-window.c | 209 ++--------------------------- 7 files changed, 9 insertions(+), 480 deletions(-) diff --git a/thunar/thunar-abstract-icon-view.c b/thunar/thunar-abstract-icon-view.c index 8b1670b9c..b89241014 100644 --- a/thunar/thunar-abstract-icon-view.c +++ b/thunar/thunar-abstract-icon-view.c @@ -121,28 +121,6 @@ struct _ThunarAbstractIconViewPrivate }; - -static const GtkActionEntry action_entries[] = -{ - { "arrange-items-menu", NULL, N_ ("Arran_ge Items"), NULL, NULL, NULL, }, -}; - -static const GtkRadioActionEntry column_action_entries[] = -{ - { "sort-by-name", NULL, N_ ("Sort By _Name"), NULL, N_ ("Keep items sorted by their name"), THUNAR_COLUMN_NAME, }, - { "sort-by-size", NULL, N_ ("Sort By _Size"), NULL, N_ ("Keep items sorted by their size"), THUNAR_COLUMN_SIZE, }, - { "sort-by-type", NULL, N_ ("Sort By _Type"), NULL, N_ ("Keep items sorted by their type"), THUNAR_COLUMN_TYPE, }, - { "sort-by-mtime", NULL, N_ ("Sort By Modification _Date"), NULL, N_ ("Keep items sorted by their modification date"), THUNAR_COLUMN_DATE_MODIFIED, }, -}; - -static const GtkRadioActionEntry order_action_entries[] = -{ - { "sort-ascending", NULL, N_ ("_Ascending"), NULL, N_ ("Sort items in ascending order"), GTK_SORT_ASCENDING, }, - { "sort-descending", NULL, N_ ("_Descending"), NULL, N_ ("Sort items in descending order"), GTK_SORT_DESCENDING, }, -}; - - - static XfceGtkActionEntry thunar_abstract_icon_view_action_entries[] = { { THUNAR_ABSTRACT_ICON_VIEW_ACTION_ARRANGE_ITEMS_MENU, "<Actions>/ThunarStandardView/arrange-items-menu", "", XFCE_GTK_MENU_ITEM, N_ ("Arran_ge Items"), NULL, NULL, G_CALLBACK (NULL), }, @@ -257,19 +235,6 @@ thunar_abstract_icon_view_init (ThunarAbstractIconView *abstract_icon_view) gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (view), THUNAR_STANDARD_VIEW (abstract_icon_view)->name_renderer, "text", THUNAR_COLUMN_NAME); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* setup the abstract icon view actions */ - gtk_action_group_add_actions (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, - action_entries, G_N_ELEMENTS (action_entries), - GTK_WIDGET (abstract_icon_view)); - gtk_action_group_add_radio_actions (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, column_action_entries, - G_N_ELEMENTS (column_action_entries), THUNAR_COLUMN_NAME, - G_CALLBACK (NULL), abstract_icon_view); - gtk_action_group_add_radio_actions (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, order_action_entries, - G_N_ELEMENTS (order_action_entries), GTK_SORT_ASCENDING, - G_CALLBACK (NULL), abstract_icon_view); -G_GNUC_END_IGNORE_DEPRECATIONS - /* we need to listen to sort column changes to sync the menu items */ g_signal_connect (G_OBJECT (THUNAR_STANDARD_VIEW (abstract_icon_view)->model), "sort-column-changed", G_CALLBACK (thunar_abstract_icon_view_sort_column_changed), abstract_icon_view); diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 2444ddf91..4210d3487 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -172,16 +172,7 @@ struct _ThunarLauncher ThunarFile *current_directory; GList *selected_files; - GtkActionGroup *action_group; GtkUIManager *ui_manager; - guint ui_merge_id; - guint ui_addons_merge_id; - - GtkAction *action_open; - GtkAction *action_open_with_other; - GtkAction *action_open_in_new_window; - GtkAction *action_open_in_new_tab; - GtkAction *action_open_with_other_in_menu; gint n_selected_files; gint n_selected_directories; @@ -214,19 +205,6 @@ struct _ThunarLauncherPokeData ThunarLauncherFolderOpenAction folder_open_action; }; - - -static const GtkActionEntry action_entries[] = -{ - { "open", "document-open", N_ ("_Open"), "<control>O", NULL, G_CALLBACK (NULL), }, - { "open-in-new-tab", NULL, N_ ("Open in New _Tab"), "<control><shift>P", NULL, G_CALLBACK (NULL), }, - { "open-in-new-window", NULL, N_ ("Open in New _Window"), "<control><shift>O", NULL, G_CALLBACK (NULL), }, - { "open-with-other", NULL, N_ ("Open With Other _Application..."), NULL, N_ ("Choose another application with which to open the selected file"), G_CALLBACK (NULL), }, - { "open-with-menu", NULL, N_ ("Open With"), NULL, NULL, NULL, }, - { "open-with-other-in-menu", NULL, N_ ("Open With Other _Application..."), NULL, N_ ("Choose another application with which to open the selected file"), G_CALLBACK (NULL), }, - { "sendto-desktop", "user-desktop", "", NULL, NULL, G_CALLBACK (NULL), }, -}; - static GParamSpec *launcher_props[N_PROPERTIES] = { NULL, }; static XfceGtkActionEntry thunar_launcher_action_entries[] = @@ -361,20 +339,6 @@ thunar_launcher_navigator_init (ThunarNavigatorIface *iface) static void thunar_launcher_init (ThunarLauncher *launcher) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* setup the action group for the launcher actions */ - launcher->action_group = gtk_action_group_new ("ThunarLauncher"); - gtk_action_group_set_translation_domain (launcher->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions (launcher->action_group, action_entries, G_N_ELEMENTS (action_entries), launcher); - - /* determine references to our actions */ - launcher->action_open = gtk_action_group_get_action (launcher->action_group, "open"); - launcher->action_open_with_other = gtk_action_group_get_action (launcher->action_group, "open-with-other"); - launcher->action_open_in_new_window = gtk_action_group_get_action (launcher->action_group, "open-in-new-window"); - launcher->action_open_in_new_tab = gtk_action_group_get_action (launcher->action_group, "open-in-new-tab"); - launcher->action_open_with_other_in_menu = gtk_action_group_get_action (launcher->action_group, "open-with-other-in-menu"); -G_GNUC_END_IGNORE_DEPRECATIONS - launcher->selected_files = NULL; launcher->select_files_closure = NULL; @@ -415,9 +379,6 @@ thunar_launcher_finalize (GObject *object) /* release the preferences reference */ g_object_unref (launcher->preferences); - /* release the reference on the action group */ - g_object_unref (launcher->action_group); - (*G_OBJECT_CLASS (thunar_launcher_parent_class)->finalize) (object); } @@ -642,26 +603,10 @@ thunar_launcher_set_ui_manager (ThunarComponent *component, GtkUIManager *ui_manager) { ThunarLauncher *launcher = THUNAR_LAUNCHER (component); - GError *error = NULL; /* disconnect from the previous UI manager */ if (G_UNLIKELY (launcher->ui_manager != NULL)) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* drop our action group from the previous UI manager */ - gtk_ui_manager_remove_action_group (launcher->ui_manager, launcher->action_group); - - /* unmerge our addons ui controls from the previous UI manager */ - if (G_LIKELY (launcher->ui_addons_merge_id != 0)) - { - gtk_ui_manager_remove_ui (launcher->ui_manager, launcher->ui_addons_merge_id); - launcher->ui_addons_merge_id = 0; - } - - /* unmerge our ui controls from the previous UI manager */ - gtk_ui_manager_remove_ui (launcher->ui_manager, launcher->ui_merge_id); -G_GNUC_END_IGNORE_DEPRECATIONS - /* drop the reference on the previous UI manager */ g_object_unref (G_OBJECT (launcher->ui_manager)); } @@ -674,22 +619,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS { /* we keep a reference on the new manager */ g_object_ref (G_OBJECT (ui_manager)); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* add our action group to the new manager */ - gtk_ui_manager_insert_action_group (ui_manager, launcher->action_group, -1); - - /* merge our UI control items with the new manager */ - launcher->ui_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, thunar_launcher_ui, thunar_launcher_ui_length, &error); -G_GNUC_END_IGNORE_DEPRECATIONS - if (G_UNLIKELY (launcher->ui_merge_id == 0)) - { - g_error ("Failed to merge ThunarLauncher menus: %s", error->message); - g_error_free (error); - } - - /* update the user interface */ - //thunar_launcher_update (launcher); } /* notify listeners */ diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c index a5cfe5052..3e8a2d291 100644 --- a/thunar/thunar-renamer-dialog.c +++ b/thunar/thunar-renamer-dialog.c @@ -43,7 +43,6 @@ #include <thunar/thunar-private.h> #include <thunar/thunar-properties-dialog.h> #include <thunar/thunar-renamer-dialog.h> -#include <thunar/thunar-renamer-dialog-ui.h> #include <thunar/thunar-renamer-model.h> #include <thunar/thunar-renamer-progress.h> @@ -166,7 +165,6 @@ struct _ThunarRenamerDialog ThunarLauncher *launcher; - GtkActionGroup *action_group; GtkUIManager *ui_manager; GtkWidget *cancel_button; @@ -192,20 +190,6 @@ struct _ThunarRenamerDialog -static const GtkActionEntry action_entries[] = -{ - { "file-menu", NULL, N_ ("_File"), NULL, }, - { "sendto-menu", NULL, N_ ("_Send To"), NULL, }, - { "file-context-menu", NULL, N_ ("File Context Menu"), NULL, }, - { "add-files", "list-add", N_ ("_Add Files..."), NULL, N_ ("Include additional files in the list of files to be renamed"), G_CALLBACK (NULL), }, - { "remove-files", "list-remove", NULL, NULL, NULL, G_CALLBACK (NULL), }, - { "clear", "edit-clear", N_ ("Clear"), NULL, N_ ("Clear the file list below"), G_CALLBACK (NULL), }, - { "about", "help-about", N_ ("_About"), NULL, N_ ("Display information about Thunar Bulk Rename"), G_CALLBACK (NULL), }, - { "properties", "document-properties", N_ ("_Properties..."), "<alt>Return", N_ ("View the properties of the selected file"), G_CALLBACK (NULL), }, -}; - - - static XfceGtkActionEntry thunar_renamer_action_entries[] = { { THUNAR_RENAMER_ACTION_ADD_FILES, "<Actions>/ThunarRenamerDialog/add-files", "", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("_Add Files..."), N_ ("Include additional files in the list of files to be renamed"), "list-add", G_CALLBACK (thunar_renamer_dialog_action_add_files), }, @@ -323,7 +307,6 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog) GtkTreeViewColumn *column; GtkTreeSelection *selection; GtkCellRenderer *renderer; - GtkAccelGroup *accel_group; GtkSizeGroup *size_group; const gchar *active_str; GHashTable *settings; @@ -384,22 +367,6 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog) gtk_dialog_set_default_response (GTK_DIALOG (renamer_dialog), GTK_RESPONSE_ACCEPT); gtk_widget_set_tooltip_text (button, _("Click here to actually rename the files listed above to their new names.")); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* setup the action group for this dialog */ - renamer_dialog->action_group = gtk_action_group_new ("ThunarRenamerDialog"); - gtk_action_group_set_translation_domain (renamer_dialog->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions (renamer_dialog->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (renamer_dialog)); - - /* setup the UI manager for this dialog */ - renamer_dialog->ui_manager = gtk_ui_manager_new (); - gtk_ui_manager_insert_action_group (renamer_dialog->ui_manager, renamer_dialog->action_group, 0); - gtk_ui_manager_add_ui_from_string (renamer_dialog->ui_manager, thunar_renamer_dialog_ui, thunar_renamer_dialog_ui_length, NULL); - - /* connect the accelerators */ - accel_group = gtk_ui_manager_get_accel_group (renamer_dialog->ui_manager); - gtk_window_add_accel_group (GTK_WINDOW (renamer_dialog), accel_group); -G_GNUC_END_IGNORE_DEPRECATIONS - /* setup the launcher support for this dialog */ renamer_dialog->launcher = g_object_new (THUNAR_TYPE_LAUNCHER, "widget", GTK_WIDGET (renamer_dialog), NULL); thunar_component_set_ui_manager (THUNAR_COMPONENT (renamer_dialog->launcher), renamer_dialog->ui_manager); @@ -677,8 +644,6 @@ thunar_renamer_dialog_finalize (GObject *object) /* release the launcher support */ g_object_unref (G_OBJECT (renamer_dialog->launcher)); - /* release the action group and the ui manager */ - g_object_unref (G_OBJECT (renamer_dialog->action_group)); g_object_unref (G_OBJECT (renamer_dialog->ui_manager)); /* release our bulk rename model */ diff --git a/thunar/thunar-shortcuts-pane.c b/thunar/thunar-shortcuts-pane.c index 60ccd56bc..11ac543b6 100644 --- a/thunar/thunar-shortcuts-pane.c +++ b/thunar/thunar-shortcuts-pane.c @@ -81,9 +81,7 @@ struct _ThunarShortcutsPane ThunarFile *current_directory; GList *selected_files; - GtkActionGroup *action_group; GtkUIManager *ui_manager; - guint ui_merge_id; GtkWidget *view; @@ -92,13 +90,6 @@ struct _ThunarShortcutsPane -static const GtkActionEntry action_entries[] = -{ - { "sendto-shortcuts", "bookmark-new", "", NULL, NULL, G_CALLBACK (NULL), }, -}; - - - G_DEFINE_TYPE_WITH_CODE (ThunarShortcutsPane, thunar_shortcuts_pane, GTK_TYPE_SCROLLED_WINDOW, G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_shortcuts_pane_navigator_init) G_IMPLEMENT_INTERFACE (THUNAR_TYPE_COMPONENT, thunar_shortcuts_pane_component_init) @@ -164,13 +155,6 @@ thunar_shortcuts_pane_init (ThunarShortcutsPane *shortcuts_pane) { GtkWidget *vscrollbar; - /* setup the action group for the shortcuts actions */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - shortcuts_pane->action_group = gtk_action_group_new ("ThunarShortcutsPane"); - gtk_action_group_set_translation_domain (shortcuts_pane->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions (shortcuts_pane->action_group, action_entries, G_N_ELEMENTS (action_entries), shortcuts_pane); -G_GNUC_END_IGNORE_DEPRECATIONS - /* configure the GtkScrolledWindow */ gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (shortcuts_pane), NULL); gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (shortcuts_pane), NULL); @@ -217,11 +201,6 @@ thunar_shortcuts_pane_dispose (GObject *object) static void thunar_shortcuts_pane_finalize (GObject *object) { - ThunarShortcutsPane *shortcuts_pane = THUNAR_SHORTCUTS_PANE (object); - - /* release our action group */ - g_object_unref (G_OBJECT (shortcuts_pane->action_group)); - (*G_OBJECT_CLASS (thunar_shortcuts_pane_parent_class)->finalize) (object); } @@ -396,19 +375,10 @@ thunar_shortcuts_pane_set_ui_manager (ThunarComponent *component, GtkUIManager *ui_manager) { ThunarShortcutsPane *shortcuts_pane = THUNAR_SHORTCUTS_PANE (component); - GError *error = NULL; /* disconnect from the previous UI manager */ if (G_UNLIKELY (shortcuts_pane->ui_manager != NULL)) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* drop our action group from the previous UI manager */ - gtk_ui_manager_remove_action_group (shortcuts_pane->ui_manager, shortcuts_pane->action_group); - - /* unmerge our ui controls from the previous UI manager */ - gtk_ui_manager_remove_ui (shortcuts_pane->ui_manager, shortcuts_pane->ui_merge_id); -G_GNUC_END_IGNORE_DEPRECATIONS - /* drop our reference on the previous UI manager */ g_object_unref (G_OBJECT (shortcuts_pane->ui_manager)); } @@ -421,19 +391,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS { /* we keep a reference on the new manager */ g_object_ref (G_OBJECT (ui_manager)); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* add our action group to the new manager */ - gtk_ui_manager_insert_action_group (ui_manager, shortcuts_pane->action_group, -1); - - /* merge our UI control items with the new manager */ - shortcuts_pane->ui_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, thunar_shortcuts_pane_ui, thunar_shortcuts_pane_ui_length, &error); -G_GNUC_END_IGNORE_DEPRECATIONS - if (G_UNLIKELY (shortcuts_pane->ui_merge_id == 0)) - { - g_error ("Failed to merge ThunarShortcutsPane menus: %s", error->message); - g_error_free (error); - } } /* notify listeners */ diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 22e9b3bcb..964aeb03f 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -50,7 +50,6 @@ #include <thunar/thunar-renamer-dialog.h> #include <thunar/thunar-simple-job.h> #include <thunar/thunar-standard-view.h> -#include <thunar/thunar-standard-view-ui.h> #include <thunar/thunar-thumbnailer.h> #include <thunar/thunar-util.h> @@ -274,20 +273,6 @@ struct _ThunarStandardViewPrivate /* current directory of the view */ ThunarFile *current_directory; - GtkAction *action_create_folder; - GtkAction *action_create_document; - GtkAction *action_properties; - GtkAction *action_cut; - GtkAction *action_copy; - GtkAction *action_paste; - GtkAction *action_move_to_trash; - GtkAction *action_delete; - GtkAction *action_paste_into_folder; - GtkAction *action_duplicate; - GtkAction *action_make_link; - GtkAction *action_rename; - GtkAction *action_restore; - /* history of the current view */ ThunarHistory *history; @@ -353,28 +338,6 @@ struct _ThunarStandardViewPrivate GtkTreePath *selection_before_delete; }; - - -static const GtkActionEntry action_entries[] = -{ - { "file-context-menu", NULL, N_ ("File Context Menu"), NULL, NULL, NULL, }, - { "folder-context-menu", NULL, N_ ("Folder Context Menu"), NULL, NULL, NULL, }, - { "create-folder", "folder-new", N_ ("Create _Folder..."), "<control><shift>N", N_ ("Create an empty folder within the current folder"), G_CALLBACK (NULL), }, - { "properties", "document-properties", N_ ("_Properties..."), "<alt>Return", N_ ("View the properties of the selected file"), G_CALLBACK (NULL), }, - { "cut", "edit-cut", N_ ("Cu_t"), "<control>X", NULL, G_CALLBACK (NULL), }, - { "copy", "edit-copy", N_ ("_Copy"), "<control>C", NULL, G_CALLBACK (NULL), }, - { "paste", "edit-paste", N_ ("_Paste"), "<control>V", N_ ("Move or copy files previously selected by a Cut or Copy command"), G_CALLBACK (NULL), }, - { "move-to-trash", "user-trash", N_ ("Mo_ve to Trash"), NULL, NULL, G_CALLBACK (NULL), }, - { "delete", "edit-delete", N_ ("_Delete"), NULL, NULL, G_CALLBACK (NULL), }, - { "paste-into-folder", "edit-paste", N_ ("Paste Into Folder"), NULL, N_ ("Move or copy files previously selected by a Cut or Copy command into the selected folder"), G_CALLBACK (NULL), }, - { "select-all-files", NULL, N_ ("Select _all Files"), NULL, N_ ("Select all files in this window"), G_CALLBACK (NULL), }, - { "select-by-pattern", NULL, N_ ("Select _by Pattern..."), "<control>S", N_ ("Select all files that match a certain pattern"), G_CALLBACK (NULL), }, - { "invert-selection", NULL, N_ ("_Invert Selection"), NULL, N_ ("Select all files but not those currently selected"), G_CALLBACK (NULL), }, - { "duplicate", NULL, N_ ("Du_plicate"), NULL, NULL, G_CALLBACK (NULL), }, - { "make-link", NULL, N_ ("Ma_ke Link"), NULL, NULL, G_CALLBACK (NULL), }, - { "rename", NULL, N_ ("_Rename..."), "F2", NULL, G_CALLBACK (NULL), }, - { "restore", NULL, N_ ("_Restore"), NULL, NULL, G_CALLBACK (NULL), }, -}; static XfceGtkActionEntry thunar_standard_view_action_entries[] = { { THUNAR_STANDARD_VIEW_ACTION_SELECT_ALL_FILES, "<Actions>/ThunarStandardView/select-all-files", "<Primary>a", XFCE_GTK_MENU_ITEM, N_ ("Select _all Files"), N_ ("Select all files in this window"), NULL, G_CALLBACK (thunar_standard_view_select_all_files), }, @@ -619,40 +582,6 @@ thunar_standard_view_init (ThunarStandardView *standard_view) gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (standard_view), NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (standard_view), GTK_SHADOW_IN); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* setup the action group for this view */ - standard_view->action_group = gtk_action_group_new ("ThunarStandardView"); - gtk_action_group_set_translation_domain (standard_view->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions (standard_view->action_group, action_entries, - G_N_ELEMENTS (action_entries), - GTK_WIDGET (standard_view)); - - /* lookup all actions to speed up access later */ - standard_view->priv->action_create_folder = gtk_action_group_get_action (standard_view->action_group, "create-folder"); - standard_view->priv->action_properties = gtk_action_group_get_action (standard_view->action_group, "properties"); - standard_view->priv->action_cut = gtk_action_group_get_action (standard_view->action_group, "cut"); - standard_view->priv->action_copy = gtk_action_group_get_action (standard_view->action_group, "copy"); - standard_view->priv->action_paste = gtk_action_group_get_action (standard_view->action_group, "paste"); - standard_view->priv->action_move_to_trash = gtk_action_group_get_action (standard_view->action_group, "move-to-trash"); - standard_view->priv->action_delete = gtk_action_group_get_action (standard_view->action_group, "delete"); - standard_view->priv->action_paste_into_folder = gtk_action_group_get_action (standard_view->action_group, "paste-into-folder"); - standard_view->priv->action_duplicate = gtk_action_group_get_action (standard_view->action_group, "duplicate"); - standard_view->priv->action_make_link = gtk_action_group_get_action (standard_view->action_group, "make-link"); - standard_view->priv->action_rename = gtk_action_group_get_action (standard_view->action_group, "rename"); - standard_view->priv->action_restore = gtk_action_group_get_action (standard_view->action_group, "restore"); -G_GNUC_END_IGNORE_DEPRECATIONS - - /* add the "Create Document" sub menu action */ - //standard_view->priv->action_create_document = thunar_templates_action_new ("create-document", _("Create _Document")); - g_signal_connect (G_OBJECT (standard_view->priv->action_create_document), "create-empty-file", - G_CALLBACK (NULL), standard_view); - g_signal_connect (G_OBJECT (standard_view->priv->action_create_document), "create-template", - G_CALLBACK (NULL), standard_view); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_action_group_add_action (standard_view->action_group, standard_view->priv->action_create_document); -G_GNUC_END_IGNORE_DEPRECATIONS - g_object_unref (G_OBJECT (standard_view->priv->action_create_document)); - /* setup the history support */ standard_view->priv->history = g_object_new (THUNAR_TYPE_HISTORY, NULL); g_signal_connect_swapped (G_OBJECT (standard_view->priv->history), "change-directory", G_CALLBACK (thunar_navigator_change_directory), standard_view); @@ -843,7 +772,6 @@ thunar_standard_view_finalize (GObject *object) /* some safety checks */ _thunar_assert (standard_view->loading_binding == NULL); _thunar_assert (standard_view->icon_factory == NULL); - _thunar_assert (standard_view->ui_manager == NULL); /* Dont listen to the accel keys defined by the action entries any more */ xfce_gtk_accel_group_disconnect_action_entries (standard_view->accel_group, @@ -883,9 +811,6 @@ thunar_standard_view_finalize (GObject *object) /* release the reference on the icon renderer */ g_object_unref (G_OBJECT (standard_view->icon_renderer)); - /* release the reference on the action group */ - g_object_unref (G_OBJECT (standard_view->action_group)); - /* drop any existing "new-files" closure */ if (G_UNLIKELY (standard_view->priv->new_files_closure != NULL)) { @@ -1213,7 +1138,6 @@ thunar_standard_view_set_ui_manager (ThunarComponent *component, GtkUIManager *ui_manager) { ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (component); - GError *error = NULL; /* leave if nothing changed */ if (standard_view->ui_manager == ui_manager) @@ -1223,15 +1147,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* disconnect from the previous UI manager */ if (G_LIKELY (standard_view->ui_manager != NULL)) { - /* drop our action group from the previous UI manager */ - gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->action_group); - /* unmerge the ui controls from derived classes */ (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->disconnect_ui_manager) (standard_view, standard_view->ui_manager); - /* unmerge our ui controls from the previous UI manager */ - gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->ui_merge_id); - /* force update to remove all actions and proxies */ gtk_ui_manager_ensure_update (standard_view->ui_manager); @@ -1248,18 +1166,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* we keep a reference on the new manager */ g_object_ref (G_OBJECT (ui_manager)); - /* add our action group to the new manager */ - gtk_ui_manager_insert_action_group (ui_manager, standard_view->action_group, -1); - - /* merge our UI control items with the new manager */ - standard_view->ui_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, thunar_standard_view_ui, - thunar_standard_view_ui_length, &error); - if (G_UNLIKELY (standard_view->ui_merge_id == 0)) - { - g_error ("Failed to merge ThunarStandardView menus: %s", error->message); - g_error_free (error); - } - /* merge the ui controls from derived classes */ (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->connect_ui_manager) (standard_view, ui_manager); diff --git a/thunar/thunar-standard-view.h b/thunar/thunar-standard-view.h index 93eaf05a1..ebad31854 100644 --- a/thunar/thunar-standard-view.h +++ b/thunar/thunar-standard-view.h @@ -145,9 +145,7 @@ struct _ThunarStandardView ThunarListModel *model; - GtkActionGroup *action_group; GtkUIManager *ui_manager; - guint ui_merge_id; ThunarIconFactory *icon_factory; GtkCellRenderer *icon_renderer; diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 07ac75ff8..d90f4358a 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -31,7 +31,6 @@ #endif #include <gdk/gdkkeysyms.h> -#include <libxfce4ui/libxfce4ui.h> #include <thunar/thunar-application.h> #include <thunar/thunar-browser.h> @@ -369,56 +368,6 @@ struct _ThunarWindow -static GtkActionEntry action_entries[] = -{ - { "file-menu", NULL, N_ ("_File"), NULL, }, - { "new-tab", "tab-new", N_ ("New _Tab"), "<control>T", N_ ("Open a new tab for the displayed location"), G_CALLBACK (NULL), }, - { "new-window", "window-new", N_ ("New _Window"), "<control>N", N_ ("Open a new Thunar window for the displayed location"), G_CALLBACK (NULL), }, - { "sendto-menu", NULL, N_ ("_Send To"), NULL, }, - { "empty-trash", NULL, N_ ("_Empty Trash"), NULL, N_ ("Delete all files and folders in the Trash"), G_CALLBACK (NULL), }, - { "detach-tab", NULL, N_ ("Detac_h Tab"), NULL, N_ ("Open current folder in a new window"), G_CALLBACK (NULL), }, - { "switch-previous-tab", "go-previous", N_ ("_Previous Tab"), "<control>Page_Up", N_ ("Switch to Previous Tab"), G_CALLBACK (NULL), }, - { "switch-next-tab", "go-next", N_ ("_Next Tab"), "<control>Page_Down", N_ ("Switch to Next Tab"), G_CALLBACK (NULL), }, - { "close-all-windows", NULL, N_ ("Close _All Windows"), "<control><shift>W", N_ ("Close all Thunar windows"), G_CALLBACK (NULL), }, - { "close-tab", "window-close", N_ ("C_lose Tab"), "<control>W", N_ ("Close this folder"), G_CALLBACK (NULL), }, - { "close-window", "application-exit", N_ ("_Close Window"), "<control>Q", N_ ("Close this window"), G_CALLBACK (NULL), }, - { "edit-menu", NULL, N_ ("_Edit"), NULL, }, - { "preferences", "preferences-system", N_ ("Pr_eferences..."), NULL, N_ ("Edit Thunars Preferences"), G_CALLBACK (NULL), }, - { "view-menu", NULL, N_ ("_View"), NULL, }, - { "reload", "view-refresh-symbolic", N_ ("_Reload"), "<control>R", N_ ("Reload the current folder"), G_CALLBACK (NULL), }, - { "view-location-selector-menu", NULL, N_ ("_Location Selector"), NULL, }, - { "view-side-pane-menu", NULL, N_ ("_Side Pane"), NULL, }, - { "zoom-in", "zoom-in-symbolic", N_ ("Zoom I_n"), "<control>plus", N_ ("Show the contents in more detail"), G_CALLBACK (NULL), }, - { "zoom-in-alt", NULL, "zoom-in-alt", "<control>equal", NULL, G_CALLBACK (NULL), }, - { "zoom-out", "zoom-out-symbolic", N_ ("Zoom _Out"), "<control>minus", N_ ("Show the contents in less detail"), G_CALLBACK (NULL), }, - { "zoom-reset", "zoom-original-symbolic", N_ ("Normal Si_ze"), "<control>0", N_ ("Show the contents at the normal size"), G_CALLBACK (NULL), }, - { "go-menu", NULL, N_ ("_Go"), NULL, }, - { "open-parent", "go-up-symbolic", N_ ("Open _Parent"), "<alt>Up", N_ ("Open the parent folder"), G_CALLBACK (NULL), }, - { "open-home", "go-home-symbolic", N_ ("_Home"), "<alt>Home", N_ ("Go to the home folder"), G_CALLBACK (NULL), }, - { "open-desktop", "user-desktop", N_ ("Desktop"), NULL, N_ ("Go to the desktop folder"), G_CALLBACK (NULL), }, - { "open-computer", "computer", N_ ("Computer"), NULL, N_ ("Browse all local and remote disks and folders accessible from this computer"), G_CALLBACK (NULL), }, - { "open-file-system", "drive-harddisk", N_ ("File System"), NULL, N_ ("Browse the file system"), G_CALLBACK (NULL), }, - { "open-network", "network-workgroup", N_("B_rowse Network"), NULL, N_ ("Browse local network connections"), G_CALLBACK (NULL), }, - { "open-templates", "text-x-generic-template", N_("T_emplates"), NULL, N_ ("Go to the templates folder"), G_CALLBACK (NULL), }, - { "open-location", NULL, N_ ("_Open Location..."), "<control>L", N_ ("Specify a location to open"), G_CALLBACK (NULL), }, - { "open-location-alt", NULL, "open-location-alt", "<alt>D", NULL, G_CALLBACK (NULL), }, - { "help-menu", NULL, N_ ("_Help"), NULL, }, - { "contents", "help-browser", N_ ("_Contents"), "F1", N_ ("Display Thunar user manual"), G_CALLBACK (NULL), }, - { "about", "help-about", N_ ("_About"), NULL, N_ ("Display information about Thunar"), G_CALLBACK (NULL), }, -}; - -static const GtkToggleActionEntry toggle_action_entries[] = -{ - { "show-hidden", NULL, N_ ("Show _Hidden Files"), "<control>H", N_ ("Toggles the display of hidden files in the current window"), G_CALLBACK (NULL), FALSE, }, - { "view-location-selector-pathbar", NULL, N_ ("_Pathbar Style"), NULL, N_ ("Modern approach with buttons that correspond to folders"), G_CALLBACK (NULL), FALSE, }, - { "view-location-selector-toolbar", NULL, N_ ("_Toolbar Style"), NULL, N_ ("Traditional approach with location bar and navigation buttons"), G_CALLBACK (NULL), FALSE, }, - { "view-side-pane-shortcuts", NULL, N_ ("_Shortcuts"), "<control>B", N_ ("Toggles the visibility of the shortcuts pane"), G_CALLBACK (NULL), FALSE, }, - { "view-side-pane-tree", NULL, N_ ("_Tree"), "<control>E", N_ ("Toggles the visibility of the tree pane"), G_CALLBACK (NULL), FALSE, }, - { "view-statusbar", NULL, N_ ("St_atusbar"), NULL, N_ ("Change the visibility of this window's statusbar"), G_CALLBACK (NULL), FALSE, }, - { "view-menubar", NULL, N_ ("_Menubar"), "<control>M", N_ ("Change the visibility of this window's menubar"), G_CALLBACK (NULL), TRUE, }, -}; - - static XfceGtkActionEntry thunar_window_action_entries[] = { { THUNAR_WINDOW_ACTION_FILE_MENU, "<Actions>/ThunarWindow/file-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_File"), NULL, NULL, NULL,}, @@ -675,67 +624,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS -static inline gint -view_type2index (GType type) -{ - /* this necessary for platforms where sizeof(GType) != sizeof(gint), - * see https://bugzilla.xfce.org/show_bug.cgi?id=2726 for details. - */ - if (sizeof (GType) == sizeof (gint)) - { - /* no need to map anything */ - return (gint) type; - } - else - { - /* map from types to unique indices */ - if (G_LIKELY (type == THUNAR_TYPE_COMPACT_VIEW)) - return 0; - else if (type == THUNAR_TYPE_DETAILS_VIEW) - return 1; - else - return 2; - } -} - - - -static inline GType -view_index2type (gint idx) -{ - /* this necessary for platforms where sizeof(GType) != sizeof(gint), - * see https://bugzilla.xfce.org/show_bug.cgi?id=2726 for details. - */ - if (sizeof (GType) == sizeof (gint)) - { - /* no need to map anything */ - return (GType) idx; - } - else - { - /* map from indices to unique types */ - switch (idx) - { - case 0: return THUNAR_TYPE_COMPACT_VIEW; - case 1: return THUNAR_TYPE_DETAILS_VIEW; - default: return THUNAR_TYPE_ICON_VIEW; - } - } -} - - - static void thunar_window_init (ThunarWindow *window) { - GtkRadioAction *radio_action; - GtkAccelGroup *accel_group; GtkWidget *label; GtkWidget *infobar; GtkWidget *item; - GtkAction *action; gboolean last_menubar_visible; - GSList *group; gchar *last_location_bar; gchar *last_side_pane; gchar *last_view; @@ -805,50 +700,6 @@ thunar_window_init (ThunarWindow *window) g_signal_connect (window, "key-press-event", G_CALLBACK (thunar_window_propagate_key_event), NULL); g_signal_connect (window, "key-release-event", G_CALLBACK (thunar_window_propagate_key_event), NULL); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* setup the action group for this window */ - window->action_group = gtk_action_group_new ("ThunarWindow"); - gtk_action_group_set_translation_domain (window->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions (window->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (window)); - gtk_action_group_add_toggle_actions (window->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), GTK_WIDGET (window)); - - /* initialize the "show-hidden" action using the last value from the preferences */ - //action = gtk_action_group_get_action (window->action_group, "show-hidden"); - //gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), last_show_hidden); - - /* - * add view options - */ - radio_action = gtk_radio_action_new ("view-as-icons", _("View as _Icons"), _("Display folder content in an icon view"), - NULL, view_type2index (THUNAR_TYPE_ICON_VIEW)); - gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION (radio_action), "<control>1"); - gtk_radio_action_set_group (radio_action, NULL); - group = gtk_radio_action_get_group (radio_action); - g_object_unref (G_OBJECT (radio_action)); - - radio_action = gtk_radio_action_new ("view-as-detailed-list", _("View as _Detailed List"), _("Display folder content in a detailed list view"), - NULL, view_type2index (THUNAR_TYPE_DETAILS_VIEW)); - gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION (radio_action), "<control>2"); - gtk_radio_action_set_group (radio_action, group); - group = gtk_radio_action_get_group (radio_action); - g_object_unref (G_OBJECT (radio_action)); - - radio_action = gtk_radio_action_new ("view-as-compact-list", _("View as _Compact List"), _("Display folder content in a compact list view"), - NULL, view_type2index (THUNAR_TYPE_COMPACT_VIEW)); - gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION (radio_action), "<control>3"); - gtk_radio_action_set_group (radio_action, group); - group = gtk_radio_action_get_group (radio_action); - g_object_unref (G_OBJECT (radio_action)); - - window->ui_manager = gtk_ui_manager_new (); - g_signal_connect (G_OBJECT (window->ui_manager), "connect-proxy", G_CALLBACK (thunar_window_connect_proxy), window); - g_signal_connect (G_OBJECT (window->ui_manager), "disconnect-proxy", G_CALLBACK (thunar_window_disconnect_proxy), window); - gtk_ui_manager_insert_action_group (window->ui_manager, window->action_group, 0); - gtk_ui_manager_add_ui_from_string (window->ui_manager, thunar_window_ui, thunar_window_ui_length, NULL); - - accel_group = gtk_ui_manager_get_accel_group (window->ui_manager); - gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); -G_GNUC_END_IGNORE_DEPRECATIONS window->select_files_closure = g_cclosure_new_swap (G_CALLBACK (thunar_window_select_files), window, NULL); g_closure_ref (window->select_files_closure); @@ -876,10 +727,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS gtk_container_add (GTK_CONTAINER (window), window->grid); gtk_widget_show (window->grid); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - window->menubar = gtk_ui_manager_get_widget (window->ui_manager, "/main-menu"); -G_GNUC_END_IGNORE_DEPRECATIONS - /* build the menubar */ window->menubar = gtk_menu_bar_new (); item = xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_FILE_MENU), G_OBJECT (window), GTK_MENU_SHELL (window->menubar)); @@ -904,13 +751,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_hexpand (window->menubar, TRUE); gtk_grid_attach (GTK_GRID (window->grid), window->menubar, 0, 0, 1, 1); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* update menubar visibiliy */ - action = gtk_action_group_get_action (window->action_group, "view-menubar"); - g_signal_connect (G_OBJECT (window->menubar), "deactivate", G_CALLBACK (NULL), window); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), last_menubar_visible); -G_GNUC_END_IGNORE_DEPRECATIONS - /* append the menu item for the spinner */ item = gtk_menu_item_new (); gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); @@ -1013,14 +853,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS /* display the toolbar */ gtk_widget_show_all (window->location_toolbar); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* activate the selected location selector */ - action = gtk_action_group_get_action (window->action_group, "view-location-selector-pathbar"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !strcmp(last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_BUTTONS))); - action = gtk_action_group_get_action (window->action_group, "view-location-selector-toolbar"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !strcmp(last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_ENTRY))); -G_GNUC_END_IGNORE_DEPRECATIONS - g_free (last_location_bar); /* setup setting the location bar visibility on-demand */ @@ -1040,21 +872,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS thunar_window_install_sidepane (window, type); g_free (last_side_pane); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* activate the selected side pane */ - action = gtk_action_group_get_action (window->action_group, "view-side-pane-shortcuts"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), (type == THUNAR_TYPE_SHORTCUTS_PANE)); - action = gtk_action_group_get_action (window->action_group, "view-side-pane-tree"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), (type == THUNAR_TYPE_TREE_PANE)); - - /* check if we should display the statusbar by default */ - action = gtk_action_group_get_action (window->action_group, "view-statusbar"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), last_statusbar_visible); - - /* connect signal */ - action = gtk_action_group_get_action (window->action_group, "view-as-icons"); -G_GNUC_END_IGNORE_DEPRECATIONS - g_signal_connect (G_OBJECT (action), "changed", G_CALLBACK (thunar_window_action_view_changed), window); + /* setup a new statusbar */ + window->statusbar = thunar_statusbar_new (); + gtk_widget_set_hexpand (window->statusbar, TRUE); + gtk_grid_attach (GTK_GRID (window->view_box), window->statusbar, 0, 2, 1, 1); + if (last_statusbar_visible) + gtk_widget_show (window->statusbar); + + if (G_LIKELY (window->view != NULL)) + thunar_window_binding_create (window, window->view, "statusbar-text", window->statusbar, "text", G_BINDING_SYNC_CREATE); /* ensure that all the view types are registered */ g_type_ensure (THUNAR_TYPE_ICON_VIEW); @@ -1379,23 +1205,6 @@ thunar_window_dispose (GObject *object) window->location_toolbar_item_back = NULL; window->location_toolbar_item_forward = NULL; - /* destroy the save geometry timer source */ - if (G_UNLIKELY (window->save_geometry_timer_id != 0)) - g_source_remove (window->save_geometry_timer_id); - - /* destroy the merge idle source */ - if (G_UNLIKELY (window->merge_idle_id != 0)) - g_source_remove (window->merge_idle_id); - - /* un-merge the custom preferences */ - if (G_LIKELY (window->custom_preferences_merge_id != 0)) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_ui_manager_remove_ui (window->ui_manager, window->custom_preferences_merge_id); -G_GNUC_END_IGNORE_DEPRECATIONS - window->custom_preferences_merge_id = 0; - } - /* un-merge the go menu actions */ if (G_LIKELY (window->go_items_actions_merge_id != 0)) { -- GitLab