[Xfce4-commits] r23333 - xarchiver/branches/xarchiver-psybsd/src

Stephan Arts stephan at xfce.org
Mon Oct 9 22:12:28 UTC 2006


Author: stephan
Date: 2006-10-09 22:12:27 +0000 (Mon, 09 Oct 2006)
New Revision: 23333

Added:
   xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c
   xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h
Modified:
   xarchiver/branches/xarchiver-psybsd/src/Makefile.am
   xarchiver/branches/xarchiver-psybsd/src/archive_store.c
   xarchiver/branches/xarchiver-psybsd/src/main.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.h
   xarchiver/branches/xarchiver-psybsd/src/path_bar.c
   xarchiver/branches/xarchiver-psybsd/src/path_bar.h
Log:
added some stuff for navigation



Modified: xarchiver/branches/xarchiver-psybsd/src/Makefile.am
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/Makefile.am	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/Makefile.am	2006-10-09 22:12:27 UTC (rev 23333)
@@ -3,6 +3,7 @@
 xarchiver_SOURCES = \
 	main.c main.h \
 	main_window.c main_window.h \
+	navigation_bar.c navigation_bar.h \
 	path_bar.c path_bar.h \
 	archive_store.c archive_store.h \
 	archive_tree_store.c archive_tree_store.h \

Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-10-09 22:12:27 UTC (rev 23333)
@@ -222,10 +222,9 @@
 		 0,
 		 NULL,
 		 NULL,
-		 g_cclosure_marshal_VOID__POINTER,
+		 g_cclosure_marshal_VOID__VOID,
 		 G_TYPE_NONE,
-		 1,
-		 G_TYPE_POINTER,
+		 0,
 		 NULL);
 }
 
@@ -954,6 +953,7 @@
 
 	xa_archive_store_sort(store);
 
+	g_signal_emit(store, xa_archive_store_signals[0], 0,NULL);
 	xa_archive_store_refresh(store, prev_size);
 }
 
@@ -981,6 +981,7 @@
 
 	xa_archive_store_sort(store);
 
+	g_signal_emit(store, xa_archive_store_signals[0], 0,NULL);
 	xa_archive_store_refresh(store, prev_size);
 }
 
@@ -1169,6 +1170,8 @@
 
 	g_slist_free(store->current_entry);
 	store->current_entry = stack;
+
+	g_signal_emit(store, xa_archive_store_signals[0], 0,NULL);
 	
 	return 0;
 }

Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c	2006-10-09 22:12:27 UTC (rev 23333)
@@ -26,6 +26,8 @@
 #include "add_dialog.h"
 #include "extract_dialog.h"
 #include "main.h"
+#include "archive_store.h"
+#include "navigation_bar.h"
 #include "main_window.h"
 
 gboolean version = FALSE;

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-10-09 22:12:27 UTC (rev 23333)
@@ -25,10 +25,11 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <libxarchiver/libxarchiver.h>
-#include "main_window.h"
 #include "archive_store.h"
 #include "archive_tree_store.h"
+#include "navigation_bar.h"
 #include "path_bar.h"
+#include "main_window.h"
 #include "new_dialog.h"
 #include "extract_dialog.h"
 #include "add_dialog.h"
@@ -274,7 +275,7 @@
 	gtk_box_pack_start(GTK_BOX(main_vbox), toolbar, FALSE, FALSE, 0);
 
 	if(window->navigationbar)
-		gtk_box_pack_start(GTK_BOX(main_vbox), window->navigationbar, FALSE, FALSE, 0);
+		gtk_box_pack_start(GTK_BOX(main_vbox), GTK_WIDGET(window->navigationbar), FALSE, FALSE, 0);
 
 	gtk_box_pack_start(GTK_BOX(main_vbox), window->scrollwindow, TRUE, TRUE, 0);
 	gtk_box_pack_end(GTK_BOX(main_vbox), window->statusbar, FALSE, FALSE, 0);
@@ -695,6 +696,7 @@
 		liststore = xa_archive_store_new(archive, TRUE, TRUE, window->icon_theme);
 /*		liststore = xa_archive_tree_store_new(archive, TRUE, show_only_filenames, FALSE, window->icon_theme); */
 
+
 		column = gtk_tree_view_column_new();
 		renderer = gtk_cell_renderer_pixbuf_new();
 		gtk_tree_view_column_pack_start(column, renderer, FALSE);
@@ -750,6 +752,7 @@
 	gtk_tree_view_set_model(GTK_TREE_VIEW(window->treeview), GTK_TREE_MODEL(liststore));
 	window->treemodel = GTK_TREE_MODEL(liststore);
 	xa_archive_store_connect_treeview(XA_ARCHIVE_STORE(liststore), GTK_TREE_VIEW(window->treeview));
+	xa_navigation_bar_set_store(window->navigationbar, XA_ARCHIVE_STORE(liststore));
 /*	xa_archive_tree_store_connect_treeview(XA_ARCHIVE_TREE_STORE(liststore), GTK_TREE_VIEW(window->treeview)); */
 }
 

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.h	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.h	2006-10-09 22:12:27 UTC (rev 23333)
@@ -55,7 +55,7 @@
 	GtkTreeModel *treemodel;
 	GtkWidget *scrollwindow;
 	GtkWidget *statusbar;
-	GtkWidget *navigationbar;
+	XANavigationBar *navigationbar;
 	struct {
 		GtkWidget *menu_item_archive;
 		GtkWidget *menu_archive;

Added: xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c	                        (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c	2006-10-09 22:12:27 UTC (rev 23333)
@@ -0,0 +1,101 @@
+/*
+ *  Copyright (c) 2006 Stephan Arts <psybsd at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libxarchiver/libxarchiver.h>
+#include "archive_store.h"
+#include "navigation_bar.h"
+
+
+static void
+xa_navigation_bar_class_init(XANavigationBarClass *archive_class);
+
+static void
+xa_navigation_bar_init(XANavigationBar *archive);
+
+static void
+cb_xa_navigation_bar_pwd_changed(XAArchiveStore *store, XANavigationBar *bar);
+
+GType
+xa_navigation_bar_get_type ()
+{
+	static GType xa_navigation_bar_type = 0;
+
+ 	if (!xa_navigation_bar_type)
+	{
+ 		static const GTypeInfo xa_navigation_bar_info = 
+		{
+			sizeof (XANavigationBarClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) xa_navigation_bar_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,
+			sizeof (XANavigationBar),
+			0,
+			(GInstanceInitFunc) xa_navigation_bar_init,
+			NULL
+		};
+
+		xa_navigation_bar_type = g_type_register_static (GTK_TYPE_TOOLBAR, "XANavigationBar", &xa_navigation_bar_info, 0);
+	}
+	return xa_navigation_bar_type;
+}
+
+static void
+xa_navigation_bar_class_init(XANavigationBarClass *navigation_bar_class)
+{
+}
+
+static void
+xa_navigation_bar_init(XANavigationBar *navigation_bar)
+{
+}
+
+void
+xa_navigation_bar_set_store(XANavigationBar *navigation_bar, XAArchiveStore *store)
+{
+	g_return_if_fail(XA_IS_ARCHIVE_STORE(store));
+	g_return_if_fail(XA_IS_NAVIGATION_BAR(navigation_bar));
+
+	navigation_bar->store = store;
+	g_signal_connect(G_OBJECT(store), "xa_pwd_changed", (GCallback)cb_xa_navigation_bar_pwd_changed, navigation_bar);
+}
+
+GtkWidget *
+xa_navigation_bar_new(XAArchiveStore *store)
+{
+	XANavigationBar *bar;
+
+	bar = g_object_new(XA_TYPE_NAVIGATION_BAR, NULL);
+
+	if(store)
+		xa_navigation_bar_set_store(bar, store);
+
+	return GTK_WIDGET(bar);
+}
+
+static void
+cb_xa_navigation_bar_pwd_changed(XAArchiveStore *store, XANavigationBar *bar)
+{
+	g_print("PWD: %s\n", xa_archive_store_get_pwd(store));
+}
+

Added: xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h	                        (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h	2006-10-09 22:12:27 UTC (rev 23333)
@@ -0,0 +1,63 @@
+/*
+ *  Copyright (c) 2006 Stephan Arts <psybsd at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XARCHIVER_NAVIGATION_BAR_H__
+#define __XARCHIVER_NAVIGATION_BAR_H__
+G_BEGIN_DECLS
+
+#define XA_TYPE_NAVIGATION_BAR xa_navigation_bar_get_type()
+
+#define XA_NAVIGATION_BAR(obj)(                \
+		G_TYPE_CHECK_INSTANCE_CAST ((obj),  \
+			XA_TYPE_NAVIGATION_BAR,                  \
+			XANavigationBar))
+
+#define XA_IS_NAVIGATION_BAR(obj)      ( \
+		G_TYPE_CHECK_INSTANCE_TYPE ((obj),    \
+			XA_TYPE_NAVIGATION_BAR))
+
+#define XA_NAVIGATION_BAR_CLASS(klass) ( \
+		G_TYPE_CHECK_CLASS_CAST ((klass),     \
+			XA_TYPE_NAVIGATION_BAR,      \
+			XANavigationBarClass))
+
+#define XA_IS_NAVIGATION_BAR_CLASS(class) ( \
+		G_TYPE_CHECK_CLASS_TYPE ((class),        \
+			XA_TYPE_NAVIGATION_BAR()))	
+
+typedef struct _XANavigationBar XANavigationBar;
+
+struct _XANavigationBar
+{
+	GtkToolbar parent;
+	XAArchiveStore *store;
+};
+
+typedef struct _XANavigationBarClass XANavigationBarClass;
+
+struct _XANavigationBarClass
+{
+	GtkToolbarClass parent_class;
+};
+
+GType      xa_navigation_bar_get_type();
+GtkWidget *xa_navigation_bar_new();
+void xa_navigation_bar_set_store(XANavigationBar *navigation_bar, XAArchiveStore *store);
+
+G_END_DECLS
+#endif /* __XARCHIVER_EXTRACT_ARCHIVE_DIALOG_H__ */

Modified: xarchiver/branches/xarchiver-psybsd/src/path_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/path_bar.c	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/path_bar.c	2006-10-09 22:12:27 UTC (rev 23333)
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 #include <libxarchiver/libxarchiver.h>
 #include "archive_store.h"
+#include "navigation_bar.h"
 #include "path_bar.h"
 
 
@@ -32,7 +33,7 @@
 xa_path_bar_init(XAPathBar *archive);
 
 static void
-cb_xa_path_bar_pwd_changed(XAArchiveStore *store, gchar *pwd, XAPathBar *bar);
+cb_xa_path_bar_pwd_changed(XAArchiveStore *store, XAPathBar *bar);
 
 GType
 xa_path_bar_get_type ()
@@ -55,38 +56,31 @@
 			NULL
 		};
 
-		xa_path_bar_type = g_type_register_static (GTK_TYPE_TOOLBAR, "XAPathBar", &xa_path_bar_info, 0);
+		xa_path_bar_type = g_type_register_static (XA_TYPE_NAVIGATION_BAR, "XAPathBar", &xa_path_bar_info, 0);
 	}
 	return xa_path_bar_type;
 }
 
 static void
-xa_path_bar_class_init(XAPathBarClass *dialog_class)
+xa_path_bar_class_init(XAPathBarClass *path_bar_class)
 {
 }
 
 static void
-xa_path_bar_init(XAPathBar *dialog)
+xa_path_bar_init(XAPathBar *path_bar)
 {
 }
 
-GtkWidget *
+XANavigationBar *
 xa_path_bar_new(XAArchiveStore *store)
 {
-	XAPathBar *bar;
+	XANavigationBar *bar;
 
 	bar = g_object_new(XA_TYPE_PATH_BAR, NULL);
 
-	bar->store = store;
-	if(XA_IS_ARCHIVE_STORE(store))
-		g_signal_connect(G_OBJECT(store), "xa_pwd_changed", (GCallback)cb_xa_path_bar_pwd_changed, bar);
+	if(store)
+		xa_navigation_bar_set_store(XA_NAVIGATION_BAR(bar), store);
 
-	return GTK_WIDGET(bar);
+	return bar;
 }
 
-static void
-cb_xa_path_bar_pwd_changed(XAArchiveStore *store, gchar *pwd, XAPathBar *bar)
-{
-	g_print("PWD: %s\n", pwd);
-}
-

Modified: xarchiver/branches/xarchiver-psybsd/src/path_bar.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/path_bar.h	2006-10-09 21:38:10 UTC (rev 23332)
+++ xarchiver/branches/xarchiver-psybsd/src/path_bar.h	2006-10-09 22:12:27 UTC (rev 23333)
@@ -44,19 +44,18 @@
 
 struct _XAPathBar
 {
-	GtkToolbar parent;
-	XAArchiveStore *store;
+	XANavigationBar parent;
 };
 
 typedef struct _XAPathBarClass XAPathBarClass;
 
 struct _XAPathBarClass
 {
-	GtkToolbarClass parent_class;
+	XANavigationBarClass parent_class;
 };
 
 GType      xa_path_bar_get_type();
-GtkWidget *xa_path_bar_new();
+XANavigationBar *xa_path_bar_new();
 
 G_END_DECLS
 #endif /* __XARCHIVER_EXTRACT_ARCHIVE_DIALOG_H__ */



More information about the Xfce4-commits mailing list