SF.net SVN: geany:[3250] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Nov 18 20:14:42 UTC 2008


Revision: 3250
          http://geany.svn.sourceforge.net/geany/?rev=3250&view=rev
Author:   eht16
Date:     2008-11-18 20:14:42 +0000 (Tue, 18 Nov 2008)

Log Message:
-----------
dd ui_widget_set_tooltip_text() as a convenience function to easily set tooltips for widgets. It uses gtk_widget_set_tooltip_text() on GTK >= 2.12 otherwise the old tooltips API.Use ui_widget_set_tooltip_text().
Use ui_widget_set_tooltip_text() in the plugins.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/export.c
    trunk/plugins/filebrowser.c
    trunk/plugins/splitwindow.c
    trunk/plugins/vcdiff.c
    trunk/src/dialogs.c
    trunk/src/document.c
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/printing.c
    trunk/src/project.c
    trunk/src/search.c
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h
    trunk/src/vte.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/ChangeLog	2008-11-18 20:14:42 UTC (rev 3250)
@@ -8,6 +8,15 @@
    Add note about the encoding box in the Find in Files dialog.
  * src/document.c, src/document.h, src/notebook.c:
    Show the full filename of a document as tooltip on the tab labels.
+ * src/dialogs.c, src/document.c, src/plugindata.h, src/plugins.c,
+   src/printing.c, src/project.c, src/search.c, src/ui_utils.c,
+   src/ui_utils.h, src/vte.c:
+   Add ui_widget_set_tooltip_text() as a convenience function to easily
+   set tooltips for widgets. It uses gtk_widget_set_tooltip_text() on
+   GTK >= 2.12 otherwise the old tooltips API.
+ * plugins/export.c, plugins/filebrowser.c, plugins/splitwindow.c,
+   plugins/vcdiff.c:
+   Use ui_widget_set_tooltip_text().
 
 
 2008-11-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/plugins/export.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -158,7 +158,6 @@
 									   gboolean show_zoom_level_checkbox)
 {
 	GtkWidget *dialog;
-	GtkTooltips *tooltips;
 	GeanyDocument *doc;
 	ExportInfo *exi;
 
@@ -166,7 +165,6 @@
 		return;
 
 	doc = p_document->get_current();
-	tooltips = GTK_TOOLTIPS(p_support->lookup_widget(geany->main_widgets->window, "tooltips"));
 
 	exi = g_new(ExportInfo, 1);
 	exi->doc = doc;
@@ -191,8 +189,8 @@
 
 		vbox = gtk_vbox_new(FALSE, 0);
 		check_zoom_level = gtk_check_button_new_with_mnemonic(_("_Use current zoom level"));
-		gtk_tooltips_set_tip(tooltips, check_zoom_level,
-			_("Renders the font size of the document together with the current zoom level."), NULL);
+		p_ui->widget_set_tooltip_text(check_zoom_level,
+			_("Renders the font size of the document together with the current zoom level."));
 		gtk_box_pack_start(GTK_BOX(vbox), check_zoom_level, FALSE, FALSE, 0);
 		gtk_widget_show_all(vbox);
 		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox);

Modified: trunk/plugins/filebrowser.c
===================================================================
--- trunk/plugins/filebrowser.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/plugins/filebrowser.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -719,34 +719,28 @@
 static GtkWidget *make_toolbar(void)
 {
 	GtkWidget *wid, *toolbar;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(p_support->lookup_widget(
-		geany->main_widgets->window, "tooltips"));
 
 	toolbar = gtk_toolbar_new();
 	gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU);
 	gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
 
 	wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_GO_UP);
-	gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips,
-		_("Up"), NULL);
+	p_ui->widget_set_tooltip_text(wid, _("Up"));
 	g_signal_connect(wid, "clicked", G_CALLBACK(on_go_up), NULL);
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
 	wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH);
-	gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips,
-		_("Refresh"), NULL);
+	p_ui->widget_set_tooltip_text(wid, _("Refresh"));
 	g_signal_connect(wid, "clicked", G_CALLBACK(refresh), NULL);
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
 	wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_HOME);
-	gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips,
-		_("Home"), NULL);
+	p_ui->widget_set_tooltip_text(wid, _("Home"));
 	g_signal_connect(wid, "clicked", G_CALLBACK(on_go_home), NULL);
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
 	wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_JUMP_TO);
-	gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips,
-		_("Set path from document"), NULL);
+	p_ui->widget_set_tooltip_text(wid, _("Set path from document"));
 	g_signal_connect(wid, "clicked", G_CALLBACK(on_current_path), NULL);
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
@@ -754,7 +748,7 @@
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
 	wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
-	gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips, _("Clear the filter"), NULL);
+	p_ui->widget_set_tooltip_text(wid, _("Clear the filter"));
 	g_signal_connect(wid, "clicked", G_CALLBACK(on_clear_filter), NULL);
 	gtk_container_add(GTK_CONTAINER(toolbar), wid);
 
@@ -986,7 +980,6 @@
 GtkWidget *plugin_configure(GtkDialog *dialog)
 {
 	GtkWidget *label, *entry, *checkbox_of, *checkbox_hf, *vbox;
-	GtkTooltips *tooltips = gtk_tooltips_new();
 
 	vbox = gtk_vbox_new(FALSE, 6);
 
@@ -998,11 +991,10 @@
 	gtk_widget_show(entry);
 	if (open_cmd != NULL)
 		gtk_entry_set_text(GTK_ENTRY(entry), open_cmd);
-	gtk_tooltips_set_tip(tooltips, entry,
+	p_ui->widget_set_tooltip_text(entry,
 		_("The command to execute when using \"Open with\". You can use %f and %d wildcards.\n"
 		  "%f will be replaced with the filename including full path\n"
-		  "%d will be replaced with the path name of the selected file without the filename"),
-		  NULL);
+		  "%d will be replaced with the path name of the selected file without the filename"));
 	gtk_container_add(GTK_CONTAINER(vbox), entry);
 	pref_widgets.open_cmd_entry = entry;
 
@@ -1015,10 +1007,9 @@
 	checkbox_of = gtk_check_button_new_with_label(_("Hide object files"));
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_of), FALSE);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_of), hide_object_files);
-	gtk_tooltips_set_tip(tooltips, checkbox_of,
+	p_ui->widget_set_tooltip_text(checkbox_of,
 		_("Don't show generated object files in the file browser, this includes "
-		  "*.o, *.obj. *.so, *.dll, *.a, *.lib"),
-		  NULL);
+		  "*.o, *.obj. *.so, *.dll, *.a, *.lib"));
 	gtk_box_pack_start(GTK_BOX(vbox), checkbox_of, FALSE, FALSE, 5);
 	pref_widgets.hide_objects_checkbox = checkbox_of;
 

Modified: trunk/plugins/splitwindow.c
===================================================================
--- trunk/plugins/splitwindow.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/plugins/splitwindow.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -215,12 +215,10 @@
 static GtkWidget *create_tool_button(const gchar *label, const gchar *stock_id)
 {
 	GtkToolItem *item;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(p_support->lookup_widget(
-		geany->main_widgets->window, "tooltips"));
 
 	item = gtk_tool_button_new(NULL, label);
 	gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), stock_id);
-	gtk_tool_item_set_tooltip(item, tooltips, label, NULL);
+	p_ui->widget_set_tooltip_text(GTK_WIDGET(item), label);
 
 	return GTK_WIDGET(item);
 }

Modified: trunk/plugins/vcdiff.c
===================================================================
--- trunk/plugins/vcdiff.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/plugins/vcdiff.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -281,7 +281,7 @@
 	{
 		GeanyIndentType indent_type =
 			p_document->get_current()->editor->indent_type;
-			
+
 		doc = p_document->find_by_filename(filename);
 		if (doc == NULL)
 		{
@@ -502,10 +502,7 @@
 {
 	GtkWidget	*menu_vcdiff = NULL;
 	GtkWidget	*menu_vcdiff_menu = NULL;
- 	GtkTooltips	*tooltips = NULL;
 
-	tooltips = gtk_tooltips_new();
-
 	menu_vcdiff = gtk_image_menu_item_new_with_mnemonic(_("_Version Diff"));
 	gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_vcdiff);
 
@@ -517,24 +514,23 @@
 	/* Single file */
 	menu_vcdiff_file = gtk_menu_item_new_with_mnemonic(_("From Current _File"));
 	gtk_container_add(GTK_CONTAINER (menu_vcdiff_menu), menu_vcdiff_file);
-	gtk_tooltips_set_tip (tooltips, menu_vcdiff_file,
-		_("Make a diff from the current active file"), NULL);
+	p_ui->widget_set_tooltip_text(menu_vcdiff_file, _("Make a diff from the current active file"));
 
 	g_signal_connect(menu_vcdiff_file, "activate", G_CALLBACK(vcfile_activated), NULL);
 
 	/* Directory */
 	menu_vcdiff_dir = gtk_menu_item_new_with_mnemonic(_("From Current _Directory"));
 	gtk_container_add(GTK_CONTAINER (menu_vcdiff_menu), menu_vcdiff_dir);
-	gtk_tooltips_set_tip (tooltips, menu_vcdiff_dir,
-		_("Make a diff from the directory of the current active file"), NULL);
+	p_ui->widget_set_tooltip_text(menu_vcdiff_dir,
+		_("Make a diff from the directory of the current active file"));
 
 	g_signal_connect(menu_vcdiff_dir, "activate", G_CALLBACK(vcdirectory_activated), NULL);
 
 	/* Project */
 	menu_vcdiff_project = gtk_menu_item_new_with_mnemonic(_("From Current _Project"));
 	gtk_container_add(GTK_CONTAINER (menu_vcdiff_menu), menu_vcdiff_project);
-	gtk_tooltips_set_tip (tooltips, menu_vcdiff_project,
-		_("Make a diff from the current project's base path"), NULL);
+	p_ui->widget_set_tooltip_text(menu_vcdiff_project,
+		_("Make a diff from the current project's base path"));
 
 	g_signal_connect(menu_vcdiff_project, "activate", G_CALLBACK(vcproject_activated), NULL);
 

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/dialogs.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -171,7 +171,6 @@
 {
 	GtkWidget *filetype_combo, *encoding_combo;
 	GtkWidget *viewbtn;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 	guint i;
 	gchar *encoding_string;
 
@@ -181,8 +180,8 @@
 
 	viewbtn = gtk_dialog_add_button(GTK_DIALOG(ui_widgets.open_filesel), _("_View"),
 				GEANY_RESPONSE_VIEW);
-	gtk_tooltips_set_tip(tooltips, viewbtn,
-		_("Opens the file in read-only mode. If you choose more than one file to open, all files will be opened read-only."), NULL);
+	ui_widget_set_tooltip_text(viewbtn,
+		_("Opens the file in read-only mode. If you choose more than one file to open, all files will be opened read-only."));
 
 	gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.open_filesel),
 		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -288,7 +287,6 @@
 	GtkWidget *vbox, *table, *file_entry, *check_hidden;
 	GtkWidget *filetype_ebox, *filetype_label, *filetype_combo;
 	GtkWidget *encoding_ebox, *encoding_label, *encoding_combo;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 	vbox = gtk_vbox_new(FALSE, 6);
 
@@ -315,8 +313,8 @@
 	encoding_ebox = gtk_event_box_new();
 	encoding_combo = gtk_combo_box_new_text();
 	gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(encoding_combo), 3);
-	gtk_tooltips_set_tip(tooltips, encoding_ebox,
-		_("Explicitly defines an encoding for the file, if it would not be detected. This is useful when you know that the encoding of a file cannot be detected correctly by Geany.\nNote if you choose multiple files, they will all be opened with the chosen encoding."), NULL);
+	ui_widget_set_tooltip_text(encoding_ebox,
+		_("Explicitly defines an encoding for the file, if it would not be detected. This is useful when you know that the encoding of a file cannot be detected correctly by Geany.\nNote if you choose multiple files, they will all be opened with the chosen encoding."));
 	gtk_container_add(GTK_CONTAINER(encoding_ebox), encoding_combo);
 	gtk_table_attach(GTK_TABLE(table), encoding_ebox, 3, 4, 0, 1,
 					(GtkAttachOptions) (GTK_FILL),
@@ -345,8 +343,8 @@
 	filetype_ebox = gtk_event_box_new();
 	filetype_combo = gtk_combo_box_new_text();
 	gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(filetype_combo), 2);
-	gtk_tooltips_set_tip(tooltips, filetype_ebox,
-		_("Explicitly defines a filetype for the file, if it would not be detected by filename extension.\nNote if you choose multiple files, they will all be opened with the chosen filetype."), NULL);
+	ui_widget_set_tooltip_text(filetype_ebox,
+		_("Explicitly defines a filetype for the file, if it would not be detected by filename extension.\nNote if you choose multiple files, they will all be opened with the chosen filetype."));
 	gtk_container_add(GTK_CONTAINER(filetype_ebox), filetype_combo);
 	gtk_table_attach(GTK_TABLE(table), filetype_ebox, 3, 4, 1, 2,
 					(GtkAttachOptions) (GTK_FILL),
@@ -474,7 +472,6 @@
 static void create_save_file_dialog(void)
 {
 	GtkWidget *vbox, *check_open_new_tab, *rename_btn;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 	ui_widgets.save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(main_widgets.window),
 				GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
@@ -486,8 +483,7 @@
 
 	rename_btn = gtk_dialog_add_button(GTK_DIALOG(ui_widgets.save_filesel), _("R_ename"),
 					GEANY_RESPONSE_RENAME);
-	gtk_tooltips_set_tip(tooltips, rename_btn,
-		_("Save the file and rename it."), NULL);
+	ui_widget_set_tooltip_text(rename_btn, _("Save the file and rename it."));
 
 	gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.save_filesel),
 		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -496,9 +492,9 @@
 
 	vbox = gtk_vbox_new(FALSE, 0);
 	check_open_new_tab = gtk_check_button_new_with_mnemonic(_("_Open file in a new tab"));
-	gtk_tooltips_set_tip(tooltips, check_open_new_tab,
+	ui_widget_set_tooltip_text(check_open_new_tab,
 		_("Keep the current unsaved document open"
-		" and open the newly saved file in a new tab."), NULL);
+		" and open the newly saved file in a new tab."));
 	gtk_box_pack_start(GTK_BOX(vbox), check_open_new_tab, FALSE, FALSE, 0);
 	gtk_widget_show_all(vbox);
 	gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.save_filesel), vbox);

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/document.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -279,20 +279,16 @@
 {
 	gchar *base_name;
 	GtkWidget *parent;
-	static GtkTooltips *tooltips = NULL;
 
 	g_return_if_fail(doc != NULL);
 
 	base_name = g_path_get_basename(DOC_FILENAME(doc));
 	parent = gtk_widget_get_parent(doc->priv->tab_label);
 
-	if (tooltips == NULL)
-		tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
-
 	gtk_label_set_text(GTK_LABEL(doc->priv->tab_label), base_name);
 	gtk_label_set_text(GTK_LABEL(doc->priv->tabmenu_label), base_name);
 
-	gtk_tooltips_set_tip(tooltips, parent, DOC_FILENAME(doc), NULL);
+	ui_widget_set_tooltip_text(parent, DOC_FILENAME(doc));
 
 	g_free(base_name);
 }

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/plugindata.h	2008-11-18 20:14:42 UTC (rev 3250)
@@ -45,7 +45,7 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 108,
+	GEANY_API_VERSION = 109,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
@@ -358,6 +358,7 @@
 	GtkWidget*	(*path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
 	GtkWidget*	(*button_new_with_image) (const gchar *stock_id, const gchar *text);
 	void		(*add_document_sensitive) (GtkWidget *widget);
+	void		(*widget_set_tooltip_text) (GtkWidget *widget, const gchar *text);
 }
 UIUtilsFuncs;
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/plugins.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -206,7 +206,8 @@
 	&ui_table_add_row,
 	&ui_path_box_new,
 	&ui_button_new_with_image,
-	&ui_add_document_sensitive
+	&ui_add_document_sensitive,
+	&ui_widget_set_tooltip_text
 };
 
 static DialogFuncs dialog_funcs = {

Modified: trunk/src/printing.c
===================================================================
--- trunk/src/printing.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/printing.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -332,7 +332,6 @@
 	GtkWidget *vbox30;
 	GtkWidget *hbox10;
 	GtkWidget *label203;
-	GtkTooltips *tooltips = gtk_tooltips_new();
 	PrintWidgets *w = user_data;
 
 	gtk_print_operation_set_custom_tab_label(operation, _("Document Setup"));
@@ -342,17 +341,17 @@
 
 	w->check_print_linenumbers = gtk_check_button_new_with_mnemonic(_("Print line numbers"));
 	gtk_box_pack_start(GTK_BOX(page), w->check_print_linenumbers, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(tooltips, w->check_print_linenumbers, _("Add line numbers to the printed page."), NULL);
+	ui_widget_set_tooltip_text(w->check_print_linenumbers, _("Add line numbers to the printed page."));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_linenumbers), printing_prefs.print_line_numbers);
 
 	w->check_print_pagenumbers = gtk_check_button_new_with_mnemonic(_("Print page numbers"));
 	gtk_box_pack_start(GTK_BOX(page), w->check_print_pagenumbers, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(tooltips, w->check_print_pagenumbers, _("Add page numbers at the bottom of each page. It takes 2 lines of the page."), NULL);
+	ui_widget_set_tooltip_text(w->check_print_pagenumbers, _("Add page numbers at the bottom of each page. It takes 2 lines of the page."));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_pagenumbers), printing_prefs.print_page_numbers);
 
 	w->check_print_pageheader = gtk_check_button_new_with_mnemonic(_("Print page header"));
 	gtk_box_pack_start(GTK_BOX(page), w->check_print_pageheader, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(tooltips, w->check_print_pageheader, _("Adds a little header to every page containing the page number, the filename and the current date(see below). It takes 3 lines of the page."), NULL);
+	ui_widget_set_tooltip_text(w->check_print_pageheader, _("Adds a little header to every page containing the page number, the filename and the current date(see below). It takes 3 lines of the page."));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_pageheader), printing_prefs.print_page_header);
 	g_signal_connect(w->check_print_pageheader, "toggled", G_CALLBACK(on_page_header_toggled), w);
 
@@ -370,7 +369,7 @@
 
 	w->check_print_basename = gtk_check_button_new_with_mnemonic(_("Use the basename of the printed file"));
 	gtk_box_pack_start(GTK_BOX(vbox30), w->check_print_basename, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(tooltips, w->check_print_basename, _("Print only the basename(without the path) of the printed file."), NULL);
+	ui_widget_set_tooltip_text(w->check_print_basename, _("Print only the basename(without the path) of the printed file."));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_basename), printing_prefs.page_header_basename);
 
 	hbox10 = gtk_hbox_new(FALSE, 5);
@@ -381,7 +380,7 @@
 
 	w->entry_print_dateformat = gtk_entry_new();
 	gtk_box_pack_start(GTK_BOX(hbox10), w->entry_print_dateformat, TRUE, TRUE, 0);
-	gtk_tooltips_set_tip(tooltips, w->entry_print_dateformat, _("Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function."), NULL);
+	ui_widget_set_tooltip_text(w->entry_print_dateformat, _("Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function."));
 	gtk_entry_set_text(GTK_ENTRY(w->entry_print_dateformat), printing_prefs.page_header_datefmt);
 
 	on_page_header_toggled(GTK_TOGGLE_BUTTON(w->check_print_pageheader), w);

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/project.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -97,7 +97,6 @@
 	GtkWidget *button;
 	GtkWidget *bbox;
 	GtkWidget *label;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 	PropertyDialogElements *e;
 	gint response;
 
@@ -155,10 +154,10 @@
 	gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
 
 	e->base_path = gtk_entry_new();
-	gtk_tooltips_set_tip(tooltips, e->base_path,
+	ui_widget_set_tooltip_text(e->base_path,
 		_("Base directory of all files that make up the project. "
 		"This can be a new path, or an existing directory tree. "
-		"You can use paths relative to the project filename."), NULL);
+		"You can use paths relative to the project filename."));
 	bbox = ui_path_box_new(_("Choose Project Base Path"),
 		GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
 
@@ -352,7 +351,6 @@
 	GtkWidget *bbox;
 	GtkWidget *label;
 	GtkWidget *swin;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 	e->dialog = gtk_dialog_new_with_buttons(_("Project Properties"), GTK_WINDOW(main_widgets.window),
 										 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -414,10 +412,10 @@
 	gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
 
 	e->base_path = gtk_entry_new();
-	gtk_tooltips_set_tip(tooltips, e->base_path,
+	ui_widget_set_tooltip_text(e->base_path,
 		_("Base directory of all files that make up the project. "
 		"This can be a new path, or an existing directory tree. "
-		"You can use paths relative to the project filename."), NULL);
+		"You can use paths relative to the project filename."));
 	bbox = ui_path_box_new(_("Choose Project Base Path"),
 		GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
 	gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 3, 4,
@@ -436,10 +434,10 @@
 	gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
 
 	e->run_cmd = gtk_entry_new();
-	gtk_tooltips_set_tip(tooltips, e->run_cmd,
+	ui_widget_set_tooltip_text(e->run_cmd,
 		_("Command-line to run in the project base directory. "
 		"Options can be appended to the command. "
-		"Leave blank to use the default run command."), NULL);
+		"Leave blank to use the default run command."));
 	button = gtk_button_new();
 	g_signal_connect(button, "clicked", G_CALLBACK(on_file_open_button_clicked), e->run_cmd);
 	image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/search.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -143,14 +143,13 @@
 {
 	GtkWidget *checkbox1, *checkbox2, *check_regexp, *check_back, *checkbox5,
 			  *checkbox7, *hbox, *fbox, *mbox;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 	check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
 	g_object_set_data_full(G_OBJECT(dialog), "check_regexp",
 					g_object_ref(check_regexp), (GDestroyNotify) g_object_unref);
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
-	gtk_tooltips_set_tip(tooltips, check_regexp, _("Use POSIX-like regular expressions. "
-		"For detailed information about using regular expressions, please read the documentation."), NULL);
+	ui_widget_set_tooltip_text(check_regexp, _("Use POSIX-like regular expressions. "
+		"For detailed information about using regular expressions, please read the documentation."));
 	g_signal_connect(check_regexp, "toggled",
 		G_CALLBACK(on_find_replace_checkbutton_toggled), GTK_WIDGET(dialog));
 
@@ -174,9 +173,9 @@
 	g_object_set_data_full(G_OBJECT(dialog), "check_escape",
 					g_object_ref(checkbox7), (GDestroyNotify)g_object_unref);
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox7), FALSE);
-	gtk_tooltips_set_tip(tooltips, checkbox7,
+	ui_widget_set_tooltip_text(checkbox7,
 		_("Replace \\\\, \\t, \\n, \\r and \\uXXXX (Unicode chararacters) with the "
-		  "corresponding control characters."), NULL);
+		  "corresponding control characters."));
 
 	/* Search features */
 	fbox = gtk_vbox_new(FALSE, 0);
@@ -306,7 +305,6 @@
 	{
 		GtkWidget *label, *entry, *sbox, *vbox;
 		GtkWidget *exp, *bbox, *button, *check_close;
-		GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 		load_monospace_style();
 
@@ -358,8 +356,8 @@
 		bbox = gtk_hbutton_box_new();
 
 		button = gtk_button_new_with_mnemonic(_("_Mark"));
-		gtk_tooltips_set_tip(tooltips, button,
-				_("Mark all matches in the current document."), NULL);
+		ui_widget_set_tooltip_text(button,
+				_("Mark all matches in the current document."));
 		gtk_container_add(GTK_CONTAINER(bbox), button);
 		g_signal_connect(button, "clicked", G_CALLBACK(send_find_dialog_response),
 			GINT_TO_POINTER(GEANY_RESPONSE_MARK));
@@ -379,8 +377,8 @@
 		g_object_set_data_full(G_OBJECT(widgets.find_dialog), "check_close",
 						g_object_ref(check_close), (GDestroyNotify) g_object_unref);
 		gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
-		gtk_tooltips_set_tip(tooltips, check_close,
-				_("Disable this option to keep the dialog open."), NULL);
+		ui_widget_set_tooltip_text(check_close,
+				_("Disable this option to keep the dialog open."));
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_close), TRUE);
 		gtk_container_add(GTK_CONTAINER(bbox), check_close);
 		gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
@@ -429,7 +427,6 @@
 		GtkWidget *label_find, *label_replace, *entry_find, *entry_replace,
 			*check_close, *button, *rbox, *fbox, *vbox, *exp, *bbox;
 		GtkSizeGroup *label_size;
-		GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 
 		load_monospace_style();
 
@@ -504,8 +501,8 @@
 		bbox = gtk_hbutton_box_new();
 
 		button = gtk_button_new_with_mnemonic(_("In Se_lection"));
-		gtk_tooltips_set_tip(tooltips, button,
-			_("Replace all matches found in the currently selected text"), NULL);
+		ui_widget_set_tooltip_text(button,
+			_("Replace all matches found in the currently selected text"));
 		gtk_container_add(GTK_CONTAINER(bbox), button);
 		g_signal_connect(button, "clicked", G_CALLBACK(send_replace_dialog_response),
 			GINT_TO_POINTER(GEANY_RESPONSE_REPLACE_IN_SEL));
@@ -525,8 +522,8 @@
 		g_object_set_data_full(G_OBJECT(widgets.replace_dialog), "check_close",
 						g_object_ref(check_close), (GDestroyNotify) g_object_unref);
 		gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
-		gtk_tooltips_set_tip(tooltips, check_close,
-				_("Disable this option to keep the dialog open."), NULL);
+		ui_widget_set_tooltip_text(check_close,
+				_("Disable this option to keep the dialog open."));
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_close), TRUE);
 		gtk_container_add(GTK_CONTAINER(bbox), check_close);
 		gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
@@ -569,7 +566,6 @@
 		*check_recursive, *check_extra, *entry_extra;
 	GtkWidget *dbox, *sbox, *cbox, *rbox, *rbtn, *hbox, *vbox, *ebox;
 	GtkSizeGroup *size_group;
-	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
 	gchar *encoding_string;
 	guint i;
 
@@ -652,15 +648,13 @@
 				_("_Grep regular expressions"));
 	g_object_set_data_full(G_OBJECT(widgets.find_in_files_dialog), "radio_grep",
 					g_object_ref(rbtn), (GDestroyNotify)g_object_unref);
-	gtk_tooltips_set_tip(tooltips, rbtn,
-				_("See grep's manual page for more information."), NULL);
+	ui_widget_set_tooltip_text(rbtn, _("See grep's manual page for more information."));
 	gtk_button_set_focus_on_click(GTK_BUTTON(rbtn), FALSE);
 	gtk_container_add(GTK_CONTAINER(rbox), rbtn);
 
 	rbtn = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(rbtn),
 				_("_Extended regular expressions"));
-	gtk_tooltips_set_tip(tooltips, rbtn,
-				_("See grep's manual page for more information."), NULL);
+	ui_widget_set_tooltip_text(rbtn, _("See grep's manual page for more information."));
 	gtk_button_set_focus_on_click(GTK_BUTTON(rbtn), FALSE);
 	gtk_container_add(GTK_CONTAINER(rbox), rbtn);
 
@@ -684,8 +678,8 @@
 	g_object_set_data_full(G_OBJECT(widgets.find_in_files_dialog), "check_invert",
 					g_object_ref(checkbox2), (GDestroyNotify)g_object_unref);
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
-	gtk_tooltips_set_tip(tooltips, checkbox2,
-			_("Invert the sense of matching, to select non-matching lines."), NULL);
+	ui_widget_set_tooltip_text(checkbox2,
+			_("Invert the sense of matching, to select non-matching lines."));
 
 	cbox = gtk_vbox_new(FALSE, 0);
 	gtk_container_add(GTK_CONTAINER(cbox), checkbox1);
@@ -711,8 +705,7 @@
 	if (search_prefs.fif_extra_options)
 		gtk_entry_set_text(GTK_ENTRY(entry_extra), search_prefs.fif_extra_options);
 	gtk_widget_set_sensitive(entry_extra, FALSE);
-	gtk_tooltips_set_tip(tooltips, entry_extra,
-			_("Other options to pass to Grep"), NULL);
+	ui_widget_set_tooltip_text(entry_extra, _("Other options to pass to Grep"));
 	find_in_files.extra_entry = entry_extra;
 
 	/* enable entry_extra when check_extra is checked */
@@ -859,9 +852,9 @@
 
 	/* clear previous search indicators */
 	editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
-	
+
 	len = strlen(search_text);
-	
+
 	ttf.chrg.cpMin = 0;
 	ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
 	ttf.lpstrText = (gchar *)search_text;
@@ -1379,7 +1372,7 @@
 		while (g_io_channel_read_line(source, &msg, NULL, NULL, NULL) && msg)
 		{
 			utf8_msg = NULL;
-			
+
 			g_strstrip(msg);
 			if (! g_utf8_validate(msg, -1, NULL))
 			{
@@ -1409,7 +1402,7 @@
 		while (g_io_channel_read_line(source, &msg, NULL, NULL, NULL) && msg)
 		{
 			utf8_msg = NULL;
-			
+
 			g_strstrip(msg);
 			if (! g_utf8_validate(msg, -1, NULL))
 			{

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/ui_utils.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -1658,3 +1658,23 @@
 	g_signal_connect(item, "destroy", G_CALLBACK(on_auto_separator_item_destroy), autosep);
 }
 
+
+/**
+ *  Sets @a text as the contents of the tooltip for @a widget.
+ *
+ *  @param widget The widget the tooltip should be set for.
+ *  @param text The text for the tooltip.
+ */
+void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text)
+{
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(widget, text);
+#else
+	static GtkTooltips *tooltips = NULL;
+
+	if (tooltips == NULL)
+		tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
+
+	gtk_tooltips_set_tip(tooltips, widget, text, NULL);
+#endif
+}

Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/ui_utils.h	2008-11-18 20:14:42 UTC (rev 3250)
@@ -249,4 +249,6 @@
 
 void ui_add_document_sensitive(GtkWidget *widget);
 
+void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text);
+
 #endif

Modified: trunk/src/vte.c
===================================================================
--- trunk/src/vte.c	2008-11-18 20:13:50 UTC (rev 3249)
+++ trunk/src/vte.c	2008-11-18 20:14:42 UTC (rev 3250)
@@ -680,10 +680,8 @@
 		GtkWidget *check_scroll_key, *check_scroll_out, *check_follow_path;
 		GtkWidget *check_enable_bash_keys, *check_ignore_menu_key;
 		GtkWidget *check_run_in_vte, *check_skip_script, *entry_shell, *button_shell, *image_shell;
-		GtkTooltips *tooltips;
 		GtkObject *spin_scrollback_adj;
 
-		tooltips = GTK_TOOLTIPS(lookup_widget(ui_widgets.prefs_dialog, "tooltips"));
 		notebook = lookup_widget(ui_widgets.prefs_dialog, "notebook2");
 
 		frame = ui_frame_new_with_alignment(_("Terminal plugin"), &alignment);
@@ -715,7 +713,7 @@
 		gtk_table_attach(GTK_TABLE(table), font_term, 1, 2, 0, 1,
 					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 					(GtkAttachOptions) (0), 0, 0);
-		gtk_tooltips_set_tip(tooltips, font_term, _("Sets the font for the terminal widget."), NULL);
+		ui_widget_set_tooltip_text(font_term, _("Sets the font for the terminal widget."));
 
 		label = gtk_label_new(_("Foreground color:"));
 		gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
@@ -733,14 +731,14 @@
 		gtk_table_attach(GTK_TABLE(table), color_fore, 1, 2, 1, 2,
 					(GtkAttachOptions) (GTK_FILL),
 					(GtkAttachOptions) (0), 0, 0);
-		gtk_tooltips_set_tip(tooltips, color_fore, _("Sets the foreground color of the text in the terminal widget."), NULL);
+		ui_widget_set_tooltip_text(color_fore, _("Sets the foreground color of the text in the terminal widget."));
 		gtk_color_button_set_title(GTK_COLOR_BUTTON(color_fore), _("Color Chooser"));
 
 		color_back = gtk_color_button_new();
 		gtk_table_attach(GTK_TABLE(table), color_back, 1, 2, 2, 3,
 					(GtkAttachOptions) (GTK_FILL),
 					(GtkAttachOptions) (0), 0, 0);
-		gtk_tooltips_set_tip(tooltips, color_back, _("Sets the background color of the text in the terminal widget."), NULL);
+		ui_widget_set_tooltip_text(color_back, _("Sets the background color of the text in the terminal widget."));
 		gtk_color_button_set_title(GTK_COLOR_BUTTON(color_back), _("Color Chooser"));
 
 		label = gtk_label_new(_("Scrollback lines:"));
@@ -754,7 +752,7 @@
 		gtk_table_attach(GTK_TABLE(table), spin_scrollback, 1, 2, 3, 4,
 					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 					(GtkAttachOptions) (0), 0, 0);
-		gtk_tooltips_set_tip(tooltips, spin_scrollback, _("Specifies the history in lines, which you can scroll back in the terminal widget."), NULL);
+		ui_widget_set_tooltip_text(spin_scrollback, _("Specifies the history in lines, which you can scroll back in the terminal widget."));
 		gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spin_scrollback), TRUE);
 		gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spin_scrollback), TRUE);
 
@@ -768,7 +766,7 @@
 		gtk_table_attach(GTK_TABLE(table), entry_emulation, 1, 2, 4, 5,
 					(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 					(GtkAttachOptions) (0), 0, 0);
-		gtk_tooltips_set_tip(tooltips, entry_emulation, _("Controls how the terminal emulator should behave. Do not change this value unless you know exactly what you are doing."), NULL);
+		ui_widget_set_tooltip_text(entry_emulation, _("Controls how the terminal emulator should behave. Do not change this value unless you know exactly what you are doing."));
 
 		label = gtk_label_new(_("Shell:"));
 		gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6,
@@ -777,7 +775,7 @@
 		gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
 		entry_shell = gtk_entry_new();
-		gtk_tooltips_set_tip(tooltips, entry_shell, _("Sets the path to the shell which should be started inside the terminal emulation."), NULL);
+		ui_widget_set_tooltip_text(entry_shell, _("Sets the path to the shell which should be started inside the terminal emulation."));
 
 		button_shell = gtk_button_new();
 		gtk_widget_show(button_shell);
@@ -795,34 +793,34 @@
 
 		box = gtk_vbox_new(FALSE, 3);
 		check_scroll_key = gtk_check_button_new_with_mnemonic(_("Scroll on keystroke"));
-		gtk_tooltips_set_tip(tooltips, check_scroll_key, _("Whether to scroll to the bottom if a key was pressed."), NULL);
+		ui_widget_set_tooltip_text(check_scroll_key, _("Whether to scroll to the bottom if a key was pressed."));
 		gtk_container_add(GTK_CONTAINER(box), check_scroll_key);
 
 		check_scroll_out = gtk_check_button_new_with_mnemonic(_("Scroll on output"));
-		gtk_tooltips_set_tip(tooltips, check_scroll_out, _("Whether to scroll to the bottom when output is generated."), NULL);
+		ui_widget_set_tooltip_text(check_scroll_out, _("Whether to scroll to the bottom when output is generated."));
 		gtk_container_add(GTK_CONTAINER(box), check_scroll_out);
 
 		check_enable_bash_keys = gtk_check_button_new_with_mnemonic(_("Override Geany keybindings"));
-		gtk_tooltips_set_tip(tooltips, check_enable_bash_keys,
-			_("Allows the VTE to receive keyboard shortcuts (apart from focus commands)."), NULL);
+		ui_widget_set_tooltip_text(check_enable_bash_keys,
+			_("Allows the VTE to receive keyboard shortcuts (apart from focus commands)."));
 		gtk_container_add(GTK_CONTAINER(box), check_enable_bash_keys);
 
 		check_ignore_menu_key = gtk_check_button_new_with_mnemonic(_("Disable menu shortcut key (F10 by default)"));
-		gtk_tooltips_set_tip(tooltips, check_ignore_menu_key, _("This option disables the keybinding to popup the menu bar (default is F10). Disabling it can be useful if you use, for example, Midnight Commander within the VTE."), NULL);
+		ui_widget_set_tooltip_text(check_ignore_menu_key, _("This option disables the keybinding to popup the menu bar (default is F10). Disabling it can be useful if you use, for example, Midnight Commander within the VTE."));
 		gtk_container_add(GTK_CONTAINER(box), check_ignore_menu_key);
 
 		check_follow_path = gtk_check_button_new_with_mnemonic(_("Follow the path of the current file"));
-		gtk_tooltips_set_tip(tooltips, check_follow_path, _("Whether to execute \"cd $path\" when you switch between opened files."), NULL);
+		ui_widget_set_tooltip_text(check_follow_path, _("Whether to execute \"cd $path\" when you switch between opened files."));
 		gtk_container_add(GTK_CONTAINER(box), check_follow_path);
 
 		/* create check_skip_script checkbox before the check_skip_script checkbox to be able to
 		 * use the object for the toggled handler of check_skip_script checkbox */
 		check_skip_script = gtk_check_button_new_with_mnemonic(_("Don't use run script"));
-		gtk_tooltips_set_tip(tooltips, check_skip_script, _("Don't use the simple run script which is usually used to display the exit status of the executed program."), NULL);
+		ui_widget_set_tooltip_text(check_skip_script, _("Don't use the simple run script which is usually used to display the exit status of the executed program."));
 		gtk_widget_set_sensitive(check_skip_script, vc->run_in_vte);
 
 		check_run_in_vte = gtk_check_button_new_with_mnemonic(_("Execute programs in VTE"));
-		gtk_tooltips_set_tip(tooltips, check_run_in_vte, _("Run programs in VTE instead of opening a terminal emulation window. Please note, programs executed in VTE cannot be stopped."), NULL);
+		ui_widget_set_tooltip_text(check_run_in_vte, _("Run programs in VTE instead of opening a terminal emulation window. Please note, programs executed in VTE cannot be stopped."));
 		gtk_container_add(GTK_CONTAINER(box), check_run_in_vte);
 		g_signal_connect(check_run_in_vte, "toggled",
 			G_CALLBACK(check_run_in_vte_toggled), check_skip_script);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list