[gtk+] Add a tooltip to the save folder combo
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Add a tooltip to the save folder combo
- Date: Wed, 15 Jul 2009 23:19:02 +0000 (UTC)
commit 143b55c3cb064f4924ab6d508afe69e365b26807
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 15 19:17:36 2009 -0400
Add a tooltip to the save folder combo
Add a tooltip that shows the full path of the current folder, to avoid
ambiguity. We only show the tooltip when the expander is collapsed to
avoid cluttering the full file chooser.
gtk/gtkfilechooserdefault.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 388129a..8d95bf8 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -4813,6 +4813,38 @@ save_folder_combo_changed_cb (GtkComboBox *combo,
}
}
+static void
+save_folder_update_tooltip (GtkComboBox *combo,
+ GtkFileChooserDefault *impl)
+{
+ GtkTreeIter iter;
+ gchar *tooltip;
+
+ tooltip = NULL;
+
+ if (gtk_combo_box_get_active_iter (combo, &iter))
+ {
+ GtkTreeIter child_iter;
+ gpointer col_data;
+ ShortcutType shortcut_type;
+
+ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model),
+ &child_iter,
+ &iter);
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &child_iter,
+ SHORTCUTS_COL_DATA, &col_data,
+ SHORTCUTS_COL_TYPE, &shortcut_type,
+ -1);
+
+ if (shortcut_type == SHORTCUT_TYPE_FILE)
+ tooltip = g_file_get_parse_name (G_FILE (col_data));
+ }
+
+ gtk_widget_set_tooltip_text (GTK_WIDGET (combo), tooltip);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (combo),
+ gtk_widget_get_sensitive (GTK_WIDGET (combo)));
+}
+
/* Filter function used to filter out the Search item and its separator.
* Used for the "Save in folder" combo box, so that these items do not appear in it.
*/
@@ -4904,6 +4936,8 @@ save_folder_combo_create (GtkFileChooserDefault *impl)
g_signal_connect (combo, "changed",
G_CALLBACK (save_folder_combo_changed_cb), impl);
+ g_signal_connect (combo, "changed",
+ G_CALLBACK (save_folder_update_tooltip), impl);
return combo;
}
@@ -5512,12 +5546,14 @@ update_appearance (GtkFileChooserDefault *impl)
{
gtk_widget_set_sensitive (impl->save_folder_label, FALSE);
gtk_widget_set_sensitive (impl->save_folder_combo, FALSE);
+ gtk_widget_set_has_tooltip (impl->save_folder_combo, FALSE);
gtk_widget_show (impl->browse_widgets);
}
else
{
gtk_widget_set_sensitive (impl->save_folder_label, TRUE);
gtk_widget_set_sensitive (impl->save_folder_combo, TRUE);
+ gtk_widget_set_has_tooltip (impl->save_folder_combo, TRUE);
gtk_widget_hide (impl->browse_widgets);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]