Revision: 5116 http://geany.svn.sourceforge.net/geany/?rev=5116&view=rev Author: eht16 Date: 2010-08-05 21:13:47 +0000 (Thu, 05 Aug 2010)
Log Message: ----------- Make ui_label_new_bold() a function. Escape the name of the current document for markup when using document name for menu items (closes #3038844).
Modified Paths: -------------- trunk/ChangeLog trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-08-02 17:34:24 UTC (rev 5115) +++ trunk/ChangeLog 2010-08-05 21:13:47 UTC (rev 5116) @@ -1,3 +1,11 @@ +2010-08-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/ui_utils.c, src/ui_utils.h: + Make ui_label_new_bold() a function. + Escape the name of the current document for markup when using + document name for menu items (closes #3038844). + + 2010-08-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/utils.c, src/utils.h:
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2010-08-02 17:34:24 UTC (rev 5115) +++ trunk/src/ui_utils.c 2010-08-05 21:13:47 UTC (rev 5116) @@ -2302,6 +2302,18 @@ }
+GtkWidget *ui_label_new_bold(const gchar *text) +{ + GtkWidget *label; + gchar *label_text; + + label_text = g_markup_escape_text(text, -1); + label = ui_label_set_markup(GTK_LABEL(gtk_label_new(NULL)), "<b>%s</b>", label_text); + g_free(label_text); + return label; +} + + /** Adds a list of document items to @a menu. * @param menu Menu. * @param active Which document to highlight, or @c NULL. @@ -2315,7 +2327,7 @@ const GdkColor *color; GeanyDocument *doc; guint i, len; - gchar *base_name; + gchar *base_name, *label;
len = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); for (i = 0; i < len; i++) @@ -2336,7 +2348,11 @@ gtk_widget_modify_fg(menu_item_label, GTK_STATE_ACTIVE, color);
if (doc == active) - ui_label_set_markup(GTK_LABEL(menu_item_label), "<b>%s</b>", base_name); + { + label = g_markup_escape_text(base_name, -1); + ui_label_set_markup(GTK_LABEL(menu_item_label), "<b>%s</b>", label); + g_free(label); + }
g_free(base_name); }
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2010-08-02 17:34:24 UTC (rev 5115) +++ trunk/src/ui_utils.h 2010-08-05 21:13:47 UTC (rev 5116) @@ -209,8 +209,7 @@ void ui_editable_insert_text_callback(GtkEditable *editable, gchar *new_text, gint new_text_len, gint *position, gpointer data);
-#define ui_label_new_bold(text)\ - ui_label_set_markup(GTK_LABEL(gtk_label_new(NULL)), "<b>%s</b>", text); +GtkWidget *ui_label_new_bold(const gchar *text);
GtkWidget *ui_label_set_markup(GtkLabel *label, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.