Commit 57c44b18 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Port to use new tooltips API. (#451397, Jan Arne Petersen)

2007-07-24  Matthias Clasen  <mclasen@redhat.com>

        * gtkcolorsel.c:
        * gtkfilechooserdefault.c:
        * gtkpagesetupunixdialog.c:
        * gtkprintunixdialog.c: Port to use new tooltips API.
        (#451397, Jan Arne Petersen)


svn path=/trunk/; revision=18539
parent 441f0484
2007-07-24 Matthias Clasen <mclasen@redhat.com>
* gtkcolorsel.c:
* gtkfilechooserdefault.c:
* gtkpagesetupunixdialog.c:
* gtkprintunixdialog.c: Port to use new tooltips API.
(#451397, Jan Arne Petersen)
2007-07-24 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkkeys-win32.c (update_keymap): Cosmetic changes.
......
......@@ -50,7 +50,6 @@
#include "gtkentry.h"
#include "gtkbutton.h"
#include "gtkhseparator.h"
#include "gtktooltips.h"
#include "gtkinvisible.h"
#include "gtkmenuitem.h"
#include "gtkmain.h"
......@@ -134,9 +133,6 @@ struct _ColorSelectionPrivate
GtkWidget *cur_sample;
GtkWidget *colorsel;
/* Tooltips group */
GtkTooltips *tooltips;
/* Window for grabbing on */
GtkWidget *dropper_grab_widget;
guint32 grab_time;
......@@ -535,12 +531,6 @@ color_sample_new (GtkColorSelection *colorsel)
priv->old_sample = gtk_drawing_area_new ();
priv->cur_sample = gtk_drawing_area_new ();
/* We need enter/leave to do tooltips */
gtk_widget_add_events (priv->old_sample,
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_widget_add_events (priv->cur_sample,
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->old_sample,
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->cur_sample,
......@@ -556,14 +546,12 @@ color_sample_new (GtkColorSelection *colorsel)
color_sample_setup_dnd (colorsel, priv->old_sample);
color_sample_setup_dnd (colorsel, priv->cur_sample);
gtk_tooltips_set_tip (priv->tooltips,
priv->old_sample,
_("The previously-selected color, for comparison to the color you're selecting now. You can drag this color to a palette entry, or select this color as current by dragging it to the other color swatch alongside."), NULL);
gtk_widget_set_tooltip_text (priv->old_sample,
_("The previously-selected color, for comparison to the color you're selecting now. You can drag this color to a palette entry, or select this color as current by dragging it to the other color swatch alongside."));
gtk_tooltips_set_tip (priv->tooltips,
priv->cur_sample,
_("The color you've chosen. You can drag this color to a palette entry to save it for use in the future."), NULL);
gtk_widget_set_tooltip_text (priv->cur_sample,
_("The color you've chosen. You can drag this color to a palette entry to save it for use in the future."));
gtk_widget_show_all (priv->sample_area);
}
......@@ -1154,10 +1142,8 @@ palette_new (GtkColorSelection *colorsel)
g_signal_connect (retval, "drag_data_received",
G_CALLBACK (palette_drop_handle), colorsel);
gtk_tooltips_set_tip (priv->tooltips,
retval,
_("Click this palette entry to make it the current color. To change this entry, drag a color swatch here or right-click it and select \"Save color here.\""),
NULL);
gtk_widget_set_tooltip_text (retval,
_("Click this palette entry to make it the current color. To change this entry, drag a color swatch here or right-click it and select \"Save color here.\""));
return retval;
}
......@@ -1658,7 +1644,7 @@ make_label_spinbutton (GtkColorSelection *colorsel,
g_object_set_data (G_OBJECT (adjust), I_("COLORSEL"), colorsel);
*spinbutton = gtk_spin_button_new (adjust, 10.0, 0);
gtk_tooltips_set_tip (priv->tooltips, *spinbutton, tooltip, NULL);
gtk_widget_set_tooltip_text (*spinbutton, tooltip);
g_signal_connect (adjust, "value_changed",
G_CALLBACK (adjustment_changed),
......@@ -1920,9 +1906,6 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
priv->default_set = FALSE;
priv->default_alpha_set = FALSE;
priv->tooltips = gtk_tooltips_new ();
g_object_ref_sink (priv->tooltips);
top_hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
......@@ -1933,8 +1916,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_hsv_set_metrics (GTK_HSV (priv->triangle_colorsel), 174, 15);
gtk_box_pack_start (GTK_BOX (top_hbox), vbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0);
gtk_tooltips_set_tip (priv->tooltips, priv->triangle_colorsel,
_("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."), NULL);
gtk_widget_set_tooltip_text (priv->triangle_colorsel,
_("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
......@@ -1957,9 +1940,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_widget_show (GTK_WIDGET (picker_image));
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_tooltips_set_tip (priv->tooltips,
button,
_("Click the eyedropper, then click a color anywhere on your screen to select that color."), NULL);
gtk_widget_set_tooltip_text (button,
_("Click the eyedropper, then click a color anywhere on your screen to select that color."));
top_right_vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
......@@ -1989,9 +1971,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0));
g_object_set_data (G_OBJECT (adjust), I_("COLORSEL"), colorsel);
priv->opacity_slider = gtk_hscale_new (adjust);
gtk_tooltips_set_tip (priv->tooltips,
priv->opacity_slider,
_("Transparency of the color."), NULL);
gtk_widget_set_tooltip_text (priv->opacity_slider,
_("Transparency of the color."));
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->opacity_label),
priv->opacity_slider);
gtk_scale_set_draw_value (GTK_SCALE (priv->opacity_slider), FALSE);
......@@ -2000,9 +1981,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
GINT_TO_POINTER (COLORSEL_OPACITY));
gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_slider, 1, 7, 4, 5);
priv->opacity_entry = gtk_entry_new ();
gtk_tooltips_set_tip (priv->tooltips,
priv->opacity_entry,
_("Transparency of the color."), NULL);
gtk_widget_set_tooltip_text (priv->opacity_entry,
_("Transparency of the color."));
gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
g_signal_connect (priv->opacity_entry, "activate",
......@@ -2022,9 +2002,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
g_signal_connect (priv->hex_entry, "focus_out_event",
G_CALLBACK (hex_focus_out), colorsel);
gtk_tooltips_set_tip (priv->tooltips,
priv->hex_entry,
_("You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry."), NULL);
gtk_widget_set_tooltip_text (priv->hex_entry,
_("You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry."));
gtk_entry_set_width_chars (GTK_ENTRY (priv->hex_entry), 7);
gtk_table_attach_defaults (GTK_TABLE (table), priv->hex_entry, 1, 5, 5, 6);
......@@ -2103,12 +2082,6 @@ gtk_color_selection_destroy (GtkObject *object)
priv->dropper_grab_widget = NULL;
}
if (priv->tooltips)
{
g_object_unref (priv->tooltips);
priv->tooltips = NULL;
}
GTK_OBJECT_CLASS (gtk_color_selection_parent_class)->destroy (object);
}
......
......@@ -2577,6 +2577,9 @@ filter_create (GtkFileChooserDefault *impl)
g_signal_connect (impl->filter_combo, "changed",
G_CALLBACK (filter_combo_changed), impl);
gtk_widget_set_tooltip_text (impl->filter_combo,
_("Select which types of files are shown"));
return impl->filter_combo;
}
......@@ -3059,7 +3062,7 @@ bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl)
tip = data.tip;
}
gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button, tip, NULL);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_add_button, tip);
g_free (tip);
}
}
......@@ -3087,8 +3090,7 @@ bookmarks_check_remove_sensitivity (GtkFileChooserDefault *impl)
gchar *tip;
tip = g_strdup_printf (_("Remove the bookmark '%s'"), name);
gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
tip, NULL);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button, tip);
g_free (tip);
}
......@@ -4010,8 +4012,8 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
TRUE,
G_CALLBACK (add_bookmark_button_clicked_cb));
gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_add_button, TRUE, TRUE, 0);
gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button,
_("Add the selected folder to the Bookmarks"), NULL);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_add_button,
_("Add the selected folder to the Bookmarks"));
/* Remove bookmark button */
......@@ -4022,8 +4024,8 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
TRUE,
G_CALLBACK (remove_bookmark_button_clicked_cb));
gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
_("Remove the selected bookmark"), NULL);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button,
_("Remove the selected bookmark"));
return vbox;
}
......@@ -4686,29 +4688,6 @@ create_path_bar (GtkFileChooserDefault *impl)
return path_bar;
}
static void
set_filter_tooltip (GtkWidget *widget,
gpointer data)
{
GtkTooltips *tooltips = (GtkTooltips *)data;
if (GTK_IS_BUTTON (widget))
gtk_tooltips_set_tip (tooltips, widget,
_("Select which types of files are shown"),
NULL);
}
static void
realize_filter_combo (GtkWidget *combo,
gpointer data)
{
GtkFileChooserDefault *impl = (GtkFileChooserDefault *)data;
gtk_container_forall (GTK_CONTAINER (combo),
set_filter_tooltip,
impl->tooltips);
}
/* Creates the widgets for the files/folders pane */
static GtkWidget *
file_pane_create (GtkFileChooserDefault *impl,
......@@ -4744,9 +4723,6 @@ file_pane_create (GtkFileChooserDefault *impl,
widget = filter_create (impl);
g_signal_connect (widget, "realize",
G_CALLBACK (realize_filter_combo), impl);
gtk_widget_show (widget);
gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0);
......@@ -5204,7 +5180,7 @@ location_button_create (GtkFileChooserDefault *impl)
str = _("Type a file name");
gtk_tooltips_set_tip (impl->tooltips, impl->location_button, str, NULL);
gtk_widget_set_tooltip_text (impl->location_button, str);
atk_object_set_name (gtk_widget_get_accessible (impl->location_button), str);
}
......
......@@ -45,7 +45,6 @@
#include "gtkradiobutton.h"
#include "gtklabel.h"
#include "gtktable.h"
#include "gtktooltips.h"
#include "gtkcelllayout.h"
#include "gtkcellrenderertext.h"
#include "gtkalignment.h"
......@@ -75,7 +74,6 @@ struct GtkPageSetupUnixDialogPrivate
GtkWidget *paper_size_combo;
GtkWidget *paper_size_label;
GtkWidget *paper_size_eventbox;
GtkTooltips *tooltips;
GtkWidget *portrait_radio;
GtkWidget *reverse_portrait_radio;
......@@ -918,8 +916,7 @@ paper_size_changed (GtkComboBox *combo_box,
g_free (left);
g_free (right);
gtk_tooltips_set_tip (GTK_TOOLTIPS (priv->tooltips),
priv->paper_size_eventbox, str, NULL);
gtk_widget_set_tooltip_text (priv->paper_size_eventbox, str);
g_free (str);
g_object_unref (page_setup);
......@@ -927,8 +924,7 @@ paper_size_changed (GtkComboBox *combo_box,
else
{
gtk_label_set_text (label, "");
gtk_tooltips_set_tip (GTK_TOOLTIPS (priv->tooltips),
priv->paper_size_eventbox, NULL, NULL);
gtk_widget_set_tooltip_text (priv->paper_size_eventbox, NULL);
if (priv->last_setup)
g_object_unref (priv->last_setup);
priv->last_setup = NULL;
......@@ -1097,8 +1093,6 @@ populate_dialog (GtkPageSetupUnixDialog *ps_dialog)
GTK_EXPAND|GTK_FILL, 0, 0, 0);
priv->tooltips = gtk_tooltips_new ();
g_signal_connect (priv->paper_size_combo, "changed", G_CALLBACK (paper_size_changed), ps_dialog);
g_signal_connect (priv->printer_combo, "changed", G_CALLBACK (printer_changed_callback), ps_dialog);
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->printer_combo), 0);
......
......@@ -46,7 +46,6 @@
#include "gtkframe.h"
#include "gtkalignment.h"
#include "gtklabel.h"
#include "gtktooltips.h"
#include "gtkeventbox.h"
#include "gtkprintbackend.h"
......@@ -124,7 +123,6 @@ struct GtkPrintUnixDialogPrivate
GtkPageSetup *page_setup;
GtkTooltips *tooltips;
GtkWidget *all_pages_radio;
GtkWidget *current_page_radio;
GtkWidget *page_range_radio;
......@@ -272,9 +270,6 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
priv->print_backends = NULL;
priv->current_page = -1;
priv->tooltips = gtk_tooltips_new ();
g_object_ref_sink (priv->tooltips);
priv->page_setup = gtk_page_setup_new ();
g_signal_connect (dialog,
......@@ -316,12 +311,6 @@ gtk_print_unix_dialog_finalize (GObject *object)
unschedule_idle_mark_conflicts (dialog);
if (priv->tooltips)
{
g_object_unref (priv->tooltips);
priv->tooltips = NULL;
}
if (priv->request_details_tag)
{
g_source_remove (priv->request_details_tag);
......@@ -1542,7 +1531,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
0, 0);
radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Ra_nge"));
gtk_tooltips_set_tip (priv->tooltips, radio, _("Specify one or more page ranges,\n e.g. 1-3,7,11"), NULL);
gtk_widget_set_tooltip_text (radio, _("Specify one or more page ranges,\n e.g. 1-3,7,11"));
priv->page_range_radio = radio;
gtk_widget_show (radio);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment