[Xfce4-commits] r30097 - terminal/trunk/terminal

Nick Schermer nick at xfce.org
Sat Jun 27 21:31:18 CEST 2009


Author: nick
Date: 2009-06-27 19:31:18 +0000 (Sat, 27 Jun 2009)
New Revision: 30097

Modified:
   terminal/trunk/terminal/terminal-gtk-extensions.c
   terminal/trunk/terminal/terminal-gtk-extensions.h
   terminal/trunk/terminal/terminal-preferences-dialog.c
   terminal/trunk/terminal/terminal-tab-header.c
   terminal/trunk/terminal/terminal-widget.c
Log:
Remove deprecated GTK api (ie. new tooltip functions).


Modified: terminal/trunk/terminal/terminal-gtk-extensions.c
===================================================================
--- terminal/trunk/terminal/terminal-gtk-extensions.c	2009-06-27 19:31:01 UTC (rev 30096)
+++ terminal/trunk/terminal/terminal-gtk-extensions.c	2009-06-27 19:31:18 UTC (rev 30097)
@@ -58,44 +58,3 @@
   atk_relation_set_add (relations, relation);
   g_object_unref (G_OBJECT (relation));
 }
-
-
-
-/**
- * terminal_gtk_widget_set_tooltip:
- * @widget : a #GtkWidget for which to set the tooltip.
- * @format : a printf(3)-style format string.
- * @...    : additional arguments for @format.
- *
- * Sets the tooltip for the @widget to a string generated
- * from the @format and the additional arguments in @...<!--->,
- * utilizing the shared #GtkTooltips instance.
- **/
-void
-terminal_gtk_widget_set_tooltip (GtkWidget   *widget,
-                                 const gchar *format,
-                                 ...)
-{
-  static GtkTooltips *tooltips = NULL;
-  va_list             var_args;
-  gchar              *tooltip;
-
-  _terminal_return_if_fail (GTK_IS_WIDGET (widget));
-  _terminal_return_if_fail (g_utf8_validate (format, -1, NULL));
-
-  /* allocate the shared tooltips on-demand */
-  if (G_UNLIKELY (tooltips == NULL))
-    tooltips = gtk_tooltips_new ();
-
-  /* determine the tooltip */
-  va_start (var_args, format);
-  tooltip = g_strdup_vprintf (format, var_args);
-  va_end (var_args);
-
-  /* setup the tooltip for the widget */
-  gtk_tooltips_set_tip (tooltips, widget, tooltip, NULL);
-
-  /* release the tooltip */
-  g_free (tooltip);
-}
-

Modified: terminal/trunk/terminal/terminal-gtk-extensions.h
===================================================================
--- terminal/trunk/terminal/terminal-gtk-extensions.h	2009-06-27 19:31:01 UTC (rev 30096)
+++ terminal/trunk/terminal/terminal-gtk-extensions.h	2009-06-27 19:31:18 UTC (rev 30097)
@@ -27,10 +27,6 @@
 void terminal_gtk_label_set_a11y_relation (GtkLabel    *label,
                                            GtkWidget   *widget) G_GNUC_INTERNAL;
 
-void terminal_gtk_widget_set_tooltip      (GtkWidget   *widget,
-                                           const gchar *format,
-                                           ...) G_GNUC_INTERNAL G_GNUC_PRINTF (2, 3);
-
 G_END_DECLS;
 
 #endif /* !__TERMINAL_GTK_EXTENSIONS_H__ */

Modified: terminal/trunk/terminal/terminal-preferences-dialog.c
===================================================================
--- terminal/trunk/terminal/terminal-preferences-dialog.c	2009-06-27 19:31:01 UTC (rev 30096)
+++ terminal/trunk/terminal/terminal-preferences-dialog.c	2009-06-27 19:31:18 UTC (rev 30097)
@@ -124,6 +124,7 @@
   gchar             *name;
   gint               idx;
   gint               n;
+  gchar             *palette_tip;
 
   dialog->preferences = terminal_preferences_get ();
 
@@ -254,11 +255,11 @@
 
   button = gtk_check_button_new_with_mnemonic (_("_Run command as login shell"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "command-login-shell", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Select this option to force Terminal to run your shell as a login shell "
-                                     "when you open new terminals. See the documentation of your shell for "
-                                     "details about differences between running it as interactive shell and "
-                                     "running it as login shell."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Select this option to force Terminal to run your shell as a login shell "
+                                 "when you open new terminals. See the documentation of your shell for "
+                                 "details about differences between running it as interactive shell and "
+                                 "running it as login shell."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 
@@ -288,9 +289,9 @@
 
   button = gtk_check_button_new_with_mnemonic (_("Scroll single _line using Shift-Up/-Down keys"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "scrolling-single-line", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option to be able to scroll by a single line "
-                                     "using the up/down arrow keys together with the Shift key."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option to be able to scroll by a single line "
+                                 "using the up/down arrow keys together with the Shift key."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -300,19 +301,19 @@
 
   button = gtk_check_button_new_with_mnemonic (_("Sc_roll on output"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "scrolling-on-output", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("This option controls whether the terminal will scroll "
-                                     "down automatically whenever new output is generated by "
-                                     "the commands running inside the terminal."));
+  gtk_widget_set_tooltip_text (button,
+                               _("This option controls whether the terminal will scroll "
+                                 "down automatically whenever new output is generated by "
+                                 "the commands running inside the terminal."));
   gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
   gtk_widget_show (button);
 
   button = gtk_check_button_new_with_mnemonic (_("Scroll on _keystroke"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "scrolling-on-keystroke", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enables you to press any key on the "
-                                     "keyboard to scroll down the terminal "
-                                     "window to the command prompt."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enables you to press any key on the "
+                                 "keyboard to scroll down the terminal "
+                                 "window to the command prompt."));
   gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
   gtk_widget_show (button);
 
@@ -342,9 +343,9 @@
   gtk_entry_set_activates_default (GTK_ENTRY (button), TRUE);
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "scrolling-lines",
                           G_OBJECT (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (button))), "value");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Specifies the number of lines that you can "
-                                     "scroll back using the scrollbar."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Specifies the number of lines that you can "
+                                 "scroll back using the scrollbar."));
   gtk_table_attach (GTK_TABLE (table), button, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
   gtk_widget_show (button);
@@ -394,20 +395,20 @@
 #if TERMINAL_HAS_ANTI_ALIAS_SETTING
   button = gtk_check_button_new_with_mnemonic (_("Enable anti-aliasing for the terminal font"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "font-anti-alias", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option if you want Terminal to use anti-aliasing when "
-                                     "rendering text in terminal windows. Disabling this option can "
-                                     "impressively speed up terminal rendering performance and reduce "
-                                     "the overall system load on slow systems."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option if you want Terminal to use anti-aliasing when "
+                                 "rendering text in terminal windows. Disabling this option can "
+                                 "impressively speed up terminal rendering performance and reduce "
+                                 "the overall system load on slow systems."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 #endif
 
   button = gtk_check_button_new_with_mnemonic (_("Allow bold text"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "font-allow-bold", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option to allow applications running inside the "
-                                     "terminal windows to use bold text."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option to allow applications running inside the "
+                                 "terminal windows to use bold text."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 
@@ -531,25 +532,25 @@
 
   button = gtk_check_button_new_with_mnemonic (_("Display _menubar in new windows"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-menubar-default", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option to show the menubar in newly "
-                                     "created terminal windows."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option to show the menubar in newly "
+                                 "created terminal windows."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
   button = gtk_check_button_new_with_mnemonic (_("Display _toolbars in new windows"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-toolbars-default", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option to show the toolbars in newly "
-                                     "created terminal windows."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option to show the toolbars in newly "
+                                 "created terminal windows."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
   button = gtk_check_button_new_with_mnemonic (_("Display _borders around new windows"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-borders-default", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button,
-                                   _("Enable this option to show window decorations around newly "
-                                     "created terminal windows."));
+  gtk_widget_set_tooltip_text (button,
+                               _("Enable this option to show window decorations around newly "
+                                 "created terminal windows."));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
@@ -681,14 +682,14 @@
 
   button = gtk_radio_button_new_with_mnemonic (NULL, _("Use _default color"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "color-selection-use-default", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button, _("Use the default text selection background color"));
+  gtk_widget_set_tooltip_text (button, _("Use the default text selection background color"));
   gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
   group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
   gtk_widget_show (button);
 
   button = gtk_radio_button_new_with_mnemonic (group, _("Use _custom color"));
   exo_mutual_binding_new_with_negation (G_OBJECT (dialog->preferences), "color-selection-use-default", G_OBJECT (button), "active");
-  terminal_gtk_widget_set_tooltip (button, _("Use a custom text selection background color"));
+  gtk_widget_set_tooltip_text (button, _("Use a custom text selection background color"));
   gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -747,7 +748,9 @@
       gtk_widget_show (button);
 
       /* setup a tooltip */
-      terminal_gtk_widget_set_tooltip (button, _("Palette entry %d"), (n + 1));
+      palette_tip = g_strdup_printf (_("Palette entry %d"), n + 1);
+      gtk_widget_set_tooltip_text (button, palette_tip);
+      g_free (palette_tip);
 
       /* sync with the appropriate preference */
       name = g_strdup_printf ("color-palette%d", (n + 1));
@@ -958,11 +961,11 @@
   entry = gtk_entry_new ();
   gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "term", G_OBJECT (entry), "text");
-  terminal_gtk_widget_set_tooltip (entry,
-                                   _("This specifies the value the $TERM environment variable is set "
-                                     "to, when a new terminal tab or terminal window is opened. The default "
-                                     "should be ok for most systems. If you have problems with colors in "
-                                     "some applications, try xterm-color here."));
+  gtk_widget_set_tooltip_text (entry, 
+                               _("This specifies the value the $TERM environment variable is set "
+                                 "to, when a new terminal tab or terminal window is opened. The default "
+                                 "should be ok for most systems. If you have problems with colors in "
+                                 "some applications, try xterm-color here."));
   gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
   gtk_widget_show (entry);

Modified: terminal/trunk/terminal/terminal-tab-header.c
===================================================================
--- terminal/trunk/terminal/terminal-tab-header.c	2009-06-27 19:31:01 UTC (rev 30096)
+++ terminal/trunk/terminal/terminal-tab-header.c	2009-06-27 19:31:18 UTC (rev 30097)
@@ -200,7 +200,7 @@
   button = gtk_button_new ();
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_container_set_border_width (GTK_CONTAINER (button), 0);
-  terminal_gtk_widget_set_tooltip (button, _("Close this tab"));
+  gtk_widget_set_tooltip_text (button, _("Close this tab"));
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (terminal_tab_header_close_tab), header);
   gtk_box_pack_start (GTK_BOX (header), button, FALSE, FALSE, 0);
   exo_binding_new (G_OBJECT (header->preferences), "misc-tab-close-buttons", G_OBJECT (button), "visible");
@@ -298,7 +298,7 @@
 
     case PROP_TITLE:
       title = g_value_get_string (value);
-      terminal_gtk_widget_set_tooltip (header->ebox, "%s", title);
+      gtk_widget_set_tooltip_text (header->ebox, title);
       gtk_label_set_text (GTK_LABEL (header->label), title);
       break;
 

Modified: terminal/trunk/terminal/terminal-widget.c
===================================================================
--- terminal/trunk/terminal/terminal-widget.c	2009-06-27 19:31:01 UTC (rev 30096)
+++ terminal/trunk/terminal/terminal-widget.c	2009-06-27 19:31:18 UTC (rev 30097)
@@ -358,8 +358,7 @@
     }
 
   /* take a reference on the menu */
-  g_object_ref (G_OBJECT (menu));
-  gtk_object_sink (GTK_OBJECT (menu));
+  g_object_ref_sink (G_OBJECT (menu));
 
   if (event_time == 0)
     event_time = gtk_get_current_event_time ();




More information about the Xfce4-commits mailing list