Do not display any icon if there's no news feed available
Work around a bug that made unsetting the secondary icon in the location entry impossible and do not set an icon if there is no news feed instead of an 'information' icon.
This commit is contained in:
parent
d328d2afab
commit
ba7e8846ee
4 changed files with 27 additions and 17 deletions
|
@ -28,12 +28,20 @@ gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
|
||||||
GdkPixbuf* pixbuf)
|
GdkPixbuf* pixbuf)
|
||||||
{
|
{
|
||||||
/* Without this ugly hack pixbuf icons don't work */
|
/* Without this ugly hack pixbuf icons don't work */
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
gtk_widget_hide (GTK_WIDGET (entry));
|
gtk_widget_hide (GTK_WIDGET (entry));
|
||||||
gtk_entry_set_icon_from_pixbuf (entry, position, pixbuf);
|
gtk_entry_set_icon_from_pixbuf (entry, position, pixbuf);
|
||||||
gtk_widget_show (GTK_WIDGET (entry));
|
gtk_widget_show (GTK_WIDGET (entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_icon_entry_set_icon_from_stock (GtkEntry* entry,
|
||||||
|
GtkEntryIconPosition position,
|
||||||
|
const gchar* stock_id)
|
||||||
|
{
|
||||||
|
if (stock_id)
|
||||||
|
gtk_entry_set_icon_from_stock(entry, position, stock_id);
|
||||||
|
else
|
||||||
|
gtk_icon_entry_set_icon_from_pixbuf(entry, position, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -1266,6 +1274,10 @@ gtk_icon_entry_set_icon_from_stock (GtkIconEntry *entry,
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
/* FIXME: Due to a bug in GtkIconEntry we need to set a non-NULL icon */
|
||||||
|
if (! stock_id)
|
||||||
|
stock_id = GTK_STOCK_INFO;
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
|
pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
|
||||||
stock_id,
|
stock_id,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU,
|
||||||
|
|
|
@ -38,11 +38,15 @@ G_BEGIN_DECLS
|
||||||
#define GTK_ICON_ENTRY GTK_ENTRY
|
#define GTK_ICON_ENTRY GTK_ENTRY
|
||||||
#define GTK_TYPE_ICON_ENTRY GTK_TYPE_ENTRY
|
#define GTK_TYPE_ICON_ENTRY GTK_TYPE_ENTRY
|
||||||
#define gtk_icon_entry_new gtk_entry_new
|
#define gtk_icon_entry_new gtk_entry_new
|
||||||
#define gtk_icon_entry_set_icon_from_stock gtk_entry_set_icon_from_stock
|
|
||||||
void
|
void
|
||||||
gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
|
gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
|
||||||
GtkEntryIconPosition position,
|
GtkEntryIconPosition position,
|
||||||
GdkPixbuf* pixbuf);
|
GdkPixbuf* pixbuf);
|
||||||
|
void
|
||||||
|
gtk_icon_entry_set_icon_from_stock (GtkEntry* entry,
|
||||||
|
GtkEntryIconPosition position,
|
||||||
|
const gchar* stock_id);
|
||||||
|
|
||||||
#define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
|
#define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ _midori_browser_update_interface (MidoriBrowser* browser)
|
||||||
MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
|
MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
|
||||||
else
|
else
|
||||||
midori_location_action_set_secondary_icon (
|
midori_location_action_set_secondary_icon (
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_INFO);
|
MIDORI_LOCATION_ACTION (action), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -420,7 +420,7 @@ midori_view_notify_load_status_cb (GtkWidget* view,
|
||||||
midori_location_action_set_uri (
|
midori_location_action_set_uri (
|
||||||
MIDORI_LOCATION_ACTION (action), uri);
|
MIDORI_LOCATION_ACTION (action), uri);
|
||||||
midori_location_action_set_secondary_icon (
|
midori_location_action_set_secondary_icon (
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_INFO);
|
MIDORI_LOCATION_ACTION (action), NULL);
|
||||||
g_object_notify (G_OBJECT (browser), "uri");
|
g_object_notify (G_OBJECT (browser), "uri");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4003,8 +4003,6 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
"label", _("_Location..."),
|
"label", _("_Location..."),
|
||||||
"stock-id", GTK_STOCK_JUMP_TO,
|
"stock-id", GTK_STOCK_JUMP_TO,
|
||||||
"tooltip", _("Open a particular location"),
|
"tooltip", _("Open a particular location"),
|
||||||
/* FIXME: Due to a bug in GtkIconEntry we need to set an initial icon */
|
|
||||||
"secondary-icon", STOCK_NEWS_FEED,
|
|
||||||
NULL);
|
NULL);
|
||||||
g_object_connect (action,
|
g_object_connect (action,
|
||||||
"signal::activate",
|
"signal::activate",
|
||||||
|
|
|
@ -1311,12 +1311,8 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
|
||||||
entry = gtk_bin_get_child (GTK_BIN (alignment));
|
entry = gtk_bin_get_child (GTK_BIN (alignment));
|
||||||
child = gtk_bin_get_child (GTK_BIN (entry));
|
child = gtk_bin_get_child (GTK_BIN (entry));
|
||||||
|
|
||||||
if (stock_id)
|
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
||||||
GTK_ICON_ENTRY_SECONDARY, stock_id);
|
GTK_ICON_ENTRY_SECONDARY, stock_id);
|
||||||
else
|
|
||||||
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (child),
|
|
||||||
GTK_ICON_ENTRY_SECONDARY, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue