[Xfce4-commits] [apps/xfce4-terminal] 01/01: Use gtk_widget_show_all() to show containets together will all widgets
noreply at xfce.org
noreply at xfce.org
Thu Jul 14 11:41:35 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit 13a7b10a6ddd49b50d80c61b3610f2a4d2ebc72a
Author: Igor <f2404 at yandex.ru>
Date: Thu Jul 14 12:40:33 2016 +0300
Use gtk_widget_show_all() to show containets together will all widgets
instead of multiple per-widget gtk_widget_show() calls
---
terminal/terminal-encoding-action.c | 6 ++----
terminal/terminal-screen.c | 10 ++++------
terminal/terminal-search-dialog.c | 12 +-----------
terminal/terminal-widget.c | 5 ++---
terminal/terminal-window-dropdown.c | 28 +++++++++++-----------------
terminal/terminal-window.c | 17 ++++-------------
6 files changed, 24 insertions(+), 54 deletions(-)
diff --git a/terminal/terminal-encoding-action.c b/terminal/terminal-encoding-action.c
index 33cdadf..d08b48c 100644
--- a/terminal/terminal-encoding-action.c
+++ b/terminal/terminal-encoding-action.c
@@ -273,7 +273,6 @@ terminal_encoding_action_menu_shown (GtkWidget *menu,
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), found);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (terminal_encoding_action_activated), action);
- gtk_widget_show (item);
g_free (default_label);
/*add the groups */
@@ -282,7 +281,6 @@ terminal_encoding_action_menu_shown (GtkWidget *menu,
/* category item */
item = gtk_menu_item_new_with_label (_(terminal_encodings_names[n]));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
submenu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
@@ -298,7 +296,6 @@ terminal_encoding_action_menu_shown (GtkWidget *menu,
groups = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item2));
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item2);
g_object_set_qdata (G_OBJECT (item2), encoding_action_quark, (gchar *) charset);
- gtk_widget_show (item2);
if (!found
&& strcmp (action->current, charset) == 0)
@@ -325,7 +322,6 @@ terminal_encoding_action_menu_shown (GtkWidget *menu,
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item2), TRUE);
g_signal_connect (G_OBJECT (item2), "activate",
G_CALLBACK (terminal_encoding_action_activated), action);
- gtk_widget_show (item2);
/* other group */
bold_item = item;
@@ -339,6 +335,8 @@ terminal_encoding_action_menu_shown (GtkWidget *menu,
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
}
+
+ gtk_widget_show_all (menu);
}
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index d5d5825..aff40ae 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -274,7 +274,6 @@ terminal_screen_init (TerminalScreen *screen)
gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (screen->terminal)));
gtk_box_pack_start (GTK_BOX (screen), screen->scrollbar, FALSE, FALSE, 0);
g_signal_connect_after (G_OBJECT (screen->scrollbar), "button-press-event", G_CALLBACK (gtk_true), NULL);
- gtk_widget_show (screen->scrollbar);
/* watch preferences changes */
screen->preferences = terminal_preferences_get ();
@@ -306,7 +305,7 @@ terminal_screen_init (TerminalScreen *screen)
G_CALLBACK (terminal_screen_vte_window_contents_resized), screen);
/* show the terminal */
- gtk_widget_show (screen->terminal);
+ gtk_widget_show_all (GTK_WIDGET (screen));
}
@@ -2135,7 +2134,6 @@ terminal_screen_get_tab_label (TerminalScreen *screen)
/* create the box */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
- gtk_widget_show (hbox);
screen->tab_label = gtk_label_new (NULL);
gtk_widget_set_margin_start (screen->tab_label, 2);
@@ -2148,7 +2146,6 @@ terminal_screen_get_tab_label (TerminalScreen *screen)
G_OBJECT (screen->tab_label), "tooltip-text",
G_BINDING_SYNC_CREATE);
gtk_widget_set_has_tooltip (screen->tab_label, TRUE);
- gtk_widget_show (screen->tab_label);
button = gtk_button_new ();
#if GTK_CHECK_VERSION (3,20,0)
@@ -2165,12 +2162,13 @@ terminal_screen_get_tab_label (TerminalScreen *screen)
gtk_container_add (GTK_CONTAINER (hbox), button);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy), screen);
- gtk_widget_show (button);
/* button image */
image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (button), image);
- gtk_widget_show (image);
+
+ /* show the box and all its widgets */
+ gtk_widget_show_all (hbox);
/* update orientation */
terminal_screen_update_label_orientation (screen);
diff --git a/terminal/terminal-search-dialog.c b/terminal/terminal-search-dialog.c
index 1670b3b..b45ddb8 100644
--- a/terminal/terminal-search-dialog.c
+++ b/terminal/terminal-search-dialog.c
@@ -94,29 +94,23 @@ terminal_search_dialog_init (TerminalSearchDialog *dialog)
close = xfce_gtk_button_new_mixed ("window-close", _("_Close"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), close, GTK_RESPONSE_CLOSE);
gtk_widget_set_can_default (close, TRUE);
- gtk_widget_show (close);
dialog->button_prev = xfce_gtk_button_new_mixed ("go-previous", _("_Previous"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), dialog->button_prev, TERMINAL_RESPONSE_SEARCH_PREV);
gtk_widget_set_can_default (dialog->button_prev, TRUE);
- gtk_widget_show (dialog->button_prev);
dialog->button_next = xfce_gtk_button_new_mixed ("go-next", _("_Next"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), dialog->button_next, TERMINAL_RESPONSE_SEARCH_NEXT);
- gtk_widget_show (dialog->button_next);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_widget_show (vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
- gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic (_("_Search for:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
dialog->entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), dialog->entry, TRUE, TRUE, 0);
@@ -127,31 +121,26 @@ terminal_search_dialog_init (TerminalSearchDialog *dialog)
G_CALLBACK (terminal_search_dialog_entry_icon_release), NULL);
g_signal_connect (G_OBJECT (dialog->entry), "changed",
G_CALLBACK (terminal_search_dialog_entry_changed), dialog);
- gtk_widget_show (dialog->entry);
dialog->match_case = gtk_check_button_new_with_mnemonic (_("C_ase sensitive"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->match_case, FALSE, FALSE, 0);
g_signal_connect_swapped (G_OBJECT (dialog->match_case), "toggled",
G_CALLBACK (terminal_search_dialog_clear_gregex), dialog);
- gtk_widget_show (dialog->match_case);
dialog->match_regex = gtk_check_button_new_with_mnemonic (_("Match as _regular expression"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->match_regex, FALSE, FALSE, 0);
g_signal_connect_swapped (G_OBJECT (dialog->match_regex), "toggled",
G_CALLBACK (terminal_search_dialog_clear_gregex), dialog);
- gtk_widget_show (dialog->match_regex);
dialog->match_word = gtk_check_button_new_with_mnemonic (_("Match _entire word only"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->match_word, FALSE, FALSE, 0);
g_signal_connect_swapped (G_OBJECT (dialog->match_word), "toggled",
G_CALLBACK (terminal_search_dialog_clear_gregex), dialog);
- gtk_widget_show (dialog->match_word);
dialog->wrap_around = gtk_check_button_new_with_mnemonic (_("_Wrap around"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->wrap_around, FALSE, FALSE, 0);
g_signal_connect_swapped (G_OBJECT (dialog->wrap_around), "toggled",
G_CALLBACK (terminal_search_dialog_clear_gregex), dialog);
- gtk_widget_show (dialog->wrap_around);
terminal_search_dialog_entry_changed (dialog->entry, dialog);
}
@@ -287,6 +276,7 @@ terminal_search_dialog_present (TerminalSearchDialog *dialog)
{
terminal_return_if_fail (TERMINAL_IS_SEARCH_DIALOG (dialog));
+ gtk_widget_show_all (GTK_WIDGET (dialog));
gtk_window_present (GTK_WINDOW (dialog));
gtk_widget_grab_focus (dialog->entry);
}
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index b801f5f..5645d49 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -302,7 +302,6 @@ terminal_widget_context_menu (TerminalWidget *widget,
{
item_separator = gtk_separator_menu_item_new ();
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item_separator);
- gtk_widget_show (item_separator);
}
else
item_separator = NULL;
@@ -333,18 +332,18 @@ terminal_widget_context_menu (TerminalWidget *widget,
g_object_set_data_full (G_OBJECT (item_copy), I_("terminal-widget-link"), g_strdup (match), g_free);
g_signal_connect_swapped (G_OBJECT (item_copy), "activate", G_CALLBACK (terminal_widget_context_menu_copy), widget);
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item_copy);
- gtk_widget_show (item_copy);
/* prepend the "OPEN" menu item */
g_object_set_data_full (G_OBJECT (item_open), I_("terminal-widget-link"), g_strdup (match), g_free);
g_object_set_data_full (G_OBJECT (item_open), I_("terminal-widget-tag"), g_memdup (&tag, sizeof (tag)), g_free);
g_signal_connect_swapped (G_OBJECT (item_open), "activate", G_CALLBACK (terminal_widget_context_menu_open), widget);
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item_open);
- gtk_widget_show (item_open);
g_free (match);
}
+ gtk_widget_show_all (menu);
+
/* take a reference on the menu */
g_object_ref_sink (G_OBJECT (menu));
diff --git a/terminal/terminal-window-dropdown.c b/terminal/terminal-window-dropdown.c
index d47623a..39c9169 100644
--- a/terminal/terminal-window-dropdown.c
+++ b/terminal/terminal-window-dropdown.c
@@ -241,7 +241,6 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
gtk_container_add (GTK_CONTAINER (dropdown), dropdown->viewport);
gtk_container_add (GTK_CONTAINER (dropdown->viewport), child);
g_object_unref (G_OBJECT (child));
- gtk_widget_show (dropdown->viewport);
/* default window settings */
gtk_window_set_decorated (GTK_WINDOW (dropdown), FALSE);
@@ -267,7 +266,6 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
/* notebook buttons */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_notebook_set_action_widget (GTK_NOTEBOOK (window->notebook), hbox, GTK_PACK_END);
- gtk_widget_show (hbox);
button = dropdown->keep_open = gtk_toggle_button_new ();
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@@ -278,14 +276,12 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
#else
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
#endif
- gtk_widget_show (button);
g_object_get (G_OBJECT (window->preferences), "dropdown-keep-open-default", &keep_open, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), keep_open);
img = gtk_image_new_from_icon_name ("go-bottom", GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (button), img);
- gtk_widget_show (img);
action = gtk_action_group_get_action (window->action_group, "preferences");
@@ -300,11 +296,9 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
#endif
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_action_activate), action);
- gtk_widget_show (button);
img = gtk_action_create_icon (action, GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (button), img);
- gtk_widget_show (img);
/* connect bindings */
for (n = 1; n < N_PROPERTIES; n++)
@@ -538,7 +532,6 @@ terminal_window_dropdown_status_icon_popup_menu (GtkStatusIcon *status_
{
GtkActionGroup *group = TERMINAL_WINDOW (dropdown)->action_group;
GtkWidget *menu;
- GtkWidget *mi;
GtkAction *action;
menu = gtk_menu_new ();
@@ -546,19 +539,17 @@ terminal_window_dropdown_status_icon_popup_menu (GtkStatusIcon *status_
G_CALLBACK (gtk_widget_destroy), NULL);
action = gtk_action_group_get_action (group, "preferences");
- mi = gtk_action_create_menu_item (action);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
- gtk_widget_show (mi);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ gtk_action_create_menu_item (action));
- mi = gtk_separator_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
- gtk_widget_show (mi);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ gtk_separator_menu_item_new ());
action = gtk_action_group_get_action (group, "close-window");
- mi = gtk_action_create_menu_item (action);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
- gtk_widget_show (mi);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ gtk_action_create_menu_item (action));
+ gtk_widget_show_all (menu);
gtk_menu_popup (GTK_MENU (menu),
NULL, NULL,
NULL, NULL,
@@ -816,7 +807,10 @@ terminal_window_dropdown_show (TerminalWindowDropdown *dropdown,
/* show window */
if (!visible)
- gtk_window_present_with_time (GTK_WINDOW (dropdown), timestamp);
+ {
+ gtk_widget_show_all (GTK_WIDGET (dropdown));
+ gtk_window_present_with_time (GTK_WINDOW (dropdown), timestamp);
+ }
/* force focus to the window */
terminal_util_activate_window (GTK_WINDOW (dropdown));
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index db48a4b..9de78ef 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -322,7 +322,6 @@ terminal_window_init (TerminalWindow *window)
window->vbox = vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_show (vbox);
/* allocate the notebook for the terminal screens */
g_object_get (G_OBJECT (window->preferences), "misc-always-show-tabs", &always_show_tabs, NULL);
@@ -352,7 +351,7 @@ terminal_window_init (TerminalWindow *window)
G_CALLBACK (terminal_window_notebook_button_release_event), window);
gtk_box_pack_start (GTK_BOX (vbox), window->notebook, TRUE, TRUE, 0);
- gtk_widget_show (window->notebook);
+ gtk_widget_show_all (vbox);
/* create encoding action */
window->encoding_action = terminal_encoding_action_new ("set-encoding", _("Set _Encoding"));
@@ -500,27 +499,22 @@ terminal_window_confirm_close (TerminalWindow *window)
button = xfce_gtk_button_new_mixed ("window-close", _("Close T_ab"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE);
- gtk_widget_show (button);
button = xfce_gtk_button_new_mixed ("application-exit", _("Close _Window"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_YES);
gtk_widget_grab_focus (button);
- gtk_widget_show (button);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- gtk_widget_show (image);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
message = g_strdup_printf (_("This window has %d tabs open. Closing this window\n"
"will also close all its tabs."), n_tabs);
@@ -534,13 +528,13 @@ terminal_window_confirm_close (TerminalWindow *window)
"xalign", 0.0,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
- gtk_widget_show (label);
g_free (markup);
checkbox = gtk_check_button_new_with_mnemonic (_("Do _not ask me again"));
gtk_box_pack_start (GTK_BOX (vbox), checkbox, FALSE, FALSE, 0);
- gtk_widget_show (checkbox);
+
+ gtk_widget_show_all (dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_YES)
@@ -1622,11 +1616,9 @@ terminal_window_action_set_title (GtkAction *action,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), box, TRUE, TRUE, 0);
- gtk_widget_show (box);
label = gtk_label_new_with_mnemonic (_("_Title:"));
gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0);
- gtk_widget_show (label);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
@@ -1634,7 +1626,6 @@ terminal_window_action_set_title (GtkAction *action,
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, "edit-clear");
g_signal_connect (G_OBJECT (entry), "icon-release", G_CALLBACK (title_dialog_clear), NULL);
- gtk_widget_show (entry);
/* set Atk description and label relation for the entry */
object = gtk_widget_get_accessible (entry);
@@ -1647,7 +1638,7 @@ terminal_window_action_set_title (GtkAction *action,
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (title_dialog_response), window);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list