[nautilus-actions] Create nact-main.c dedicated to main() function



commit e39513d897e656cbf79d8af795562ca2960cd1d1
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Jun 11 18:24:26 2009 +0200

    Create nact-main.c dedicated to main() function

 ChangeLog            |   11 ++++++++
 src/nact/Makefile.am |    1 +
 src/nact/nact-main.c |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/nact/nact.c      |   21 +++++++++-------
 src/nact/nact.h      |    2 +
 5 files changed, 91 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a901d43..e1416bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-06-11 Pierre Wieser <pwieser trychlos org>
+
+	* src/nact/nact.c:
+	* src/nact/nact.h:
+	Externalize main function in nact-main.c.
+	init_dialog becomes public as nact_init_dialog.
+
+	* src/nact/nact-main.c: New file.
+
+	* src/nact/Makefile.am: Updated accordingly.
+
 2009-06-10 Pierre Wieser <pwieser trychlos org>
 
 	* configure.ac:
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index a01e716..de95932 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -41,6 +41,7 @@ AM_CPPFLAGS += \
 nautilus_actions_config_SOURCES = \
 	nact.c												\
 	nact.h												\
+	nact-main.c											\
 	nact-utils.c										\
 	nact-utils.h										\
 	nact-prefs.c										\
diff --git a/src/nact/nact-main.c b/src/nact/nact-main.c
new file mode 100644
index 0000000..cb71fd8
--- /dev/null
+++ b/src/nact/nact-main.c
@@ -0,0 +1,65 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include <common/nautilus-actions-config-gconf-writer.h>
+
+#include "nact.h"
+
+int
+main( int argc, char *argv[] )
+{
+	/* initialize application */
+#ifdef ENABLE_NLS
+        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+# endif
+        textdomain (GETTEXT_PACKAGE);
+#endif
+
+	gtk_init (&argc, &argv);
+
+	g_set_application_name (PACKAGE);
+	gtk_window_set_default_icon_name (PACKAGE);
+
+	/* create main dialog */
+	nact_init_dialog ();
+
+	/* run the application */
+	gtk_main ();
+	return 0;
+}
diff --git a/src/nact/nact.c b/src/nact/nact.c
index 9902c0f..09bbb68 100644
--- a/src/nact/nact.c
+++ b/src/nact/nact.c
@@ -357,14 +357,17 @@ setup_actions_list (GtkWidget *list)
 
 }
 
-static void
-init_dialog (void)
+/*static */void
+nact_init_dialog (void)
 {
 	gint width, height, x, y;
 	GtkWidget *nact_dialog;
 	GtkWidget *nact_actions_list;
 	/*GtkWidget* nact_edit_button;*/
 	GtkWidget* nact_about_button;
+
+	config = nautilus_actions_config_gconf_writer_get ();
+
 	GladeXML *gui = nact_get_glade_xml_object (GLADE_MAIN_WIDGET);
 	if (!gui) {
 		g_error (_("Could not load interface for Nautilus Actions Config Tool"));
@@ -411,11 +414,11 @@ init_dialog (void)
 	g_object_unref (gui);
 }
 
-int
+/*int
 main (int argc, char *argv[])
-{
+{*/
 	/* initialize application */
-#ifdef ENABLE_NLS
+/*#ifdef ENABLE_NLS
         bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 # ifdef HAVE_BIND_TEXTDOMAIN_CODESET
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -427,12 +430,12 @@ main (int argc, char *argv[])
 
 	config = nautilus_actions_config_gconf_writer_get ();
 	g_set_application_name (PACKAGE);
-	gtk_window_set_default_icon_name (PACKAGE);
+	gtk_window_set_default_icon_name (PACKAGE);*/
 
 	/* create main dialog */
-	init_dialog ();
+	/*init_dialog ();*/
 
 	/* run the application */
-	gtk_main ();
+	/*gtk_main ();
 	return 0;
-}
+}*/
diff --git a/src/nact/nact.h b/src/nact/nact.h
index 3a86a84..f5e11a2 100644
--- a/src/nact/nact.h
+++ b/src/nact/nact.h
@@ -38,4 +38,6 @@ enum {
 	N_COLUMN
 };
 
+void nact_init_dialog( void );
+
 #endif /* __NACT_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]