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). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5116 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
392fb93fc4
commit
af8f5fc921
@ -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:
|
||||
|
@ -2302,6 +2302,18 @@ GtkWidget *ui_label_set_markup(GtkLabel *label, const gchar *format, ...)
|
||||
}
|
||||
|
||||
|
||||
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 @@ void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback
|
||||
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 @@ void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback
|
||||
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);
|
||||
}
|
||||
|
@ -209,8 +209,7 @@ void ui_entry_add_clear_icon(GtkEntry *entry);
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user