[Xfce4-commits] <thunar:master> Use new tooltip API.

Nick Schermer nick at xfce.org
Sat Aug 22 21:20:06 CEST 2009


Updating branch refs/heads/master
         to 1e2096fcb6bacaadc134d1d99d085532c3df819e (commit)
       from 293bfc66c650d52d4d87b4f6bc7c9f7bd1278934 (commit)

commit 1e2096fcb6bacaadc134d1d99d085532c3df819e
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Aug 22 21:17:55 2009 +0200

    Use new tooltip API.

 thunar/thunar-chooser-dialog.c      |    4 ++--
 thunar/thunar-gtk-extensions.c      |   14 ++++----------
 thunar/thunar-permissions-chooser.c |    8 ++++----
 thunar/thunar-preferences-dialog.c  |   28 ++++++++++++++--------------
 thunar/thunar-properties-dialog.c   |    2 +-
 thunar/thunar-renamer-dialog.c      |    4 ++--
 thunar/thunar-size-label.c          |    2 +-
 7 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/thunar/thunar-chooser-dialog.c b/thunar/thunar-chooser-dialog.c
index fda109d..b44e54d 100644
--- a/thunar/thunar-chooser-dialog.c
+++ b/thunar/thunar-chooser-dialog.c
@@ -255,8 +255,8 @@ thunar_chooser_dialog_init (ThunarChooserDialog *dialog)
 
   /* create the "Custom command" expand */
   dialog->custom_expander = gtk_expander_new_with_mnemonic (_("Use a _custom command:"));
-  thunar_gtk_widget_set_tooltip (dialog->custom_expander, _("Use a custom command for an application that is not "
-                                                            "available from the above application list."));
+  gtk_widget_set_tooltip_text (dialog->custom_expander, _("Use a custom command for an application that is not "
+                                                          "available from the above application list."));
   exo_binding_new_with_negation (G_OBJECT (dialog->custom_expander), "expanded", G_OBJECT (dialog->tree_view), "sensitive");
   g_signal_connect (G_OBJECT (dialog->custom_expander), "notify::expanded", G_CALLBACK (thunar_chooser_dialog_notify_expanded), dialog);
   gtk_box_pack_start (GTK_BOX (box), dialog->custom_expander, FALSE, FALSE, 0);
diff --git a/thunar/thunar-gtk-extensions.c b/thunar/thunar-gtk-extensions.c
index 952f93a..65d0439 100644
--- a/thunar/thunar-gtk-extensions.c
+++ b/thunar/thunar-gtk-extensions.c
@@ -259,32 +259,26 @@ thunar_gtk_ui_manager_get_action_by_name (GtkUIManager *ui_manager,
  * @...    : 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.
+ * from the @format and the additional arguments in @...<!--->.
  **/
 void
 thunar_gtk_widget_set_tooltip (GtkWidget   *widget,
                                const gchar *format,
                                ...)
 {
-  static GtkTooltips *tooltips = NULL;
-  va_list             var_args;
-  gchar              *tooltip;
+  va_list  var_args;
+  gchar   *tooltip;
 
   _thunar_return_if_fail (GTK_IS_WIDGET (widget));
   _thunar_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);
+  gtk_widget_set_tooltip_text (widget, tooltip);
 
   /* release the tooltip */
   g_free (tooltip);
diff --git a/thunar/thunar-permissions-chooser.c b/thunar/thunar-permissions-chooser.c
index 7e1faff..7e26dd0 100644
--- a/thunar/thunar-permissions-chooser.c
+++ b/thunar/thunar-permissions-chooser.c
@@ -387,7 +387,7 @@ thunar_permissions_chooser_init (ThunarPermissionsChooser *chooser)
   gtk_widget_show (hbox);
 
   chooser->fixperm_button = gtk_button_new_with_mnemonic (_("Correct folder permissions..."));
-  thunar_gtk_widget_set_tooltip (chooser->fixperm_button, _("Click here to automatically fix the folder permissions."));
+  gtk_widget_set_tooltip_text (chooser->fixperm_button, _("Click here to automatically fix the folder permissions."));
   g_signal_connect_swapped (G_OBJECT (chooser->fixperm_button), "clicked", G_CALLBACK (thunar_permissions_chooser_fixperm_clicked), chooser);
   exo_binding_new (G_OBJECT (chooser->fixperm_button), "visible", G_OBJECT (hbox), "visible");
   gtk_box_pack_end (GTK_BOX (hbox), chooser->fixperm_button, FALSE, FALSE, 0);
@@ -403,7 +403,7 @@ thunar_permissions_chooser_init (ThunarPermissionsChooser *chooser)
   gtk_box_pack_start (GTK_BOX (hbox), chooser->job_progress, TRUE, TRUE, 0);
 
   button = gtk_button_new ();
-  thunar_gtk_widget_set_tooltip (button, _("Stop applying permissions recursively."));
+  gtk_widget_set_tooltip_text (button, _("Stop applying permissions recursively."));
   g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (thunar_permissions_chooser_job_cancel), chooser);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
@@ -554,8 +554,8 @@ thunar_permissions_chooser_ask_recursive (ThunarPermissionsChooser *chooser)
       gtk_widget_show (label);
 
       button = gtk_check_button_new_with_mnemonic (_("Do _not ask me again"));
-      thunar_gtk_widget_set_tooltip (button, _("If you select this option your choice will be remembered and you won't be asked "
-                                               "again. You can use the preferences dialog to alter your choice afterwards."));
+      gtk_widget_set_tooltip_text (button, _("If you select this option your choice will be remembered and you won't be asked "
+                                             "again. You can use the preferences dialog to alter your choice afterwards."));
       gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
       gtk_widget_show (button);
 
diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c
index 125bf58..536e5c1 100644
--- a/thunar/thunar-preferences-dialog.c
+++ b/thunar/thunar-preferences-dialog.c
@@ -245,14 +245,14 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
 
   button = gtk_check_button_new_with_mnemonic (_("Sort _folders before files"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-folders-first", G_OBJECT (button), "active");
-  thunar_gtk_widget_set_tooltip (button, _("Select this option to list folders before files when you sort a folder."));
+  gtk_widget_set_tooltip_text (button, _("Select this option to list folders before files when you sort a folder."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
   button = gtk_check_button_new_with_mnemonic (_("_Show thumbnails"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-show-thumbnails", G_OBJECT (button), "active");
-  thunar_gtk_widget_set_tooltip (button, _("Select this option to display previewable files within a "
-                                           "folder as automatically generated thumbnail icons."));
+  gtk_widget_set_tooltip_text (button, _("Select this option to display previewable files within a "
+                                         "folder as automatically generated thumbnail icons."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -274,8 +274,8 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
 
   button = gtk_check_button_new_with_mnemonic (_("_Text beside icons"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-text-beside-icons", G_OBJECT (button), "active");
-  thunar_gtk_widget_set_tooltip (button, _("Select this option to place the icon captions for items "
-                                           "beside the icon rather than below the icon."));
+  gtk_widget_set_tooltip_text (button, _("Select this option to place the icon captions for items "
+                                         "beside the icon rather than below the icon."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -359,8 +359,8 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
 
   button = gtk_check_button_new_with_mnemonic (_("Show Icon _Emblems"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "shortcuts-icon-emblems", G_OBJECT (button), "active");
-  thunar_gtk_widget_set_tooltip (button, _("Select this option to display icon emblems in the shortcuts pane for all folders "
-                                           "for which emblems have been defined in the folders properties dialog."));
+  gtk_widget_set_tooltip_text (button, _("Select this option to display icon emblems in the shortcuts pane for all folders "
+                                         "for which emblems have been defined in the folders properties dialog."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -401,8 +401,8 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
 
   button = gtk_check_button_new_with_mnemonic (_("Show Icon E_mblems"));
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "tree-icon-emblems", G_OBJECT (button), "active");
-  thunar_gtk_widget_set_tooltip (button, _("Select this option to display icon emblems in the tree pane for all folders "
-                                           "for which emblems have been defined in the folders properties dialog."));
+  gtk_widget_set_tooltip_text (button, _("Select this option to display icon emblems in the tree pane for all folders "
+                                         "for which emblems have been defined in the folders properties dialog."));
   gtk_table_attach (GTK_TABLE (table), button, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (button);
 
@@ -464,11 +464,11 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog)
 
   range = gtk_hscale_new_with_range (0.0, 2000.0, 100.0);
   gtk_scale_set_draw_value (GTK_SCALE (range), FALSE);
-  thunar_gtk_widget_set_tooltip (range, _("When single-click activation is enabled, pausing the mouse pointer over an item "
-                                          "will automatically select that item after the chosen delay. You can disable this "
-                                          "behavior by moving the slider to the left-most position. This behavior may be "
-                                          "useful when single clicks activate items, and you want only to select the item "
-                                          "without activating it."));
+  gtk_widget_set_tooltip_text (range, _("When single-click activation is enabled, pausing the mouse pointer over an item "
+                                        "will automatically select that item after the chosen delay. You can disable this "
+                                        "behavior by moving the slider to the left-most position. This behavior may be "
+                                        "useful when single clicks activate items, and you want only to select the item "
+                                        "without activating it."));
   gtk_box_pack_start (GTK_BOX (ibox), range, FALSE, FALSE, 0);
   thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), range);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), range);
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index 7dca191..fc13742 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -873,7 +873,7 @@ thunar_properties_dialog_update (ThunarPropertiesDialog *dialog)
     str = g_strdup_printf (_("link to %s"), thunar_file_get_symlink_target (dialog->file));
   else
     str = g_content_type_get_description (content_type);
-  thunar_gtk_widget_set_tooltip (dialog->kind_ebox, "%s", str);
+  gtk_widget_set_tooltip_text (dialog->kind_ebox, str);
   gtk_label_set_text (GTK_LABEL (dialog->kind_label), str);
   g_free (str);
 
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index f75bcfd..87fff85 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -347,7 +347,7 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
   button = gtk_dialog_add_button (GTK_DIALOG (renamer_dialog), _("_Rename Files"), GTK_RESPONSE_ACCEPT);
   exo_binding_new (G_OBJECT (renamer_dialog->model), "can-rename", G_OBJECT (button), "sensitive");
   gtk_dialog_set_default_response (GTK_DIALOG (renamer_dialog), GTK_RESPONSE_ACCEPT);
-  thunar_gtk_widget_set_tooltip (button, _("Click here to actually rename the files listed above to their new names."));
+  gtk_widget_set_tooltip_text (button, _("Click here to actually rename the files listed above to their new names."));
 
   /* setup the action group for this dialog */
   renamer_dialog->action_group = gtk_action_group_new ("ThunarRenamerDialog");
@@ -486,7 +486,7 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
 
       /* add a "Help" button */
       button = gtk_button_new ();
-      thunar_gtk_widget_set_tooltip (button, _("Click here to view the documentation for the selected rename operation."));
+      gtk_widget_set_tooltip_text (button, _("Click here to view the documentation for the selected rename operation."));
       g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (thunar_renamer_dialog_help), renamer_dialog);
       gtk_box_pack_start (GTK_BOX (rbox), button, FALSE, FALSE, 0);
       gtk_widget_show (button);
diff --git a/thunar/thunar-size-label.c b/thunar/thunar-size-label.c
index d5cdba5..d0096bf 100644
--- a/thunar/thunar-size-label.c
+++ b/thunar/thunar-size-label.c
@@ -143,7 +143,7 @@ thunar_size_label_init (ThunarSizeLabel *size_label)
   ebox = gtk_event_box_new ();
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK (thunar_size_label_button_press_event), size_label);
-  thunar_gtk_widget_set_tooltip (ebox, _("Click here to stop calculating the total size of the folder."));
+  gtk_widget_set_tooltip_text (ebox, _("Click here to stop calculating the total size of the folder."));
   gtk_box_pack_start (GTK_BOX (size_label), ebox, FALSE, FALSE, 0);
   gtk_widget_show (ebox);
 



More information about the Xfce4-commits mailing list