[gtk+/font-selection-new] GtkFontSelection: Add support for symbolic icons in the search bar
- From: Alberto Ruiz <aruiz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/font-selection-new] GtkFontSelection: Add support for symbolic icons in the search bar
- Date: Mon, 9 May 2011 16:22:27 +0000 (UTC)
commit 3ed26b05bb1be506c589ff229c763326fe3ec884
Author: Alberto Ruiz <aruiz gnome org>
Date: Mon May 9 17:00:54 2011 +0200
GtkFontSelection: Add support for symbolic icons in the search bar
gtk/gtkfontselection.c | 26 ++++++++++++++++++--------
gtk/gtkfontselectiondialog.c | 6 +++---
2 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkfontselection.c b/gtk/gtkfontselection.c
index 1a51566..2636028 100644
--- a/gtk/gtkfontselection.c
+++ b/gtk/gtkfontselection.c
@@ -316,9 +316,11 @@ deleted_text_cb (GtkEntryBuffer *buffer,
if (gtk_entry_buffer_get_length (buffer) == 0)
{
- gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
+ GIcon *icon = g_themed_icon_new_with_default_fallbacks ("edit-find-symbolic");
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_FIND);
+ icon);
+ g_object_unref (icon);
}
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
@@ -335,11 +337,16 @@ inserted_text_cb (GtkEntryBuffer *buffer,
GtkWidget *entry = priv->search_entry;
if (g_strcmp0 (gtk_entry_get_icon_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY),
+ "edit-clear-symbolic") ||
+ g_strcmp0 (gtk_entry_get_icon_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY),
GTK_STOCK_CLEAR))
- gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
- GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_CLEAR);
-
+ {
+ GIcon *icon = g_themed_icon_new_with_default_fallbacks ("edit-clear-symbolic");
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ icon);
+ g_object_unref (icon);
+ }
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
}
@@ -567,6 +574,7 @@ zoom_preview_cb (GtkWidget *scrolled_window, GdkEventScroll *event, gpointer dat
static void
gtk_font_selection_init (GtkFontSelection *fontsel)
{
+ GIcon *icon;
GtkFontSelectionPrivate *priv;
PangoFontDescription *font_desc;
GtkWidget *scrolled_win;
@@ -682,9 +690,11 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
pango_language_get_sample_string (NULL));
/* Set search icon and place holder text */
- gtk_entry_set_icon_from_stock (GTK_ENTRY (priv->search_entry),
+ icon = g_themed_icon_new_with_default_fallbacks ("edit-find-symbolic");
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (priv->search_entry),
GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_FIND);
+ icon);
+ g_object_unref (icon);
gtk_entry_set_placeholder_text (GTK_ENTRY (priv->search_entry), _("Search font name"));
/** Callback connections **/
diff --git a/gtk/gtkfontselectiondialog.c b/gtk/gtkfontselectiondialog.c
index 70c07fa..dea16c3 100644
--- a/gtk/gtkfontselectiondialog.c
+++ b/gtk/gtkfontselectiondialog.c
@@ -104,14 +104,14 @@ struct _GtkFontSelectionDialogPrivate
};
static void gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface);
-static GObject * gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
+static GObject* gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname);
G_DEFINE_TYPE_WITH_CODE (GtkFontSelectionDialog, gtk_font_selection_dialog,
GTK_TYPE_DIALOG,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_font_selection_dialog_buildable_interface_init))
+ gtk_font_selection_dialog_buildable_interface_init))
static GtkBuildableIface *parent_buildable_iface;
@@ -225,7 +225,7 @@ gtk_font_selection_dialog_buildable_interface_init (GtkBuildableIface *iface)
iface->get_internal_child = gtk_font_selection_dialog_buildable_get_internal_child;
}
-static GObject *
+static GObject*
gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]