[Goodies-commits] r3978 - xfbib/trunk/src

Jesper Karlsson zarper at xfce.org
Thu Feb 21 22:15:10 CET 2008


Author: zarper
Date: 2008-02-21 21:15:10 +0000 (Thu, 21 Feb 2008)
New Revision: 3978

Added:
   xfbib/trunk/src/open.c
   xfbib/trunk/src/open.h
Modified:
   xfbib/trunk/src/Makefile.am
   xfbib/trunk/src/entry_edit_dialog.c
   xfbib/trunk/src/open_dialog.c
   xfbib/trunk/src/xfbib.c
Log:
Xfbib: You can now open a file directly when starting Xfbib.
Some bug squashing.

Modified: xfbib/trunk/src/Makefile.am
===================================================================
--- xfbib/trunk/src/Makefile.am	2008-02-21 10:02:32 UTC (rev 3977)
+++ xfbib/trunk/src/Makefile.am	2008-02-21 21:15:10 UTC (rev 3978)
@@ -18,6 +18,7 @@
 	save_dialog.c save_dialog.h \
 	about_dialog.c about_dialog.h \
 	open_dialog.c open_dialog.h \
+	open.c open.h \
 	entry_edit_dialog.c entry_edit_dialog.h \
 	string_edit_dialog.c string_edit_dialog.h \
 	strings.c strings.h \

Modified: xfbib/trunk/src/entry_edit_dialog.c
===================================================================
--- xfbib/trunk/src/entry_edit_dialog.c	2008-02-21 10:02:32 UTC (rev 3977)
+++ xfbib/trunk/src/entry_edit_dialog.c	2008-02-21 21:15:10 UTC (rev 3978)
@@ -314,9 +314,7 @@
 	_("Number of the volume"), 
 	_("Year of publication or creation if unpublished")};
 	
-	
 	xfce_textdomain (PACKAGE, LOCALEDIR, "ISO-8859-1");
-	gtk_window_set_icon_name(GTK_WINDOW(dialog), "xfbib");
 
 	dialog = xfce_titled_dialog_new_with_buttons ((selected == NULL) ? _("Add entry") : _("Edit entry"), NULL,
 						GTK_DIALOG_MODAL,
@@ -324,9 +322,11 @@
 						GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 						NULL);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+	
+	gtk_window_set_icon_name(GTK_WINDOW(dialog), "xfbib");
 
 	hbox = create_hbox(&combobox, &key_entry, edit_entry);
-	
+
 	for (i = 0; i < 4; i++)
 		vbox[i] = gtk_vbox_new(FALSE, 10);
 
@@ -377,7 +377,7 @@
 		} else
 			_DEBUG(("Type equals -1"));
 	}
-	
+
 	while ( TRUE ) {
 		if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
 			_DEBUG(("Response OK"));

Added: xfbib/trunk/src/open.c
===================================================================
--- xfbib/trunk/src/open.c	                        (rev 0)
+++ xfbib/trunk/src/open.c	2008-02-21 21:15:10 UTC (rev 3978)
@@ -0,0 +1,34 @@
+/*
+ *  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 <libxfcegui4/libxfcegui4.h>
+#include <config.h>
+
+#include "xfbib.h"
+#include "parser_interface.h"
+#include "treeview.h"
+#include "open.h"
+#include "debug.h"
+#include "window.h"
+
+int open_file (char *filename, struct xfbib *xfbib)
+{
+	xfbib->filename = filename;
+	parse_file(xfbib);
+	update_treeview(xfbib);
+	_DEBUG(("Opening: %s", xfbib->filename));
+	gtk_window_set_title(GTK_WINDOW(xfbib->window.window), create_title(xfbib));
+}
\ No newline at end of file

Added: xfbib/trunk/src/open.h
===================================================================
--- xfbib/trunk/src/open.h	                        (rev 0)
+++ xfbib/trunk/src/open.h	2008-02-21 21:15:10 UTC (rev 3978)
@@ -0,0 +1,8 @@
+#ifndef OPEN_H_
+#define OPEN_H_
+
+#include "xfbib.h"
+
+int open_file (char *filename, struct xfbib *xfbib);
+
+#endif /*OPEN_H_*/

Modified: xfbib/trunk/src/open_dialog.c
===================================================================
--- xfbib/trunk/src/open_dialog.c	2008-02-21 10:02:32 UTC (rev 3977)
+++ xfbib/trunk/src/open_dialog.c	2008-02-21 21:15:10 UTC (rev 3978)
@@ -27,6 +27,7 @@
 #include "xfbib.h"
 #include "window.h"
 #include "debug.h"
+#include "open.h"
 
 void show_open_dialog(struct xfbib *xfbib)
 {
@@ -53,11 +54,7 @@
 	if(gtk_dialog_run(GTK_DIALOG(open)) == GTK_RESPONSE_ACCEPT) {
 		free_list(xfbib->list);
 		xfbib->list = NULL;
-		xfbib->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(open));
-		parse_file(xfbib);
-		update_treeview(xfbib);
-		_DEBUG(("Opening: %s", xfbib->filename));
-		gtk_window_set_title(GTK_WINDOW(xfbib->window.window), create_title(xfbib));
+		open_file(gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(open)), xfbib);
 	}
 	gtk_widget_destroy(open);
 }

Modified: xfbib/trunk/src/xfbib.c
===================================================================
--- xfbib/trunk/src/xfbib.c	2008-02-21 10:02:32 UTC (rev 3977)
+++ xfbib/trunk/src/xfbib.c	2008-02-21 21:15:10 UTC (rev 3978)
@@ -27,6 +27,9 @@
 #include "entry.h"
 #include "debug.h"
 #include "xfbib.h"
+#include "parser_interface.h"
+#include "treeview.h"
+#include "open.h"
 
 int main(int argc, char **argv)
 {
@@ -47,8 +50,13 @@
 
 	xfbib.window.window = create_window(&xfbib);
 	
+	if (argc > 1) {
+		_DEBUG(("Argv: %s", argv[1]));
+		open_file(argv[1], &xfbib);
+	}
+	
 	gtk_widget_show_all(xfbib.window.window);
-
+	
 	gtk_main();
 
 	return EXIT_SUCCESS;




More information about the Goodies-commits mailing list