Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 20 Aug 2016 17:58:42 UTC Commit: c5d409340b8a488ecd4cb47c19709d5866761d3f https://github.com/geany/geany/commit/c5d409340b8a488ecd4cb47c19709d5866761d...
Log Message: ----------- Merge pull request #1174 from b4n/escape-markup
Escape format arguments passed to ui_label_set_markup(), and deprecate ui_frame_new_with_alignment() which exposed a broken API because of it.
Modified Paths: -------------- src/ui_utils.c src/ui_utils.h
Modified: src/ui_utils.c 12 lines changed, 5 insertions(+), 7 deletions(-) =================================================================== @@ -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) @@ -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); @@ -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)); @@ -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); }
Modified: src/ui_utils.h 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -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; @@ -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 */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).