Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape format arguments passed to ui_label_set_markup() #1174

Merged
merged 2 commits into from Aug 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/ui_utils.c
Expand Up @@ -1462,6 +1462,8 @@ void ui_update_view_editor_menu_items(void)
*
* @return @transfer{floating} The frame widget, setting the alignment container for
* packing child widgets.
*
* @deprecated 1.29: Use GTK API directly
**/
GEANY_API_SYMBOL
GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alignment)
Expand Down Expand Up @@ -2835,7 +2837,7 @@ void ui_label_set_markup(GtkLabel *label, const gchar *format, ...)
gchar *text;

va_start(a, format);
text = g_strdup_vprintf(format, a);
text = g_markup_vprintf_escaped(format, a);
va_end(a);

gtk_label_set_text(label, text);
Expand Down Expand Up @@ -2896,7 +2898,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active,
GtkWidget *menu_item, *menu_item_label, *image;
GeanyDocument *doc;
guint i, len;
gchar *base_name, *label;
gchar *base_name;
GPtrArray *sorted_documents;

len = (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
Expand Down Expand Up @@ -2930,11 +2932,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active,
gtk_widget_set_name(menu_item_label, document_get_status_widget_class(doc));

if (doc == active)
{
label = g_markup_escape_text(base_name, -1);
ui_label_set_markup(GTK_LABEL(menu_item_label), "<b>%s</b>", label);
g_free(label);
}
ui_label_set_markup(GTK_LABEL(menu_item_label), "<b>%s</b>", base_name);

g_free(base_name);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui_utils.h
Expand Up @@ -101,8 +101,6 @@ GeanyMainWidgets;

GtkWidget *ui_dialog_vbox_new(GtkDialog *dialog);

GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alignment);

void ui_set_statusbar(gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);

void ui_table_add_row(GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
Expand Down Expand Up @@ -143,6 +141,8 @@ void ui_tree_view_set_tooltip_text_column(GtkTreeView *tree_view, gint column);


#ifndef GEANY_DISABLE_DEPRECATED
GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alignment) GEANY_DEPRECATED;

void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text) GEANY_DEPRECATED_FOR(gtk_widget_set_tooltip_text);
#endif /* GEANY_DISABLE_DEPRECATED */

Expand Down