changeset 1612:5d54bc073bfa

Attempt to use stock gtk icons for directory list and tree views.
author zas_
date Thu, 21 May 2009 09:20:48 +0000
parents f2e62c65a696
children 30c98d03efae
files src/layout_util.c src/layout_util.h src/view_dir.c
diffstat 3 files changed, 39 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout_util.c	Sat May 16 11:31:48 2009 +0000
+++ b/src/layout_util.c	Thu May 21 09:20:48 2009 +0000
@@ -2200,37 +2200,6 @@
 //	layout_menu_edit_update(lw);
 }
 
-/*
- *-----------------------------------------------------------------------------
- * icons (since all the toolbar icons are included here, best place as any)
- *-----------------------------------------------------------------------------
- */
-
-PixmapFolders *folder_icons_new(void)
-{
-	PixmapFolders *pf;
-
-	pf = g_new0(PixmapFolders, 1);
-
-	pf->close = pixbuf_inline(PIXBUF_INLINE_FOLDER_CLOSED);
-	pf->open = pixbuf_inline(PIXBUF_INLINE_FOLDER_OPEN);
-	pf->deny = pixbuf_inline(PIXBUF_INLINE_FOLDER_LOCKED);
-	pf->parent = pixbuf_inline(PIXBUF_INLINE_FOLDER_UP);
-
-	return pf;
-}
-
-void folder_icons_free(PixmapFolders *pf)
-{
-	if (!pf) return;
-
-	g_object_unref(pf->close);
-	g_object_unref(pf->open);
-	g_object_unref(pf->deny);
-	g_object_unref(pf->parent);
-
-	g_free(pf);
-}
 
 /*
  *-----------------------------------------------------------------------------
--- a/src/layout_util.h	Sat May 16 11:31:48 2009 +0000
+++ b/src/layout_util.h	Thu May 21 09:20:48 2009 +0000
@@ -50,10 +50,6 @@
 void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window);
 
 
-PixmapFolders *folder_icons_new(void);
-void folder_icons_free(PixmapFolders *pf);
-
-
 void layout_bar_toggle(LayoutWindow *lw);
 void layout_bar_set(LayoutWindow *lw, GtkWidget *bar);
 
--- a/src/view_dir.c	Sat May 16 11:31:48 2009 +0000
+++ b/src/view_dir.c	Thu May 21 09:20:48 2009 +0000
@@ -18,6 +18,7 @@
 #include "filedata.h"
 #include "layout_image.h"
 #include "layout_util.h"
+#include "pixbuf_util.h"
 #include "ui_fileops.h"
 #include "ui_tree_edit.h"
 #include "ui_menu.h"
@@ -26,6 +27,43 @@
 #include "view_dir_list.h"
 #include "view_dir_tree.h"
 
+/* Folders icons to be used in tree or list directory view */
+static PixmapFolders *folder_icons_new(GtkWidget *widget)
+{
+	PixmapFolders *pf = g_new0(PixmapFolders, 1);
+	
+#if 1
+	GtkIconSize size = GTK_ICON_SIZE_MENU;
+
+	/* Attempt to use stock gtk icons */
+	pf->close  = gtk_widget_render_icon(widget, GTK_STOCK_DIRECTORY, size, NULL);
+	pf->open   = gtk_widget_render_icon(widget, GTK_STOCK_OPEN, size, NULL);
+	pf->deny   = gtk_widget_render_icon(widget, GTK_STOCK_STOP, size, NULL);
+	pf->parent = gtk_widget_render_icon(widget, GTK_STOCK_GO_UP, size, NULL);
+#else
+	/* GQView legacy icons */
+	pf->close  = pixbuf_inline(PIXBUF_INLINE_FOLDER_CLOSED);
+	pf->open   = pixbuf_inline(PIXBUF_INLINE_FOLDER_OPEN);
+	pf->deny   = pixbuf_inline(PIXBUF_INLINE_FOLDER_LOCKED);
+	pf->parent = pixbuf_inline(PIXBUF_INLINE_FOLDER_UP);
+#endif
+	return pf;
+}
+
+static void folder_icons_free(PixmapFolders *pf)
+{
+	if (!pf) return;
+
+	g_object_unref(pf->close);
+	g_object_unref(pf->open);
+	g_object_unref(pf->deny);
+	g_object_unref(pf->parent);
+
+	g_free(pf);
+}
+
+
+
 static void vd_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 GtkRadioActionEntry menu_view_dir_radio_entries[] = {
@@ -72,7 +110,7 @@
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vd->widget),
 				       GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 
-	vd->pf = folder_icons_new();
+	vd->pf = folder_icons_new(vd->widget);
 
 	switch (type)
 	{