[Cxplorer-cvs 00987] CVS update: cxplorer/src

Back to archive index

Yasumichi Akahoshi yasum****@users*****
2005年 4月 9日 (土) 02:01:40 JST


Index: cxplorer/src/Makefile.am
diff -u cxplorer/src/Makefile.am:1.16 cxplorer/src/Makefile.am:1.17
--- cxplorer/src/Makefile.am:1.16	Wed Apr  6 01:01:59 2005
+++ cxplorer/src/Makefile.am	Sat Apr  9 02:01:39 2005
@@ -15,14 +15,6 @@
 
 cxplorer_SOURCES = \
 	main.c\
-	interface.h\
-	interface.c\
-	menubar.c\
-	menubar.h\
-	toolbar.h\
-	toolbar.c\
-	actcalls.c\
-	actcalls.h\
 	cxplorer.h\
 	cxplorer.c\
 	cxp-property-dialog.c\
@@ -30,7 +22,9 @@
 	cxp-dir-view.h\
 	cxp-dir-view.c \
 	cxp-right-pane.h \
-	cxp-right-pane.c
+	cxp-right-pane.c \
+	cxplorer-window.h \
+	cxplorer-window.c
 
 cxplorer_LDFLAGS = 
 
Index: cxplorer/src/Makefile.in
diff -u cxplorer/src/Makefile.in:1.20 cxplorer/src/Makefile.in:1.21
--- cxplorer/src/Makefile.in:1.20	Wed Apr  6 01:01:59 2005
+++ cxplorer/src/Makefile.in	Sat Apr  9 02:01:40 2005
@@ -143,7 +143,7 @@
 
 bin_PROGRAMS = cxplorer
 
-cxplorer_SOURCES =  	main.c 	interface.h 	interface.c 	menubar.c 	menubar.h 	toolbar.h 	toolbar.c 	actcalls.c 	actcalls.h 	cxplorer.h 	cxplorer.c 	cxp-property-dialog.c 	cxp-property-dialog.h 	cxp-dir-view.h 	cxp-dir-view.c 	cxp-right-pane.h 	cxp-right-pane.c
+cxplorer_SOURCES =  	main.c 	cxplorer.h 	cxplorer.c 	cxp-property-dialog.c 	cxp-property-dialog.h 	cxp-dir-view.h 	cxp-dir-view.c 	cxp-right-pane.h 	cxp-right-pane.c 	cxplorer-window.h 	cxplorer-window.c
 
 
 cxplorer_LDFLAGS = 
@@ -161,10 +161,9 @@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
-cxplorer_OBJECTS =  main.$(OBJEXT) interface.$(OBJEXT) menubar.$(OBJEXT) \
-toolbar.$(OBJEXT) actcalls.$(OBJEXT) cxplorer.$(OBJEXT) \
+cxplorer_OBJECTS =  main.$(OBJEXT) cxplorer.$(OBJEXT) \
 cxp-property-dialog.$(OBJEXT) cxp-dir-view.$(OBJEXT) \
-cxp-right-pane.$(OBJEXT)
+cxp-right-pane.$(OBJEXT) cxplorer-window.$(OBJEXT)
 cxplorer_DEPENDENCIES = 
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -177,9 +176,9 @@
 
 TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/actcalls.P .deps/cxp-dir-view.P \
-.deps/cxp-property-dialog.P .deps/cxp-right-pane.P .deps/cxplorer.P \
-.deps/interface.P .deps/main.P .deps/menubar.P .deps/toolbar.P
+DEP_FILES =  .deps/cxp-dir-view.P .deps/cxp-property-dialog.P \
+.deps/cxp-right-pane.P .deps/cxplorer-window.P .deps/cxplorer.P \
+.deps/main.P
 SOURCES = $(cxplorer_SOURCES)
 OBJECTS = $(cxplorer_OBJECTS)
 
Index: cxplorer/src/cxp-right-pane.c
diff -u cxplorer/src/cxp-right-pane.c:1.24 cxplorer/src/cxp-right-pane.c:1.25
--- cxplorer/src/cxp-right-pane.c:1.24	Fri Apr  8 01:53:09 2005
+++ cxplorer/src/cxp-right-pane.c	Sat Apr  9 02:01:40 2005
@@ -1,4 +1,5 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
Index: cxplorer/src/cxplorer-window.c
diff -u cxplorer/src/cxplorer-window.c:1.3 cxplorer/src/cxplorer-window.c:1.4
--- cxplorer/src/cxplorer-window.c:1.3	Fri Apr  8 01:53:09 2005
+++ cxplorer/src/cxplorer-window.c	Sat Apr  9 02:01:40 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *            cxplorer-entry-dialog.c
+ *            cxplorer-window.c
  *
  *  Sun Feb 13 23:50:30 2005
  *  Copyright  2005  Yasumichi Akahoshi
@@ -21,7 +21,11 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <cxp.h>
 #include <glib/gi18n.h>
@@ -37,6 +41,10 @@
 
 typedef struct
 {
+	GtkActionGroup *action_group;
+	GtkUIManager *ui_manager;
+	GtkWidget *menubar;
+	GtkWidget *toolbar;
 	GtkWidget *entry;
 	GtkWidget *dirview;
 	GtkWidget *right_pane;
@@ -54,17 +62,58 @@
  * Prototypes of private methods.
  */
 static void cxplorer_window_class_init (gpointer g_class,
-					    gpointer g_class_data);
+					gpointer g_class_data);
 static void cxplorer_window_instance_init (GTypeInstance * instance,
-					       gpointer g_class);
+					   gpointer g_class);
 static void cxplorer_window_dispose (GObject * obj);
 static void cxplorer_window_finalize (GObject * obj);
-static void cxplorer_window_on_directory_changed (CxpDirView *dirview, gpointer user_data);
-static void cxplorer_window_on_dir_double_clicked (CxpRightPane *right_pane, gpointer user_data);
+static void cxplorer_window_on_directory_changed (CxpDirView * dirview,
+						  gpointer user_data);
+static void cxplorer_window_on_dir_double_clicked (CxpRightPane * right_pane,
+						   gpointer user_data);
+
+/**
+ * Actions
+ */
+GtkActionEntry actions[] = {
+	/* name, stock-id, label, accelerator, tooltip, callback */
+	/* File menu */
+	{"FileMenuAction", NULL, N_("_File"), NULL, NULL, NULL},
+	{"NewMenuAction", NULL, N_("_New"), NULL, NULL, NULL},
+	{"NewWinAction", NULL, N_("_Window"), NULL, NULL, NULL},
+	{"NewFileAction", "gtk-new", N_("_File..."), NULL, NULL, NULL},
+	{"NewDirAction", NULL, N_("_Directory..."), NULL, NULL, NULL},
+	{"DeleteAction", "gtk-delete", N_("_Delete"), NULL, NULL, NULL},
+	{"RenameAction", NULL, N_("_Rename..."), NULL, NULL, NULL},
+	{"SendAction", NULL, N_("_Send to"), NULL, NULL, NULL},
+	{"MailAction", NULL, N_("_Mail"), NULL, NULL, NULL},
+	{"PropAction", "gtk-properties", N_("_Property"), NULL, NULL, NULL},
+	{"QuitAction", "gtk-quit", N_("_Quit"), NULL, NULL, NULL},
+	/* Edit menu */
+	{"EditAction", NULL, N_("_Edit"), NULL, NULL, NULL},
+	{"CopyAction", "gtk-copy", N_("_Copy"), NULL, NULL, NULL},
+	{"PasteAction", "gtk-paste", N_("_Paste"), NULL, NULL, NULL},
+	{"PrefAction", "gtk-preferences", N_("_Preferences"), NULL, NULL, NULL},
+	/* View menu */
+	{"ViewAction", NULL, N_("_View"), NULL, NULL, NULL},
+	{"DotFileAct", NULL, N_("_Show dot file"), NULL, NULL, NULL},
+	{"RefreshAct", "gtk-refresh", N_("_Refresh"), NULL, NULL, NULL},
+	/* Move menu */
+	{"GoAction", NULL, N_("_Go"), NULL, NULL, NULL},
+	{"UpAction", "gtk-go-up", N_("_Up"), NULL, NULL, NULL},
+	{"HomeAct", "gtk-home", N_("_Home"), NULL, NULL, NULL},
+	{"BookmarkAct", NULL, N_("_Bookmark..."), NULL, NULL, NULL},
+	/* Help menu */
+	{"HelpAction", NULL, N_("_Help"), NULL, NULL, NULL},
+	{"AboutAction", NULL, N_("_About"), NULL, NULL, NULL}
+};
 
+const gint actions_count = G_N_ELEMENTS(actions);
 
-static void cxplorer_window_class_init (gpointer g_class,
-					    gpointer g_class_data)
+/**
+ * Class init
+ */
+static void cxplorer_window_class_init (gpointer g_class, gpointer g_class_data)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
 	CxplorerWindowClass *klass = CXPLORER_WINDOW_CLASS (g_class);
@@ -78,10 +127,12 @@
 }
 
 static void cxplorer_window_instance_init (GTypeInstance * instance,
-					       gpointer g_class)
+					   gpointer g_class)
 {
 	CxplorerWindow *self = CXPLORER_WINDOW (instance);
-	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE(instance);
+	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (instance);
+	GtkWidget *menubar;
+	GtkWidget *toolbar;
 	GtkWidget *vbox;
 	GtkWidget *hpaned;
 	GtkWidget *hbox;
@@ -94,10 +145,29 @@
 
 	private->profile = cxp_profile_new ("cxplorer", "main");
 
-	g_object_set (G_OBJECT(self), "type", GTK_WINDOW_TOPLEVEL, NULL);
+	//g_object_set (G_OBJECT(self), "type", GTK_WINDOW_TOPLEVEL, NULL);
+
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (self), vbox);
 
-	vbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add (GTK_CONTAINER(self), vbox);
+	private->action_group = gtk_action_group_new ("Cxplorer");
+	gtk_action_group_add_actions (private->action_group, actions, actions_count, NULL);
+	private->ui_manager = gtk_ui_manager_new ();
+	gtk_ui_manager_insert_action_group (private->ui_manager,
+					    private->action_group, 0);
+
+	gtk_ui_manager_add_ui_from_file (private->ui_manager,
+					 PACKAGE_DATA_DIR"/cxplorer-ui.xml",
+					 NULL);
+
+	menubar =
+		gtk_ui_manager_get_widget (private->ui_manager, "/menubar");
+	gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
+	gtk_widget_show (menubar);
+
+	toolbar = gtk_ui_manager_get_widget (private->ui_manager, "/toolbar");
+	gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
+	gtk_widget_show (toolbar);
 
 	hbox = gtk_hbox_new (FALSE, 5);
 	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
@@ -109,29 +179,34 @@
 	gtk_widget_show (entry);
 	gtk_widget_show (hbox);
 
-	hpaned = gtk_hpaned_new();
-	gtk_box_pack_start_defaults (GTK_BOX(vbox), hpaned);
+	hpaned = gtk_hpaned_new ();
+	gtk_box_pack_start_defaults (GTK_BOX (vbox), hpaned);
 
-	dirview = cxp_dir_view_new(FALSE, NULL);
-	gtk_paned_pack1 (GTK_PANED(hpaned), dirview, FALSE, FALSE);
+	dirview = cxp_dir_view_new (FALSE, NULL);
+	gtk_paned_pack1 (GTK_PANED (hpaned), dirview, FALSE, FALSE);
 	gtk_widget_show (dirview);
 
-	right_pane = cxp_right_pane_new();
-	g_object_set(right_pane, "preview_text", "head -n 20", "preview_binary", "od -t x1z -A x -N 112 --width=16", "preview_dir", "ls",NULL);
-	gtk_paned_pack2 (GTK_PANED(hpaned), right_pane, TRUE, FALSE);
+	right_pane = cxp_right_pane_new ();
+	g_object_set (right_pane, "preview_text", "head -n 20",
+		      "preview_binary", "od -t x1z -A x -N 112 --width=16",
+		      "preview_dir", "ls", NULL);
+	gtk_paned_pack2 (GTK_PANED (hpaned), right_pane, TRUE, FALSE);
 	gtk_widget_show (right_pane);
 	gtk_widget_show (hpaned);
 	statusbar = gtk_statusbar_new ();
-	gtk_box_pack_start (GTK_BOX(vbox), statusbar, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);
 	gtk_widget_show (statusbar);
 	gtk_widget_show (vbox);
 
-	current_dir = g_get_current_dir();
+	current_dir = g_get_current_dir ();
 	gtk_entry_set_text (GTK_ENTRY (entry), current_dir);
-	cxp_dir_view_change_directory (CXP_DIR_VIEW(dirview), current_dir);
-	cxp_right_pane_change_directory (CXP_RIGHT_PANE(right_pane), current_dir);
+	cxp_dir_view_change_directory (CXP_DIR_VIEW (dirview), current_dir);
+	cxp_right_pane_change_directory (CXP_RIGHT_PANE (right_pane),
+					 current_dir);
 	g_free (current_dir);
 
+	private->menubar = menubar;
+	private->toolbar = toolbar;
 	private->entry = entry;
 	private->dirview = dirview;
 	private->right_pane = right_pane;
@@ -149,7 +224,7 @@
 
 static void cxplorer_window_dispose (GObject * obj)
 {
-	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE(obj);
+	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (obj);
 
 	if (private->dispose_has_run)
 	{
@@ -166,6 +241,8 @@
 	 * reference.
 	 */
 	g_object_unref (private->profile);
+	g_object_unref (private->action_group);
+	g_object_unref (private->ui_manager);
 
 	/* Chain up to the parent class */
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
@@ -195,19 +272,18 @@
 			cxplorer_window_instance_init	/* instance_init */
 		};
 		type = g_type_register_static (GTK_TYPE_WINDOW,
-					       "CxplorerWindowType",
-					       &info, 0);
+					       "CxplorerWindowType", &info, 0);
 	}
 	return type;
 }
 
-GtkWidget *cxplorer_window_new(void)
+GtkWidget *cxplorer_window_new (void)
 {
 	GtkWidget *window;
 
-	window = GTK_WIDGET(g_object_new(CXPLORER_TYPE_WINDOW, NULL));
+	window = GTK_WIDGET (g_object_new (CXPLORER_TYPE_WINDOW, NULL));
 
-	return	window;
+	return window;
 }
 
 /**
@@ -216,11 +292,13 @@
  * @param treeview [in] Pointer to directory view.
  * @param user_data [in] Pointer to instance of Cxplorer is casted.
  */
-static void cxplorer_window_on_directory_changed (CxpDirView *dirview, gpointer user_data)
+static void cxplorer_window_on_directory_changed (CxpDirView * dirview,
+						  gpointer user_data)
 {
-	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE(user_data);
+	CxplorerWindowPrivate *private =
+		CXPLORER_WINDOW_GET_PRIVATE (user_data);
 	gchar *fullpath;
-	
+
 	fullpath = cxp_dir_view_get_current_directory (dirview);
 	gtk_entry_set_text (GTK_ENTRY (private->entry), fullpath);
 	cxp_right_pane_change_directory (CXP_RIGHT_PANE (private->right_pane),
@@ -228,14 +306,16 @@
 	g_free (fullpath);
 }
 
-static void cxplorer_window_on_dir_double_clicked (CxpRightPane *right_pane, gpointer user_data)
+static void cxplorer_window_on_dir_double_clicked (CxpRightPane * right_pane,
+						   gpointer user_data)
 {
-	CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE(user_data);
+	CxplorerWindowPrivate *private =
+		CXPLORER_WINDOW_GET_PRIVATE (user_data);
 	gchar *dir_name;
 
 	dir_name = cxp_right_pane_get_active_file_name (right_pane);
-	cxp_dir_view_change_directory (CXP_DIR_VIEW(private->dirview), dir_name);
+	cxp_dir_view_change_directory (CXP_DIR_VIEW (private->dirview),
+				       dir_name);
 	gtk_entry_set_text (GTK_ENTRY (private->entry), dir_name);
 	g_free (dir_name);
 }
-


Cxplorer-cvs メーリングリストの案内
Back to archive index