[gedit] filebrowser: use symbolic icons for bookmarks
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] filebrowser: use symbolic icons for bookmarks
- Date: Wed, 26 Sep 2012 09:32:56 +0000 (UTC)
commit 5acc1cac2ed7c4e9fc5d662531d2a308aea3489f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Sep 25 23:14:06 2012 +0200
filebrowser: use symbolic icons for bookmarks
plugins/filebrowser/gedit-file-bookmarks-store.c | 18 ++++++++++--------
plugins/filebrowser/gedit-file-browser-store.c | 4 ++--
plugins/filebrowser/gedit-file-browser-utils.c | 16 +++++++++++-----
plugins/filebrowser/gedit-file-browser-utils.h | 3 ++-
plugins/filebrowser/gedit-file-browser-widget.c | 4 ++--
5 files changed, 27 insertions(+), 18 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-bookmarks-store.c b/plugins/filebrowser/gedit-file-bookmarks-store.c
index bbf601f..274e39c 100644
--- a/plugins/filebrowser/gedit-file-bookmarks-store.c
+++ b/plugins/filebrowser/gedit-file-bookmarks-store.c
@@ -146,19 +146,19 @@ add_file (GeditFileBookmarksStore *model,
return FALSE;
if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_HOME)
- pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-home", GTK_ICON_SIZE_MENU);
+ pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-home-symbolic", GTK_ICON_SIZE_MENU);
else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP)
- pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-desktop", GTK_ICON_SIZE_MENU);
+ pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-desktop-symbolic", GTK_ICON_SIZE_MENU);
else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT)
- pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("drive-harddisk", GTK_ICON_SIZE_MENU);
+ pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("drive-harddisk-symbolic", GTK_ICON_SIZE_MENU);
if (pixbuf == NULL)
{
/* getting the icon is a sync get_info call, so we just do it for local files */
if (native)
- pixbuf = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
+ pixbuf = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU, TRUE);
else
- pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("folder", GTK_ICON_SIZE_MENU);
+ pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("folder-symbolic", GTK_ICON_SIZE_MENU);
}
if (name == NULL)
@@ -217,6 +217,7 @@ init_special_directories (GeditFileBookmarksStore *model)
g_object_unref (file);
}
+#if defined(G_OS_WIN32) || defined(OS_OSX)
path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
if (path != NULL)
{
@@ -234,6 +235,7 @@ init_special_directories (GeditFileBookmarksStore *model)
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
g_object_unref (file);
}
+#endif
file = g_file_new_for_uri ("file:///");
add_file (model, file, _("File System"), GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT, NULL);
@@ -256,21 +258,21 @@ get_fs_properties (gpointer fs,
if (G_IS_DRIVE (fs))
{
- icon = g_drive_get_icon (G_DRIVE (fs));
+ icon = g_drive_get_symbolic_icon (G_DRIVE (fs));
*name = g_drive_get_name (G_DRIVE (fs));
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE;
}
else if (G_IS_VOLUME (fs))
{
- icon = g_volume_get_icon (G_VOLUME (fs));
+ icon = g_volume_get_symbolic_icon (G_VOLUME (fs));
*name = g_volume_get_name (G_VOLUME (fs));
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME;
}
else if (G_IS_MOUNT (fs))
{
- icon = g_mount_get_icon (G_MOUNT (fs));
+ icon = g_mount_get_symbolic_icon (G_MOUNT (fs));
*name = g_mount_get_name (G_MOUNT (fs));
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT;
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index 392bbe7..77afffa 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -1661,7 +1661,7 @@ model_recomposite_icon_real (GeditFileBrowserStore *tree_model,
}
else
{
- icon = gedit_file_browser_utils_pixbuf_from_file (node->file, GTK_ICON_SIZE_MENU);
+ icon = gedit_file_browser_utils_pixbuf_from_file (node->file, GTK_ICON_SIZE_MENU, FALSE);
}
if (node->icon)
@@ -2243,7 +2243,7 @@ model_add_node_from_dir (GeditFileBrowserStore *model,
file_browser_node_set_name (node);
if (node->icon == NULL)
- node->icon = gedit_file_browser_utils_pixbuf_from_theme ("folder", GTK_ICON_SIZE_MENU);
+ node->icon = gedit_file_browser_utils_pixbuf_from_theme ("folder-symbolic", GTK_ICON_SIZE_MENU);
model_add_node (model, node, parent);
}
diff --git a/plugins/filebrowser/gedit-file-browser-utils.c b/plugins/filebrowser/gedit-file-browser-utils.c
index 8d406f3..8e99c7d 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.c
+++ b/plugins/filebrowser/gedit-file-browser-utils.c
@@ -103,14 +103,19 @@ gedit_file_browser_utils_pixbuf_from_icon (GIcon *icon,
GdkPixbuf *
gedit_file_browser_utils_pixbuf_from_file (GFile *file,
- GtkIconSize size)
+ GtkIconSize size,
+ gboolean use_symbolic)
{
GIcon *icon;
GFileInfo *info;
GdkPixbuf *ret = NULL;
+ const char *attribute;
+
+ attribute = use_symbolic ? G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON :
+ G_FILE_ATTRIBUTE_STANDARD_ICON;
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_ICON,
+ attribute,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
@@ -118,7 +123,8 @@ gedit_file_browser_utils_pixbuf_from_file (GFile *file,
if (!info)
return NULL;
- icon = g_file_info_get_icon (info);
+ icon = use_symbolic ? g_file_info_get_symbolic_icon (info) :
+ g_file_info_get_icon (info);
if (icon != NULL)
ret = gedit_file_browser_utils_pixbuf_from_icon (icon, size);
@@ -163,8 +169,8 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow *window,
gtk_widget_set_can_default (button, TRUE);
gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
- button,
- GTK_RESPONSE_CANCEL);
+ button,
+ GTK_RESPONSE_CANCEL);
/* Add custom button */
button = gtk_button_new_from_stock (button_stock);
diff --git a/plugins/filebrowser/gedit-file-browser-utils.h b/plugins/filebrowser/gedit-file-browser-utils.h
index f45cd26..150f289 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.h
+++ b/plugins/filebrowser/gedit-file-browser-utils.h
@@ -31,7 +31,8 @@ GdkPixbuf *gedit_file_browser_utils_pixbuf_from_theme (gchar const *name,
GdkPixbuf *gedit_file_browser_utils_pixbuf_from_icon (GIcon *icon,
GtkIconSize size);
GdkPixbuf *gedit_file_browser_utils_pixbuf_from_file (GFile *file,
- GtkIconSize size);
+ GtkIconSize size,
+ gboolean use_symbolic);
gchar *gedit_file_browser_utils_file_basename (GFile *file);
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index 59bf0e7..771e437 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -568,7 +568,7 @@ insert_path_item (GeditFileBrowserWidget *obj,
unescape = gedit_file_browser_utils_file_basename (file);
/* Get the icon */
- icon = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
+ icon = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU, TRUE);
}
gtk_tree_store_insert_after (obj->priv->combo_model, iter, NULL,
@@ -725,7 +725,7 @@ fill_combo_model (GeditFileBrowserWidget *obj)
GtkTreeIter iter;
GdkPixbuf *icon;
- icon = gedit_file_browser_utils_pixbuf_from_theme (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
+ icon = gedit_file_browser_utils_pixbuf_from_theme ("user-bookmarks-symbolic", GTK_ICON_SIZE_MENU);
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]