Author: peter
Date: 2007-01-11 16:54:21 +0000 (Thu, 11 Jan 2007)
New Revision: 24358

Modified:
   squeeze/trunk/src/archive_store.c
   squeeze/trunk/src/main_window.c
   squeeze/trunk/src/notebook.c
   squeeze/trunk/src/notebook.h
Log:
bugs in show_icons fixes
notebook is better proxy now also proxy for rules-hint


Modified: squeeze/trunk/src/archive_store.c
===================================================================
--- squeeze/trunk/src/archive_store.c   2007-01-11 14:26:32 UTC (rev 24357)
+++ squeeze/trunk/src/archive_store.c   2007-01-11 16:54:21 UTC (rev 24358)
@@ -236,28 +236,28 @@
        object_class->get_property = sq_archive_store_get_property;
        object_class->finalize = sq_archive_store_finalize;
 
-       pspec = g_param_spec_boolean("show_icons",
+       pspec = g_param_spec_boolean("show-icons",
                _("Show mime icons"),
                _("Show the mime type icons for each entry"),
                FALSE,
                G_PARAM_READWRITE);
        g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SHOW_ICONS, pspec);
 
-       pspec = g_param_spec_boolean("show_up_dir",
+       pspec = g_param_spec_boolean("show-up-dir",
                _("Show up dir entry"),
                _("Show \'..\' to go to the parent directory"),
                TRUE,
                G_PARAM_READWRITE);
        g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SHOW_UP_DIR, pspec);
 
-       pspec = g_param_spec_boolean("sort_folders_first",
+       pspec = g_param_spec_boolean("sort-folders-first",
                _("Sort folders before files"),
                _("The folders will be put at the top of the list"),
                TRUE,
                G_PARAM_READWRITE);
        g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SORT_FOLDERS_FIRST, pspec);
 
-       pspec = g_param_spec_boolean("sort_case_sensitive",
+       pspec = g_param_spec_boolean("sort-case-sensitive",
                _("Sort text case sensitive"),
                _("Sort text case sensitive"),
                TRUE,
@@ -1318,24 +1318,11 @@
        g_return_if_fail(store->navigation.present->data);
 #endif
 
-       GtkSortType sort_order;
-       gint sort_col = 0;
-
        show = show?1:0;
 
        if(store->props._show_icons != show)
        {
                store->props._show_icons = show;
-               if(show)
-               {
-                       
sq_archive_store_get_sort_column_id(GTK_TREE_SORTABLE(store), &sort_col, 
&sort_order);
-                       
sq_archive_store_set_sort_column_id(GTK_TREE_SORTABLE(store), sort_col+1, 
sort_order);
-               }
-               else
-               {
-                       
sq_archive_store_get_sort_column_id(GTK_TREE_SORTABLE(store), &sort_col, 
&sort_order);
-                       
sq_archive_store_set_sort_column_id(GTK_TREE_SORTABLE(store), sort_col-1, 
sort_order);
-               }
                if(store->archive)
                        sq_archive_store_refresh(store);
                g_object_notify(G_OBJECT(store), "show-icons");

Modified: squeeze/trunk/src/main_window.c
===================================================================
--- squeeze/trunk/src/main_window.c     2007-01-11 14:26:32 UTC (rev 24357)
+++ squeeze/trunk/src/main_window.c     2007-01-11 16:54:21 UTC (rev 24358)
@@ -436,12 +436,18 @@
        g_signal_connect(G_OBJECT(window->notebook), 
"active-archive-status-changed", 
G_CALLBACK(cb_sq_main_window_notebook_status_changed), window);
 
 /* menu item */
-       list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "show_icons");
+       list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "show-icons");
        for(iter = list; iter; iter = iter->next)
        {
                gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
iter->data);
                gtk_widget_show(iter->data);
        }
+       list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "rules-hint");
+       for(iter = list; iter; iter = iter->next)
+       {
+               gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
iter->data);
+               gtk_widget_show(iter->data);
+       }
 
 /* Statusbar */
 

Modified: squeeze/trunk/src/notebook.c
===================================================================
--- squeeze/trunk/src/notebook.c        2007-01-11 14:26:32 UTC (rev 24357)
+++ squeeze/trunk/src/notebook.c        2007-01-11 16:54:21 UTC (rev 24358)
@@ -46,6 +46,8 @@
 
 static SQArchiveStore *
 sq_notebook_get_store(SQNotebook *notebook, gint page_nr);
+static GtkTreeView *
+sq_notebook_get_tree_view(SQNotebook *notebook, gint page_nr);
 
 static void
 cb_notebook_close_archive(GtkButton *button, GtkWidget *child);
@@ -67,7 +69,8 @@
 
 enum {
        SQ_NOTEBOOK_MULTI_TAB = 1,
-       SQ_NOTEBOOK_STORE_SHOW_ICONS
+       SQ_NOTEBOOK_STORE_SHOW_ICONS,
+       SQ_NOTEBOOK_TREE_RULES_HINT
 };
 
 enum
@@ -167,7 +170,7 @@
                TRUE,
                G_PARAM_READWRITE); 
g_object_class_install_property(object_class, SQ_NOTEBOOK_MULTI_TAB, pspec); 
 
-       pspec = g_param_spec_boolean("show_icons",
+       pspec = g_param_spec_boolean("show-icons",
                _("Show mime icons"),
                _("Show the mime type icons for each entry"),
                FALSE,
@@ -188,6 +191,12 @@
                G_PARAM_READWRITE);
        g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SORT_CASE_SENSITIVE, pspec);
 */
+       pspec = g_param_spec_boolean("rules-hint",
+               _("Rules hint"),
+               _("Make the row background colors alternate"),
+               FALSE,
+               G_PARAM_READWRITE);
+       g_object_class_install_property(object_class, 
SQ_NOTEBOOK_TREE_RULES_HINT, pspec);
 }
 
 static void
@@ -199,6 +208,12 @@
        g_signal_connect(G_OBJECT(notebook), "page-up", 
G_CALLBACK(gtk_notebook_next_page),  NULL);
        g_signal_connect(G_OBJECT(notebook), "page-down", 
G_CALLBACK(gtk_notebook_prev_page), NULL);
 
+       notebook->current_page_fix = 0;
+       notebook->props._rules_hint = FALSE;
+       notebook->props._show_icons = TRUE;
+       notebook->multi_tab = TRUE;
+       notebook->accel_group = NULL;
+
        notebook->tool_tips = gtk_tooltips_new();
        gtk_tooltips_enable(notebook->tool_tips);
        gtk_notebook_set_tab_border(GTK_NOTEBOOK(notebook), 0);
@@ -241,7 +256,6 @@
 
        sq_notebook_set_navigation_bar(notebook, bar);
 
-       notebook->props._show_icons = TRUE;
        notebook->multi_tab = use_tabs;
        notebook->accel_group = accel_group;
 
@@ -261,13 +275,22 @@
                        break;
                case SQ_NOTEBOOK_STORE_SHOW_ICONS:
                {
-                       SQArchiveStore *store = 
sq_notebook_get_active_store(SQ_NOTEBOOK(object));
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
                        if(store)
                                sq_archive_store_set_show_icons(store, 
g_value_get_boolean(value));
                        else
                                SQ_NOTEBOOK(object)->props._show_icons = 
g_value_get_boolean(value);
                        break;
                }
+               case SQ_NOTEBOOK_TREE_RULES_HINT:
+               {
+                       GtkTreeView *tree = 
sq_notebook_get_tree_view(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(tree)
+                               gtk_tree_view_set_rules_hint(tree, 
g_value_get_boolean(value));
+                       else
+                               SQ_NOTEBOOK(object)->props._rules_hint = 
g_value_get_boolean(value);
+                       break;
+               }
        }
 }
 
@@ -281,13 +304,22 @@
                        break;
                case SQ_NOTEBOOK_STORE_SHOW_ICONS:
                {
-                       SQArchiveStore *store = 
sq_notebook_get_active_store(SQ_NOTEBOOK(object));
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
                        if(store)
                                g_value_set_boolean(value, 
sq_archive_store_get_show_icons(store));
                        else
                                g_value_set_boolean(value, 
SQ_NOTEBOOK(object)->props._show_icons);
                        break;
                }
+               case SQ_NOTEBOOK_TREE_RULES_HINT:
+               {
+                       GtkTreeView *tree = 
sq_notebook_get_tree_view(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(tree)
+                               g_value_set_boolean(value, 
gtk_tree_view_get_rules_hint(tree));
+                       else
+                               g_value_set_boolean(value, 
SQ_NOTEBOOK(object)->props._rules_hint);
+                       break;
+               }
        }
 }
 
@@ -316,6 +348,24 @@
        return SQ_ARCHIVE_STORE(archive_store);
 }
 
+GtkTreeView *
+sq_notebook_get_active_tree_view(SQNotebook *notebook)
+{
+       gint page_nr = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+
+       return sq_notebook_get_tree_view(notebook, page_nr);
+}
+
+static GtkTreeView *
+sq_notebook_get_tree_view(SQNotebook *notebook, gint page_nr)
+{
+       GtkWidget *scrolledwindow = 
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_nr);
+       if(!scrolledwindow)
+               return NULL;
+       GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
+       return GTK_TREE_VIEW(treeview);
+}
+
 void
 sq_notebook_set_navigation_bar(SQNotebook *notebook, SQNavigationBar *bar)
 {
@@ -370,6 +420,7 @@
        gtk_tooltips_set_tip(notebook->tool_tips, label, 
lsq_archive_get_filename(archive), NULL);
 
        GtkWidget *tree_view = gtk_tree_view_new();
+       g_signal_connect(G_OBJECT(tree_view), "notify", 
G_CALLBACK(cb_sq_notebook_notify_proxy), notebook);
        gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree_view), TRUE);
 
        GtkTreeSelection *selection = gtk_tree_view_get_selection ( 
GTK_TREE_VIEW (tree_view) );
@@ -586,8 +637,10 @@
        if(archive_store)
        {
                g_object_set(G_OBJECT(archive_store), "show_up_dir", 
notebook->props._up_dir, NULL);
-               g_object_notify(G_OBJECT(notebook), "show-icons");
        }
+       notebook->current_page_fix = page_nr;
+       g_object_notify(G_OBJECT(notebook), "show-icons");
+       g_object_notify(G_OBJECT(notebook), "rules-hint");
 }
 
 static void
@@ -707,6 +760,23 @@
 static void
 cb_sq_notebook_notify_proxy(GObject *obj, GParamSpec *pspec, gpointer 
user_data)
 {
-       g_object_notify(user_data, g_param_spec_get_name(pspec));
+       if(strcmp(g_param_spec_get_name(pspec), "show-icons") == 0)
+       {
+               g_object_notify(user_data, g_param_spec_get_name(pspec));
+
+               GtkTreeView *treeview = 
sq_notebook_get_active_tree_view(SQ_NOTEBOOK(user_data));
+               SQArchiveStore *store = 
SQ_ARCHIVE_STORE(gtk_tree_view_get_model(treeview));
+
+               
sq_notebook_treeview_reset_columns(sq_archive_store_get_archive(store), 
treeview);
+       }
+       if(strcmp(g_param_spec_get_name(pspec), "show-icons") == 0)
+       {
+               g_object_notify(user_data, g_param_spec_get_name(pspec));
+
+               GtkTreeView *treeview = 
sq_notebook_get_active_tree_view(SQ_NOTEBOOK(user_data));
+               SQArchiveStore *store = 
SQ_ARCHIVE_STORE(gtk_tree_view_get_model(treeview));
+
+               
sq_notebook_treeview_reset_columns(sq_archive_store_get_archive(store), 
treeview);
+       }
 }
 

Modified: squeeze/trunk/src/notebook.h
===================================================================
--- squeeze/trunk/src/notebook.h        2007-01-11 14:26:32 UTC (rev 24357)
+++ squeeze/trunk/src/notebook.h        2007-01-11 16:54:21 UTC (rev 24358)
@@ -51,10 +51,12 @@
        {
                gboolean _show_icons;
                gboolean _up_dir;
+               gboolean _rules_hint;
        } props;
        GtkIconTheme *icon_theme;
        GtkAccelGroup *accel_group;
        GtkTooltips *tool_tips;
+       gint current_page_fix;
 };
 
 typedef struct _SQNotebookClass SQNotebookClass;
@@ -76,6 +78,7 @@
 gboolean    sq_notebook_is_active_archive(SQNotebook *, LSQArchive *);
 GtkWidget  *sq_notebook_get_active_child(SQNotebook *notebook);
 SQArchiveStore *sq_notebook_get_active_store(SQNotebook *notebook);
+GtkTreeView *sq_notebook_get_active_tree_view(SQNotebook *notebook);
 gboolean    sq_notebook_get_multi_tab(SQNotebook *notebook);
 void        sq_notebook_close_active_archive(SQNotebook *);
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to