From 94dae95b9530e150365c947f9b263251cfd0c0fa Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Mon, 3 Oct 2016 23:48:20 -0700 Subject: [PATCH 1/3] toolbar: Revamp the main toolbar style Get rid of the text and switch all icons to slightly smaller symoblic icons. This will allow it to behave much better with dark gtk themes. Replace the recent documents button with a button for file open. Changing the style of the buttons on the main toolbar also effects the fullscreen toolbar so update this as well to use a matching layout. --- xed/xed-prefs-manager-app.c | 18 +-- xed/xed-ui.h | 22 +-- xed/xed-window-private.h | 3 +- xed/xed-window.c | 286 ++++++++++++++++++++---------------- 4 files changed, 172 insertions(+), 157 deletions(-) diff --git a/xed/xed-prefs-manager-app.c b/xed/xed-prefs-manager-app.c index cd6cd26..bdeddb6 100644 --- a/xed/xed-prefs-manager-app.c +++ b/xed/xed-prefs-manager-app.c @@ -1316,8 +1316,8 @@ xed_prefs_manager_source_style_scheme_changed (GSettings *settings, static void xed_prefs_manager_max_recents_changed (GSettings *settings, - gchar *key, - gpointer user_data) + gchar *key, + gpointer user_data) { xed_debug (DEBUG_PREFS); @@ -1328,21 +1328,11 @@ xed_prefs_manager_max_recents_changed (GSettings *settings, max = g_settings_get_int (settings, key); - if (max < 0) { + if (max < 0) + { max = GPM_DEFAULT_MAX_RECENTS; } - windows = xed_app_get_windows (xed_app_get_default ()); - while (windows != NULL) - { - XedWindow *w = windows->data; - - gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (w->priv->toolbar_recent_menu), - max); - - windows = g_list_next (windows); - } - /* FIXME: we have no way at the moment to trigger the * update of the inline recents in the File menu */ } diff --git a/xed/xed-ui.h b/xed/xed-ui.h index d2e11bc..f188ca6 100644 --- a/xed/xed-ui.h +++ b/xed/xed-ui.h @@ -53,9 +53,9 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] = { "Help", NULL, N_("_Help") }, /* File menu */ - { "FileNew", GTK_STOCK_NEW, NULL, "N", + { "FileNew", "document-new-symbolic", N_("_New"), "N", N_("Create a new document"), G_CALLBACK (_xed_cmd_file_new) }, - { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "O", + { "FileOpen", "document-open-symbolic", N_("_Open..."), "O", N_("Open a file"), G_CALLBACK (_xed_cmd_file_open) }, /* Edit menu */ @@ -69,7 +69,7 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] = N_("About this application"), G_CALLBACK (_xed_cmd_help_about) }, /* Fullscreen toolbar */ - { "LeaveFullscreen", GTK_STOCK_LEAVE_FULLSCREEN, NULL, + { "LeaveFullscreen", "view-restore-symbolic", NULL, NULL, N_("Leave fullscreen mode"), G_CALLBACK (_xed_cmd_view_leave_fullscreen_mode) } }; @@ -77,7 +77,7 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] = static const GtkActionEntry xed_menu_entries[] = { /* File menu */ - { "FileSave", GTK_STOCK_SAVE, NULL, "S", + { "FileSave", "document-save-symbolic", N_("_Save"), "S", N_("Save the current file"), G_CALLBACK (_xed_cmd_file_save) }, { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "S", N_("Save the current file with a different name"), G_CALLBACK (_xed_cmd_file_save_as) }, @@ -89,15 +89,15 @@ static const GtkActionEntry xed_menu_entries[] = N_("Print the current page"), G_CALLBACK (_xed_cmd_file_print) }, /* Edit menu */ - { "EditUndo", GTK_STOCK_UNDO, NULL, "Z", + { "EditUndo", "edit-undo-symbolic", N_("Undo"), "Z", N_("Undo the last action"), G_CALLBACK (_xed_cmd_edit_undo) }, - { "EditRedo", GTK_STOCK_REDO, NULL, "Y", + { "EditRedo", "edit-redo-symbolic", N_("Redo"), "Y", N_("Redo the last undone action"), G_CALLBACK (_xed_cmd_edit_redo) }, - { "EditCut", GTK_STOCK_CUT, NULL, "X", + { "EditCut", "edit-cut-symbolic", N_("Cut"), "X", N_("Cut the selection"), G_CALLBACK (_xed_cmd_edit_cut) }, - { "EditCopy", GTK_STOCK_COPY, NULL, "C", + { "EditCopy", "edit-copy-symbolic", N_("Copy"), "C", N_("Copy the selection"), G_CALLBACK (_xed_cmd_edit_copy) }, - { "EditPaste", GTK_STOCK_PASTE, NULL, "V", + { "EditPaste", "edit-paste-symbolic", N_("Paste"), "V", N_("Paste the clipboard"), G_CALLBACK (_xed_cmd_edit_paste) }, { "EditDelete", GTK_STOCK_DELETE, NULL, NULL, N_("Delete the selected text"), G_CALLBACK (_xed_cmd_edit_delete) }, @@ -108,13 +108,13 @@ static const GtkActionEntry xed_menu_entries[] = { "ViewHighlightMode", NULL, N_("_Highlight Mode") }, /* Search menu */ - { "SearchFind", GTK_STOCK_FIND, N_("_Find..."), "F", + { "SearchFind", "edit-find-symbolic", N_("_Find"), "F", N_("Search for text"), G_CALLBACK (_xed_cmd_search_find) }, { "SearchFindNext", NULL, N_("Find Ne_xt"), "G", N_("Search forwards for the same text"), G_CALLBACK (_xed_cmd_search_find_next) }, { "SearchFindPrevious", NULL, N_("Find Pre_vious"), "G", N_("Search backwards for the same text"), G_CALLBACK (_xed_cmd_search_find_prev) }, - { "SearchReplace", GTK_STOCK_FIND_AND_REPLACE, N_("_Replace..."), "H", + { "SearchReplace", "edit-find-replace-symbolic", N_("_Replace"), "H", N_("Search for and replace text"), G_CALLBACK (_xed_cmd_search_replace) }, { "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "I", N_("Go to a specific line"), G_CALLBACK (_xed_cmd_search_goto_line) }, diff --git a/xed/xed-window-private.h b/xed/xed-window-private.h index 2bfa028..0be7945 100644 --- a/xed/xed-window-private.h +++ b/xed/xed-window-private.h @@ -56,6 +56,7 @@ struct _XedWindowPrivate /* Widgets for fullscreen mode */ GtkWidget *fullscreen_controls; + GtkWidget *fullscreen_controls_container; guint fullscreen_animation_timeout_id; gboolean fullscreen_animation_enter; @@ -79,9 +80,7 @@ struct _XedWindowPrivate GtkActionGroup *documents_list_action_group; guint documents_list_menu_ui_id; GtkWidget *toolbar; - GtkWidget *toolbar_recent_menu; GtkWidget *menubar; - XedToolbarSetting toolbar_style; /* recent files */ GtkActionGroup *recents_action_group; diff --git a/xed/xed-window.c b/xed/xed-window.c index 1c1181e..ae72104 100644 --- a/xed/xed-window.c +++ b/xed/xed-window.c @@ -393,34 +393,6 @@ disconnect_proxy_cb (GtkUIManager *manager, } } -static void -apply_toolbar_style (XedWindow *window, - GtkWidget *toolbar) -{ - switch (window->priv->toolbar_style) - { - case XED_TOOLBAR_SYSTEM: - xed_debug_message (DEBUG_WINDOW, "XED: SYSTEM"); - gtk_toolbar_unset_style (GTK_TOOLBAR(toolbar)); - break; - - case XED_TOOLBAR_ICONS: - xed_debug_message (DEBUG_WINDOW, "XED: ICONS"); - gtk_toolbar_set_style (GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); - break; - - case XED_TOOLBAR_ICONS_AND_TEXT: - xed_debug_message (DEBUG_WINDOW, "XED: ICONS_AND_TEXT"); - gtk_toolbar_set_style (GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH); - break; - - case XED_TOOLBAR_ICONS_BOTH_HORIZ: - xed_debug_message (DEBUG_WINDOW, "XED: ICONS_BOTH_HORIZ"); - gtk_toolbar_set_style (GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); - break; - } -} - /* Returns TRUE if toolbar is visible */ static gboolean set_toolbar_style (XedWindow *window, @@ -456,20 +428,6 @@ set_toolbar_style (XedWindow *window, gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), visible); } - /* Set style */ - if (origin == NULL) - { - style = xed_prefs_manager_get_toolbar_buttons_style (); - } - else - { - style = origin->priv->toolbar_style; - } - - window->priv->toolbar_style = style; - - apply_toolbar_style (window, window->priv->toolbar); - return visible; } @@ -950,19 +908,6 @@ open_recent_file (const gchar *uri, g_slist_free (uris); } -static void -recent_chooser_item_activated (GtkRecentChooser *chooser, - XedWindow *window) -{ - gchar *uri; - - uri = gtk_recent_chooser_get_current_uri (chooser); - - open_recent_file (uri, window); - - g_free (uri); -} - static void recents_menu_activate (GtkAction *action, XedWindow *window) @@ -1116,13 +1061,6 @@ update_recent_files_menu (XedWindow *window) g_list_free (items); } -static void -set_non_homogeneus (GtkWidget *widget, - gpointer data) -{ - gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM(widget), FALSE); -} - static void toolbar_visibility_changed (GtkWidget *toolbar, XedWindow *window) @@ -1146,45 +1084,21 @@ toolbar_visibility_changed (GtkWidget *toolbar, } static GtkWidget * -setup_toolbar_open_button (XedWindow *window, - GtkWidget *toolbar) +create_toolbar_button (GtkAction *action) { - GtkRecentManager *recent_manager; - GtkRecentFilter *filter; - GtkWidget *toolbar_recent_menu; - GtkToolItem *open_button; - GtkAction *action; + GtkWidget *button; + GtkWidget *image; - recent_manager = gtk_recent_manager_get_default (); + button = gtk_button_new (); + image = gtk_image_new (); - /* recent files menu tool button */ - toolbar_recent_menu = gtk_recent_chooser_menu_new_for_manager (recent_manager); + gtk_button_set_image (GTK_BUTTON (button), image); + gtk_style_context_add_class (gtk_widget_get_style_context (button), "flat"); + gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action); + gtk_button_set_label (GTK_BUTTON (button), NULL); + gtk_widget_set_tooltip_text (button, gtk_action_get_tooltip (action)); - gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER(toolbar_recent_menu), - FALSE); - gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER(toolbar_recent_menu), GTK_RECENT_SORT_MRU); - gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER(toolbar_recent_menu), xed_prefs_manager_get_max_recents ()); - - filter = gtk_recent_filter_new (); - gtk_recent_filter_add_group (filter, "xed"); - gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER(toolbar_recent_menu), filter); - - g_signal_connect(toolbar_recent_menu, "item_activated", G_CALLBACK (recent_chooser_item_activated), window); - - /* add the custom Open button to the toolbar */ - open_button = gtk_menu_tool_button_new_from_stock (GTK_STOCK_OPEN); - gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON(open_button), toolbar_recent_menu); - - gtk_tool_item_set_tooltip_text (open_button, _("Open a file")); - gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON(open_button), _("Open a recently used file")); - - action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileOpen"); - g_object_set (action, "short_label", _("Open"), NULL); - gtk_activatable_set_related_action (GTK_ACTIVATABLE(open_button), action); - - gtk_toolbar_insert (GTK_TOOLBAR(toolbar), open_button, 1); - - return toolbar_recent_menu; + return button; } static void @@ -1197,6 +1111,11 @@ create_menu_bar_and_toolbar (XedWindow *window, GtkRecentManager *recent_manager; GError *error = NULL; gchar *ui_file; + GtkWidget *tool_item; + GtkWidget *tool_box; + GtkWidget *box; + GtkWidget *separator; + GtkWidget *button; xed_debug (DEBUG_WINDOW); @@ -1223,16 +1142,6 @@ create_menu_bar_and_toolbar (XedWindow *window, g_object_unref (action_group); window->priv->action_group = action_group; - /* set short labels to use in the toolbar */ - action = gtk_action_group_get_action (action_group, "FileSave"); - g_object_set (action, "short_label", _("Save"), NULL); - action = gtk_action_group_get_action (action_group, "FilePrint"); - g_object_set (action, "short_label", _("Print"), NULL); - action = gtk_action_group_get_action (action_group, "SearchFind"); - g_object_set (action, "short_label", _("Find"), NULL); - action = gtk_action_group_get_action (action_group, "SearchReplace"); - g_object_set (action, "short_label", _("Replace"), NULL); - action_group = gtk_action_group_new ("XedQuitWindowActions"); gtk_action_group_set_translation_domain (action_group, NULL); gtk_action_group_add_actions (action_group, xed_quit_menu_entries, G_N_ELEMENTS(xed_quit_menu_entries), window); @@ -1302,17 +1211,82 @@ create_menu_bar_and_toolbar (XedWindow *window, window->priv->menubar = gtk_ui_manager_get_widget (manager, "/MenuBar"); gtk_box_pack_start (GTK_BOX(main_box), window->priv->menubar, FALSE, FALSE, 0); - window->priv->toolbar = gtk_ui_manager_get_widget (manager, "/ToolBar"); - gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->toolbar), - GTK_STYLE_CLASS_PRIMARY_TOOLBAR); + window->priv->toolbar = gtk_toolbar_new (); + gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_box_pack_start (GTK_BOX(main_box), window->priv->toolbar, FALSE, FALSE, 0); + tool_item = gtk_tool_item_new (); + gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar), GTK_TOOL_ITEM (tool_item), 0); + + tool_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + gtk_container_add (GTK_CONTAINER (tool_item), tool_box); + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (tool_box), box, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileNew"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileOpen"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "FileSave"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (tool_box), separator, FALSE, FALSE, 0); + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (tool_box), box, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditUndo"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditRedo"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (tool_box), separator, FALSE, FALSE, 0); + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (tool_box), box, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditCut"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditCopy"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditPaste"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (tool_box), separator, FALSE, FALSE, 0); + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (tool_box), box, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "SearchFind"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "SearchReplace"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + gtk_widget_show_all (GTK_WIDGET (window->priv->toolbar)); + set_toolbar_style (window, NULL); - window->priv->toolbar_recent_menu = setup_toolbar_open_button (window, window->priv->toolbar); - - gtk_container_foreach (GTK_CONTAINER(window->priv->toolbar), (GtkCallback) set_non_homogeneus, NULL); - g_signal_connect_after(G_OBJECT (window->priv->toolbar), "show", G_CALLBACK (toolbar_visibility_changed), window); g_signal_connect_after(G_OBJECT (window->priv->toolbar), "hide", G_CALLBACK (toolbar_visibility_changed), window); } @@ -2404,16 +2378,16 @@ fullscreen_controls_show (XedWindow *window) { GdkScreen *screen; GdkRectangle fs_rect; - gint w, h; + gint min_h, nat_h; - screen = gtk_window_get_screen (GTK_WINDOW(window)); + screen = gtk_window_get_screen (GTK_WINDOW (window)); gdk_screen_get_monitor_geometry ( screen, gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET(window))), &fs_rect); - gtk_window_get_size (GTK_WINDOW(window->priv->fullscreen_controls), &w, &h); - gtk_window_resize (GTK_WINDOW(window->priv->fullscreen_controls), fs_rect.width, h); - gtk_window_move (GTK_WINDOW(window->priv->fullscreen_controls), fs_rect.x, fs_rect.y - h + 1); + gtk_widget_get_preferred_height (window->priv->fullscreen_controls_container, &min_h, &nat_h); + gtk_window_resize (GTK_WINDOW (window->priv->fullscreen_controls), fs_rect.width, nat_h); + gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls), fs_rect.x, fs_rect.y - nat_h + 1); gtk_widget_show_all (window->priv->fullscreen_controls); } @@ -2544,9 +2518,11 @@ static void fullscreen_controls_build (XedWindow *window) { XedWindowPrivate *priv = window->priv; - GtkWidget *toolbar; - GtkWidget *toolbar_recent_menu; GtkAction *action; + GtkWidget *box; + GtkWidget *fullscreen_btn; + GtkWidget *separator; + GtkWidget *button; if (priv->fullscreen_controls != NULL) { @@ -2557,19 +2533,69 @@ fullscreen_controls_build (XedWindow *window) gtk_window_set_transient_for (GTK_WINDOW(priv->fullscreen_controls), &window->window); - /* popup toolbar */ - toolbar = gtk_ui_manager_get_widget (priv->manager, "/FullscreenToolBar"); - gtk_container_add (GTK_CONTAINER(priv->fullscreen_controls), toolbar); + window->priv->fullscreen_controls_container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (window->priv->fullscreen_controls_container), 6); + gtk_container_add (GTK_CONTAINER (priv->fullscreen_controls), window->priv->fullscreen_controls_container); + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_vexpand (box, FALSE); + gtk_box_pack_start (GTK_BOX (window->priv->fullscreen_controls_container), box, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileNew"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileOpen"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "FileSave"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 6); + + action = gtk_action_group_get_action (window->priv->action_group, "EditUndo"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditRedo"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 6); + + action = gtk_action_group_get_action (window->priv->action_group, "EditCut"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditCopy"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "EditPaste"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); + gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 6); + + action = gtk_action_group_get_action (window->priv->action_group, "SearchFind"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); + + action = gtk_action_group_get_action (window->priv->action_group, "SearchReplace"); + button = create_toolbar_button (action); + gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); action = gtk_action_group_get_action (priv->always_sensitive_action_group, "LeaveFullscreen"); g_object_set (action, "is-important", TRUE, NULL); + fullscreen_btn = create_toolbar_button (action); + gtk_box_pack_end (GTK_BOX (box), fullscreen_btn, FALSE, FALSE, 0); - toolbar_recent_menu = setup_toolbar_open_button (window, toolbar); - - gtk_container_foreach (GTK_CONTAINER(toolbar), (GtkCallback) set_non_homogeneus, NULL); - - /* Set the toolbar style */ - gtk_toolbar_set_style (GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); + gtk_widget_show_all (window->priv->fullscreen_controls_container); g_signal_connect(priv->fullscreen_controls, "enter-notify-event", G_CALLBACK (on_fullscreen_controls_enter_notify_event), window); From 46c8d8adc88c540095c7533b680e652a46231be9 Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Wed, 5 Oct 2016 12:20:30 -0700 Subject: [PATCH 2/3] ui: Convert the remaining actions to use symbolic icons With the toolbar icons converted to symbolic icons we now have a mix of symbolic and non-symbolic icons in the menu since they share the same GtkAction's. Convert the remaining actions along with a couple that are placed in the menu by plugins to use symbolic style icons. --- plugins/sort/xed-sort-plugin.c | 2 +- plugins/spell/xed-spell-plugin.c | 2 +- xed/xed-ui.h | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/sort/xed-sort-plugin.c b/plugins/sort/xed-sort-plugin.c index de79dc7..b64bd98 100644 --- a/plugins/sort/xed-sort-plugin.c +++ b/plugins/sort/xed-sort-plugin.c @@ -84,7 +84,7 @@ static void sort_real (SortDialog *dialog); static const GtkActionEntry action_entries[] = { { "Sort", - GTK_STOCK_SORT_ASCENDING, + "view-sort-ascending-symbolic", N_("S_ort..."), NULL, N_("Sort the current document or selection"), diff --git a/plugins/spell/xed-spell-plugin.c b/plugins/spell/xed-spell-plugin.c index e43429c..32ac6eb 100644 --- a/plugins/spell/xed-spell-plugin.c +++ b/plugins/spell/xed-spell-plugin.c @@ -88,7 +88,7 @@ static void auto_spell_cb (GtkAction *action, XedWindow *window); static const GtkActionEntry action_entries[] = { { "CheckSpell", - GTK_STOCK_SPELL_CHECK, + "tools-check-spelling-symbolic", N_("_Check Spelling..."), "F7", N_("Check the current document for incorrect spelling"), diff --git a/xed/xed-ui.h b/xed/xed-ui.h index f188ca6..ded0db2 100644 --- a/xed/xed-ui.h +++ b/xed/xed-ui.h @@ -59,13 +59,13 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] = N_("Open a file"), G_CALLBACK (_xed_cmd_file_open) }, /* Edit menu */ - { "EditPreferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL, + { "EditPreferences", "preferences-other-symbolic", N_("Pr_eferences"), NULL, N_("Configure the application"), G_CALLBACK (_xed_cmd_edit_preferences) }, /* Help menu */ - {"HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", + {"HelpContents", "help-contents-symbolic", N_("_Contents"), "F1", N_("Open the xed manual"), G_CALLBACK (_xed_cmd_help_contents) }, - { "HelpAbout", GTK_STOCK_ABOUT, NULL, NULL, + { "HelpAbout", "help-about-symbolic", N_("About"), NULL, N_("About this application"), G_CALLBACK (_xed_cmd_help_about) }, /* Fullscreen toolbar */ @@ -79,13 +79,13 @@ static const GtkActionEntry xed_menu_entries[] = /* File menu */ { "FileSave", "document-save-symbolic", N_("_Save"), "S", N_("Save the current file"), G_CALLBACK (_xed_cmd_file_save) }, - { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "S", + { "FileSaveAs", "document-save-as-symbolic", N_("Save _As..."), "S", N_("Save the current file with a different name"), G_CALLBACK (_xed_cmd_file_save_as) }, - { "FileRevert", GTK_STOCK_REVERT_TO_SAVED, NULL, NULL, + { "FileRevert", "document-revert-symbolic", N_("Revert"), NULL, N_("Revert to a saved version of the file"), G_CALLBACK (_xed_cmd_file_revert) }, - { "FilePrintPreview", GTK_STOCK_PRINT_PREVIEW, N_("Print Previe_w"),"P", + { "FilePrintPreview", "document-print-preview-symbolic", N_("Print Previe_w"),"P", N_("Print preview"), G_CALLBACK (_xed_cmd_file_print_preview) }, - { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "P", + { "FilePrint", "document-print-symbolic", N_("_Print..."), "P", N_("Print the current page"), G_CALLBACK (_xed_cmd_file_print) }, /* Edit menu */ @@ -99,9 +99,9 @@ static const GtkActionEntry xed_menu_entries[] = N_("Copy the selection"), G_CALLBACK (_xed_cmd_edit_copy) }, { "EditPaste", "edit-paste-symbolic", N_("Paste"), "V", N_("Paste the clipboard"), G_CALLBACK (_xed_cmd_edit_paste) }, - { "EditDelete", GTK_STOCK_DELETE, NULL, NULL, + { "EditDelete", "edit-delete-symbolic", N_("Delete"), NULL, N_("Delete the selected text"), G_CALLBACK (_xed_cmd_edit_delete) }, - { "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "A", + { "EditSelectAll", "edit-select-all-symbolic", N_("Select _All"), "A", N_("Select the entire document"), G_CALLBACK (_xed_cmd_edit_select_all) }, /* View menu */ @@ -116,13 +116,13 @@ static const GtkActionEntry xed_menu_entries[] = N_("Search backwards for the same text"), G_CALLBACK (_xed_cmd_search_find_prev) }, { "SearchReplace", "edit-find-replace-symbolic", N_("_Replace"), "H", N_("Search for and replace text"), G_CALLBACK (_xed_cmd_search_replace) }, - { "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "I", + { "SearchGoToLine", "go-jump-symbolic", N_("Go to _Line..."), "I", N_("Go to a specific line"), G_CALLBACK (_xed_cmd_search_goto_line) }, /* Documents menu */ - { "FileSaveAll", GTK_STOCK_SAVE, N_("_Save All"), "L", + { "FileSaveAll", "document-save-symbolic", N_("_Save All"), "L", N_("Save all open files"), G_CALLBACK (_xed_cmd_file_save_all) }, - { "FileCloseAll", GTK_STOCK_CLOSE, N_("_Close All"), "W", + { "FileCloseAll", "window-close-symbolic", N_("_Close All"), "W", N_("Close all open files"), G_CALLBACK (_xed_cmd_file_close_all) }, { "DocumentsPreviousDocument", NULL, N_("_Previous Document"), "Page_Up", N_("Activate previous document"), G_CALLBACK (_xed_cmd_documents_previous_document) }, @@ -135,14 +135,14 @@ static const GtkActionEntry xed_menu_entries[] = /* separate group, needs to be sensitive on OS X even when there are no tabs */ static const GtkActionEntry xed_close_menu_entries[] = { - { "FileClose", GTK_STOCK_CLOSE, NULL, "W", + { "FileClose", "window-close-symbolic", N_("_Close"), "W", N_("Close the current file"), G_CALLBACK (_xed_cmd_file_close) } }; /* separate group, should be sensitive even when there are no tabs */ static const GtkActionEntry xed_quit_menu_entries[] = { - { "FileQuit", GTK_STOCK_QUIT, NULL, "Q", + { "FileQuit", "application-exit-symbolic", N_("_Quit"), "Q", N_("Quit the program"), G_CALLBACK (_xed_cmd_file_quit) } }; From 2ecb36178adde63c46855a5f282d8912d22cd249 Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Thu, 6 Oct 2016 10:33:53 -0700 Subject: [PATCH 3/3] prefs: Remove now unused toolbar style prefs We no longer set a toolbar button style so remove some of the left over code for handling it. --- data/org.x.editor.gschema.xml.in | 5 --- xed/xed-prefs-manager.c | 70 -------------------------------- xed/xed-prefs-manager.h | 13 ------ xed/xed-window.c | 1 - 4 files changed, 89 deletions(-) diff --git a/data/org.x.editor.gschema.xml.in b/data/org.x.editor.gschema.xml.in index 79c5582..8dc46c9 100644 --- a/data/org.x.editor.gschema.xml.in +++ b/data/org.x.editor.gschema.xml.in @@ -111,11 +111,6 @@ Toolbar is Visible Whether the toolbar should be visible in editing windows. - - '@TOOLBAR_STYLE@' - Toolbar Buttons Style - Style for the toolbar buttons. Possible values are "XED_TOOLBAR_SYSTEM" to use the system's default style, "XED_TOOLBAR_ICONS" to display icons only, "XED_TOOLBAR_ICONS_AND_TEXT" to display both icons and text, and "XED_TOOLBAR_ICONS_BOTH_HORIZ" to display prioritized text beside icons. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here. - true Status Bar is Visible diff --git a/xed/xed-prefs-manager.c b/xed/xed-prefs-manager.c index ffb49f5..55fc695 100644 --- a/xed/xed-prefs-manager.c +++ b/xed/xed-prefs-manager.c @@ -359,76 +359,6 @@ DEFINE_BOOL_PREF (display_line_numbers, DEFINE_BOOL_PREF (toolbar_visible, GPM_TOOLBAR_VISIBLE) - -/* Toolbar suttons style */ -XedToolbarSetting -xed_prefs_manager_get_toolbar_buttons_style (void) -{ - gchar *str; - XedToolbarSetting res; - - xed_debug (DEBUG_PREFS); - - str = xed_prefs_manager_get_string (GPM_TOOLBAR_BUTTONS_STYLE); - - if (strcmp (str, "XED_TOOLBAR_ICONS") == 0) - res = XED_TOOLBAR_ICONS; - else - { - if (strcmp (str, "XED_TOOLBAR_ICONS_AND_TEXT") == 0) - res = XED_TOOLBAR_ICONS_AND_TEXT; - else - { - if (strcmp (str, "XED_TOOLBAR_ICONS_BOTH_HORIZ") == 0) - res = XED_TOOLBAR_ICONS_BOTH_HORIZ; - else - res = XED_TOOLBAR_SYSTEM; - } - } - - g_free (str); - - return res; -} - -void -xed_prefs_manager_set_toolbar_buttons_style (XedToolbarSetting tbs) -{ - const gchar * str; - - xed_debug (DEBUG_PREFS); - - switch (tbs) - { - case XED_TOOLBAR_ICONS: - str = "XED_TOOLBAR_ICONS"; - break; - - case XED_TOOLBAR_ICONS_AND_TEXT: - str = "XED_TOOLBAR_ICONS_AND_TEXT"; - break; - - case XED_TOOLBAR_ICONS_BOTH_HORIZ: - str = "XED_TOOLBAR_ICONS_BOTH_HORIZ"; - break; - default: /* XED_TOOLBAR_SYSTEM */ - str = "XED_TOOLBAR_SYSTEM"; - } - - xed_prefs_manager_set_string (GPM_TOOLBAR_BUTTONS_STYLE, - str); - -} - -gboolean -xed_prefs_manager_toolbar_buttons_style_can_set (void) -{ - xed_debug (DEBUG_PREFS); - - return xed_prefs_manager_key_is_writable (GPM_TOOLBAR_BUTTONS_STYLE); - -} - /* Statusbar visiblity */ DEFINE_BOOL_PREF (statusbar_visible, GPM_STATUSBAR_VISIBLE) diff --git a/xed/xed-prefs-manager.h b/xed/xed-prefs-manager.h index 24c10ea..41e45e9 100644 --- a/xed/xed-prefs-manager.h +++ b/xed/xed-prefs-manager.h @@ -74,7 +74,6 @@ /* UI */ #define GPM_TOOLBAR_VISIBLE "toolbar-visible" -#define GPM_TOOLBAR_BUTTONS_STYLE "toolbar-buttons-style" #define GPM_STATUSBAR_VISIBLE "statusbar-visible" @@ -115,13 +114,6 @@ #define GPM_DEFAULT_AUTO_SAVE_INTERVAL 10 /* minutes */ #define GPM_DEFAULT_MAX_RECENTS 5 -typedef enum { - XED_TOOLBAR_SYSTEM = 0, - XED_TOOLBAR_ICONS, - XED_TOOLBAR_ICONS_AND_TEXT, - XED_TOOLBAR_ICONS_BOTH_HORIZ -} XedToolbarSetting; - /** LIFE CYCLE MANAGEMENT FUNCTIONS **/ gboolean xed_prefs_manager_init (void); @@ -195,11 +187,6 @@ gboolean xed_prefs_manager_get_toolbar_visible (void); void xed_prefs_manager_set_toolbar_visible (gboolean tv); gboolean xed_prefs_manager_toolbar_visible_can_set (void); -/* Toolbar buttons style */ -XedToolbarSetting xed_prefs_manager_get_toolbar_buttons_style (void); -void xed_prefs_manager_set_toolbar_buttons_style (XedToolbarSetting tbs); -gboolean xed_prefs_manager_toolbar_buttons_style_can_set (void); - /* Statusbar visible */ gboolean xed_prefs_manager_get_statusbar_visible (void); void xed_prefs_manager_set_statusbar_visible (gboolean sv); diff --git a/xed/xed-window.c b/xed/xed-window.c index ae72104..97d7921 100644 --- a/xed/xed-window.c +++ b/xed/xed-window.c @@ -399,7 +399,6 @@ set_toolbar_style (XedWindow *window, XedWindow *origin) { gboolean visible; - XedToolbarSetting style; GtkAction *action; if (origin == NULL)