if (GTK_IS_TOOL_ITEM (proxies->data))
{
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
- GdkScreen* screen = gtk_widget_get_screen (entry);
- GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
if (hint == MIDORI_SECURITY_UNKNOWN)
{
- #if !GTK_CHECK_VERSION (3, 0, 0)
+ #if GTK_CHECK_VERSION (2, 16, 0)
+ gchar* icon_names[] = { "channel-insecure-symbolic", "lock-insecure", "dialog-information", NULL };
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
+ g_themed_icon_new_from_names (icon_names, -1));
+ #else
+ gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO);
#endif
- #if !HAVE_HILDON
- if (gtk_icon_theme_has_icon (icon_theme, "channel-insecure-symbolic"))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, "channel-insecure-symbolic");
- else if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure"))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, "lock-insecure");
- else
- gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO);
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Not verified"));
- #endif
}
else if (hint == MIDORI_SECURITY_TRUSTED)
{
- #if !GTK_CHECK_VERSION (3, 0, 0)
+ #if GTK_CHECK_VERSION (2, 16, 0)
+ gchar* icon_names[] = { "channel-secure-symbolic", "lock-secure", "locked", NULL };
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
+ g_themed_icon_new_from_names (icon_names, -1));
+ #else
+ gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
#endif
- #if !HAVE_HILDON
- if (gtk_icon_theme_has_icon (icon_theme, "channel-secure-symbolic"))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, "channel-secure-symbolic");
- else if (gtk_icon_theme_has_icon (icon_theme, "lock-secure"))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, "lock-secure");
- else
- gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Verified and encrypted connection"));
- #endif
}
else if (hint == MIDORI_SECURITY_NONE)
{
- if (gtk_icon_theme_has_icon (icon_theme, "text-html-symbolic"))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, "text-html-symbolic");
- else
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, STOCK_URL);
+ #if GTK_CHECK_VERSION (2, 16, 0)
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
+ g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
+ #else
+ gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, STOCK_URL);
+ #endif
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Open, unencrypted connection"));
}
}
}
-static gboolean
-midori_view_mime_icon (MidoriView* view,
- GtkIconTheme* icon_theme,
- const gchar* format,
- const gchar* part1,
- const gchar* part2)
-{
- gchar* icon_name;
- GdkPixbuf* icon;
-
- icon_name = part2 ? g_strdup_printf (format, part1, part2)
- : g_strdup_printf (format, part1);
- if (!(icon = gtk_icon_theme_load_icon (icon_theme, icon_name, 16, 0, NULL)))
- {
- g_free (icon_name);
- return FALSE;
- }
-
- g_object_ref (icon);
- midori_view_apply_icon (view, icon, icon_name);
- g_free (icon_name);
- return TRUE;
-}
-
static void
midori_view_unset_icon (MidoriView* view)
{
GdkScreen* screen;
- GtkIconTheme* theme;
- gchar** parts = NULL;
- GdkPixbuf* icon;
+ GtkIconTheme* icon_theme;
+ GIcon* icon;
+ gchar** icon_names;
+ GdkPixbuf* pixbuf = NULL;
if (!((screen = gtk_widget_get_screen (view->web_view))
- && (theme = gtk_icon_theme_get_for_screen (screen))))
+ && (icon_theme = gtk_icon_theme_get_for_screen (screen))))
return;
- if (!(view->mime_type
- && (parts = g_strsplit (view->mime_type, "/", 2))
- && (*parts && parts[1])))
+ if (view->mime_type != NULL)
{
- icon = gtk_widget_render_icon (view->web_view,
- GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
- midori_view_apply_icon (view, icon, GTK_STOCK_FILE);
- goto free_parts;
+ gchar* content_type = g_content_type_from_mime_type (view->mime_type);
+ icon = g_content_type_get_icon (content_type);
+ g_free (content_type);
+ g_themed_icon_append_name (G_THEMED_ICON (icon), "text-html");
}
+ else
+ icon = g_themed_icon_new ("text-html");
- if (midori_view_mime_icon (view, theme, "%s-%s", *parts, parts[1]))
- goto free_parts;
- if (midori_view_mime_icon (view, theme, "gnome-mime-%s-%s", *parts, parts[1]))
- goto free_parts;
- if (midori_view_mime_icon (view, theme, "%s-x-generic", *parts, NULL))
- goto free_parts;
- if (midori_view_mime_icon (view, theme, "gnome-mime-%s-x-generic", *parts, NULL))
- goto free_parts;
-
- icon = gtk_widget_render_icon (view->web_view,
- GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
- midori_view_apply_icon (view, icon, GTK_STOCK_FILE);
+ if ((icon_names = (gchar**)g_themed_icon_get_names (G_THEMED_ICON (icon))))
+ while (*icon_names)
+ {
+ if ((pixbuf = gtk_icon_theme_load_icon (icon_theme, *icon_names, 16, 0, NULL)))
+ break;
+ icon_names++;
+ }
+ g_object_unref (icon);
-free_parts:
- g_strfreev (parts);
+ midori_view_apply_icon (view, pixbuf, GTK_STOCK_FILE);
}
#if !WEBKIT_CHECK_VERSION (1, 8, 0)
description = g_content_type_get_description (content_type);
#if GTK_CHECK_VERSION (2, 14, 0)
icon = g_content_type_get_icon (content_type);
- g_themed_icon_append_name (G_THEMED_ICON (icon), "document-x-generic");
+ g_themed_icon_append_name (G_THEMED_ICON (icon), "text-html");
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
g_object_unref (icon);
gtk_widget_show (image);
GtkIconEntryPosition icon_pos,
const gchar* icon_name)
{
- #if !HAVE_HILDON
- GdkScreen* screen = gtk_widget_get_screen (findbar->find_text);
- GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
- gchar* symbolic_icon_name;
-
- if (icon_name == NULL)
+ if (icon_name != NULL)
{
+ #if GTK_CHECK_VERSION (2, 16, 0)
+ gchar* symbolic_icon_name = g_strconcat (icon_name, "-symbolic", NULL);
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (findbar->find_text), icon_pos,
+ g_themed_icon_new_with_default_fallbacks (symbolic_icon_name));
+ g_free (symbolic_icon_name);
+ #else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
- icon_pos, NULL);
- return;
+ icon_pos, icon_name);
+ #endif
}
-
- symbolic_icon_name = g_strconcat (icon_name, "-symbolic", NULL);
- if (gtk_icon_theme_has_icon (icon_theme, symbolic_icon_name))
- gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
- icon_pos, symbolic_icon_name);
else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
- icon_pos, icon_name);
- g_free (symbolic_icon_name);
- #endif
+ icon_pos, NULL);
}
static void