Author: peter
Date: 2007-01-10 16:47:48 +0000 (Wed, 10 Jan 2007)
New Revision: 24345
Modified:
squeeze/trunk/src/application.c
squeeze/trunk/src/archive_store.c
squeeze/trunk/src/main_window.c
squeeze/trunk/src/notebook.c
squeeze/trunk/src/notebook.h
squeeze/trunk/src/widget_factory.c
Log:
notebook is proxy for archive_store _show_icon property
show icons property is working again
Modified: squeeze/trunk/src/application.c
===================================================================
--- squeeze/trunk/src/application.c 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/application.c 2007-01-10 16:47:48 UTC (rev 24345)
@@ -44,8 +44,14 @@
static void
sq_application_dispose(GObject *object);
-static gint sq_application_signals[1];
+enum
+{
+ SQ_APPLICATION_SIGNAL_DESTROY = 0,
+ SQ_APPLICATION_SIGNAL_COUNT
+};
+static gint sq_application_signals[SQ_APPLICATION_SIGNAL_COUNT];
+
GType
sq_application_get_type ()
{
@@ -79,7 +85,7 @@
object_class->finalize = sq_application_finalize;
object_class->dispose = sq_application_dispose;
- sq_application_signals[0] = g_signal_new("destroy",
+ sq_application_signals[SQ_APPLICATION_SIGNAL_DESTROY] =
g_signal_new("destroy",
G_TYPE_FROM_CLASS(application_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0,
@@ -103,7 +109,7 @@
static void
sq_application_dispose(GObject *object)
{
- g_signal_emit(object, sq_application_signals[0], 0, object);
+ g_signal_emit(object,
sq_application_signals[SQ_APPLICATION_SIGNAL_DESTROY], 0, object);
}
static void
Modified: squeeze/trunk/src/archive_store.c
===================================================================
--- squeeze/trunk/src/archive_store.c 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/archive_store.c 2007-01-10 16:47:48 UTC (rev 24345)
@@ -383,10 +383,7 @@
if(!archive)
return 0;
- if(store->props._show_icons)
- return lsq_archive_n_property(archive) + 1;
- else
- return lsq_archive_n_property(archive);
+ return lsq_archive_n_property(archive) + 1;
}
static GType
@@ -396,18 +393,15 @@
SQArchiveStore *store = SQ_ARCHIVE_STORE(tree_model);
LSQArchive *archive = store->archive;
- g_return_val_if_fail(index < lsq_archive_n_property(archive),
G_TYPE_STRING);
+ g_return_val_if_fail(index < lsq_archive_n_property(archive),
G_TYPE_INVALID);
if(!archive)
return G_TYPE_INVALID;
- if(store->props._show_icons)
- {
- index--;
+ index--;
- if(index < 0)
- return G_TYPE_STRING;
- }
+ if(index == -1) /* icon */
+ return G_TYPE_STRING;
return lsq_archive_get_entry_property_type(archive, index);
}
@@ -507,17 +501,16 @@
g_return_if_fail(archive);
-/*
- if(store->props._show_icons)
- column--;
- */
column--;
if(entry)
{
if(column == -1)
{
- lsq_archive_iter_get_icon_name(archive, entry, value,
store->icon_theme);
+ if(store->props._show_icons)
+ lsq_archive_iter_get_icon_name(archive, entry,
value, store->icon_theme);
+ else
+ g_value_init(value, G_TYPE_STRING);
}
else
{
@@ -536,7 +529,8 @@
{
case -1:
g_value_init(value, G_TYPE_STRING);
- g_value_set_string(value, GTK_STOCK_GO_UP);
+ if(store->props._show_icons)
+ g_value_set_string(value,
GTK_STOCK_GO_UP);
break;
case LSQ_ARCHIVE_PROP_FILENAME:
g_value_init(value, G_TYPE_STRING);
@@ -742,12 +736,8 @@
if(store->sort_column == sort_col_id && store->sort_order == order)
return;
-
- if(store->props._show_icons)
- {
- if(sort_col_id == 0)
- return;
- }
+ if(sort_col_id == 0)
+ return;
store->sort_column = sort_col_id;
store->sort_order = order;
@@ -808,12 +798,7 @@
}
LSQArchive *archive = store->archive;
- if(store->props._show_icons)
- column = store->sort_column - 1;
- else
- {
- column = store->sort_column;
- }
+ column = store->sort_column - 1;
lsq_archive_iter_get_prop_value(archive, a, column, &prop_a);
lsq_archive_iter_get_prop_value(archive, b, column, &prop_b);
@@ -1335,19 +1320,26 @@
GtkSortType sort_order;
gint sort_col = 0;
- store->props._show_icons = show?1:0;
- if(show)
+
+ show = show?1:0;
+
+ if(store->props._show_icons != 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);
+ 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");
}
- 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);
}
void
Modified: squeeze/trunk/src/main_window.c
===================================================================
--- squeeze/trunk/src/main_window.c 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/main_window.c 2007-01-10 16:47:48 UTC (rev 24345)
@@ -432,6 +432,15 @@
g_signal_connect(G_OBJECT(window->notebook), "archive-removed",
G_CALLBACK(cb_sq_main_window_notebook_page_removed), window);
g_signal_connect(G_OBJECT(window->notebook), "file-activated",
G_CALLBACK(cb_sq_main_window_notebook_file_activated), window);
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");
+ for(iter = list; iter; iter = iter->next)
+ {
+ gtk_container_add(GTK_CONTAINER(window->menubar.menu_view),
iter->data);
+ gtk_widget_show(iter->data);
+ }
+
/* Statusbar */
window->statusbar = gtk_statusbar_new();
Modified: squeeze/trunk/src/notebook.c
===================================================================
--- squeeze/trunk/src/notebook.c 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/notebook.c 2007-01-10 16:47:48 UTC (rev 24345)
@@ -44,6 +44,9 @@
static void
sq_notebook_treeview_reset_columns(LSQArchive *archive, GtkTreeView *treeview);
+static SQArchiveStore *
+sq_notebook_get_store(SQNotebook *notebook, gint page_nr);
+
static void
cb_notebook_close_archive(GtkButton *button, GtkWidget *child);
@@ -59,8 +62,12 @@
static void
cb_sq_notebook_page_removed(SQNotebook *notebook, gpointer data);
+static void
+cb_sq_notebook_notify_proxy(GObject *obj, GParamSpec *pspec, gpointer
user_data);
+
enum {
- SQ_NOTEBOOK_MULTI_TAB = 1
+ SQ_NOTEBOOK_MULTI_TAB = 1,
+ SQ_NOTEBOOK_STORE_SHOW_ICONS
};
enum
@@ -159,6 +166,28 @@
"",
TRUE,
G_PARAM_READWRITE);
g_object_class_install_property(object_class, SQ_NOTEBOOK_MULTI_TAB, pspec);
+
+ 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_NOTEBOOK_STORE_SHOW_ICONS, pspec);
+/*
+ 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",
+ _("Sort text case sensitive"),
+ _("Sort text case sensitive"),
+ TRUE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class,
SQ_ARCHIVE_STORE_SORT_CASE_SENSITIVE, pspec);
+*/
}
static void
@@ -181,16 +210,15 @@
sq_notebook_dispose(GObject *object)
{
/* TODO: unref archive_stores */
- GtkWidget *child = NULL;
GtkNotebook *notebook = GTK_NOTEBOOK(object);
gint n = gtk_notebook_get_n_pages(notebook);
gint i = 0;
for(i = 0; i < n; i++)
{
- child = gtk_notebook_get_nth_page(notebook, i);
- GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(child));
+ GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
+ GtkWidget *treeview =
gtk_bin_get_child(GTK_BIN(scrolledwindow));
GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
-
+
LSQArchive *archive =
sq_archive_store_get_archive(SQ_ARCHIVE_STORE(archive_store));
if(archive)
@@ -231,6 +259,15 @@
case SQ_NOTEBOOK_MULTI_TAB:
SQ_NOTEBOOK(object)->multi_tab =
g_value_get_boolean(value);
break;
+ case SQ_NOTEBOOK_STORE_SHOW_ICONS:
+ {
+ SQArchiveStore *store =
sq_notebook_get_active_store(SQ_NOTEBOOK(object));
+ 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;
+ }
}
}
@@ -242,6 +279,15 @@
case SQ_NOTEBOOK_MULTI_TAB:
g_value_set_boolean(value,
SQ_NOTEBOOK(object)->multi_tab);
break;
+ case SQ_NOTEBOOK_STORE_SHOW_ICONS:
+ {
+ SQArchiveStore *store =
sq_notebook_get_active_store(SQ_NOTEBOOK(object));
+ 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;
+ }
}
}
@@ -251,6 +297,25 @@
return notebook->multi_tab;
}
+SQArchiveStore *
+sq_notebook_get_active_store(SQNotebook *notebook)
+{
+ gint page_nr = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+
+ return sq_notebook_get_store(notebook, page_nr);
+}
+
+static SQArchiveStore *
+sq_notebook_get_store(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));
+ GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+ return SQ_ARCHIVE_STORE(archive_store);
+}
+
void
sq_notebook_set_navigation_bar(SQNotebook *notebook, SQNavigationBar *bar)
{
@@ -273,13 +338,10 @@
if(gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)))
{
- gint page_nr =
gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
- GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_nr);
- GtkWidget *treeview =
gtk_bin_get_child(GTK_BIN(scrolledwindow));
- GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+ SQArchiveStore *archive_store =
sq_notebook_get_active_store(notebook);
notebook->navigation_bar = bar;
if(bar)
- sq_navigation_bar_set_store(notebook->navigation_bar,
SQ_ARCHIVE_STORE(archive_store));
+ sq_navigation_bar_set_store(notebook->navigation_bar,
archive_store);
if(archive_store)
g_object_set(G_OBJECT(archive_store), "show_up_dir",
notebook->props._up_dir, NULL);
}
@@ -314,6 +376,7 @@
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
GtkTreeModel *tree_model = sq_archive_store_new(archive,
notebook->props._show_icons, notebook->props._up_dir, notebook->icon_theme);
+ g_signal_connect(G_OBJECT(tree_model), "notify",
G_CALLBACK(cb_sq_notebook_notify_proxy), notebook);
gtk_box_pack_start(GTK_BOX(lbl_hbox), archive_image, FALSE, FALSE, 3);
gtk_box_pack_start(GTK_BOX(lbl_hbox), label, TRUE, TRUE, 0);
@@ -419,12 +482,9 @@
void
sq_notebook_close_active_archive(SQNotebook *notebook)
{
- GtkNotebook *_notebook = GTK_NOTEBOOK(notebook);
- gint n = gtk_notebook_get_current_page(_notebook);
-
- GtkWidget *child = gtk_notebook_get_nth_page(_notebook, n);
-
- GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(child));
+ gint n = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+ GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n);
+ GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
LSQArchive *archive =
sq_archive_store_get_archive(SQ_ARCHIVE_STORE(archive_store));
@@ -432,12 +492,12 @@
if(archive)
g_signal_handlers_disconnect_by_func(archive,
cb_notebook_archive_refreshed, treeview);
if(SQ_NOTEBOOK(notebook)->navigation_bar)
- sq_navigation_bar_set_store(((SQNotebook
*)notebook)->navigation_bar, NULL);
+ sq_navigation_bar_set_store(notebook->navigation_bar, NULL);
g_object_unref(archive_store);
lsq_close_archive(archive);
- gtk_notebook_remove_page(_notebook, n);
+ gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), n);
g_signal_emit(G_OBJECT(notebook),
sq_notebook_signals[SQ_NOTEBOOK_SIGNAL_ARCHIVE_REMOVED], 0, NULL);
}
@@ -520,13 +580,14 @@
static void
cb_sq_notebook_page_switched(SQNotebook *notebook, GtkNotebookPage *page,
guint page_nr, gpointer data)
{
- GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_nr);
- GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
- GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+ SQArchiveStore *archive_store = sq_notebook_get_store(notebook,
page_nr);
if(notebook->navigation_bar)
- sq_navigation_bar_set_store(notebook->navigation_bar,
SQ_ARCHIVE_STORE(archive_store));
+ sq_navigation_bar_set_store(notebook->navigation_bar,
archive_store);
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");
+ }
}
static void
@@ -550,15 +611,10 @@
gboolean
sq_notebook_is_active_archive(SQNotebook *notebook, LSQArchive *archive)
{
- gint n = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
-
- GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n);
- if(!scrolledwindow)
+ SQArchiveStore *archive_store = sq_notebook_get_active_store(notebook);
+ if(!archive_store)
return FALSE;
- GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
- GtkTreeModel *archive_store =
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
-
- LSQArchive * lp_archive =
sq_archive_store_get_archive(SQ_ARCHIVE_STORE(archive_store));
+ LSQArchive * lp_archive = sq_archive_store_get_archive(archive_store);
if(lp_archive == archive)
return TRUE;
return FALSE;
@@ -640,12 +696,17 @@
void
sq_notebook_page_get_archive(SQNotebook *notebook, LSQArchive **lp_archive,
LSQArchiveSupport **lp_support, gint n)
{
- GtkWidget *scrolledwindow =
gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n);
- GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
- GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+ SQArchiveStore *store = sq_notebook_get_store(notebook, n);
if(lp_archive)
- (*lp_archive) =
sq_archive_store_get_archive(SQ_ARCHIVE_STORE(store));
+ (*lp_archive) = sq_archive_store_get_archive(store);
if(lp_support)
- (*lp_support) =
sq_archive_store_get_support(SQ_ARCHIVE_STORE(store));
+ (*lp_support) = sq_archive_store_get_support(store);
}
+
+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));
+}
+
Modified: squeeze/trunk/src/notebook.h
===================================================================
--- squeeze/trunk/src/notebook.h 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/notebook.h 2007-01-10 16:47:48 UTC (rev 24345)
@@ -75,6 +75,7 @@
void sq_notebook_get_active_archive(SQNotebook *, LSQArchive **,
LSQArchiveSupport **);
gboolean sq_notebook_is_active_archive(SQNotebook *, LSQArchive *);
GtkWidget *sq_notebook_get_active_child(SQNotebook *notebook);
+SQArchiveStore *sq_notebook_get_active_store(SQNotebook *notebook);
gboolean sq_notebook_get_multi_tab(SQNotebook *notebook);
void sq_notebook_close_active_archive(SQNotebook *);
Modified: squeeze/trunk/src/widget_factory.c
===================================================================
--- squeeze/trunk/src/widget_factory.c 2007-01-10 13:53:01 UTC (rev 24344)
+++ squeeze/trunk/src/widget_factory.c 2007-01-10 16:47:48 UTC (rev 24345)
@@ -478,8 +478,6 @@
g_value_unset(&value);
- g_debug("created %p", widget);
-
return widget;
}
@@ -791,8 +789,6 @@
{
GValue value, other_value;
- g_debug("notify %p", user_data);
-
if(strcmp(g_param_spec_get_name(pspec),
g_param_spec_get_name(g_object_get_data(G_OBJECT(user_data),
SQ_PROPERTY_SPEC_DATA))))
return;
@@ -990,6 +986,5 @@
cb_sq_widget_factory_widget_destroyed(GtkObject *obj, gpointer user_data)
{
g_signal_handlers_disconnect_by_func(user_data,
cb_sq_widget_factory_property_notify, obj);
- g_debug("destroyed %p", obj);
}
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits