[almanah] core: Move the remaining function from main.c into interface.c



commit 37ae45223aeb2395b8db9d6ce1dcfece1590095c
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Apr 18 17:37:48 2011 +0100

    core: Move the remaining function from main.c into interface.c
    
    This allows us to remove main.h.

 configure.ac                      |    2 +-
 src/Makefile.am                   |    1 -
 src/date-entry-dialog.c           |    1 -
 src/entry.c                       |    1 -
 src/event-manager.c               |    1 -
 src/event.c                       |    1 -
 src/events/calendar-appointment.c |    2 +-
 src/events/calendar-task.c        |    2 +-
 src/export-operation.c            |    1 -
 src/import-export-dialog.c        |    1 -
 src/import-operation.c            |    1 -
 src/interface.c                   |   28 +++++++++++++++++++++++++++-
 src/interface.h                   |    1 +
 src/main-window.c                 |    1 -
 src/main.c                        |   32 +++-----------------------------
 src/main.h                        |   33 ---------------------------------
 src/preferences-dialog.c          |    1 -
 src/printing.c                    |    1 -
 src/search-dialog.c               |    1 -
 src/storage-manager.c             |    2 +-
 src/uri-entry-dialog.c            |    1 -
 src/widgets/calendar.c            |    1 -
 22 files changed, 35 insertions(+), 81 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d1b724e..787c000 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 AC_PREREQ(2.63)
 AC_INIT([almanah],[0.9.0],[https://bugzilla.gnome.org/enter_bug.cgi?product=almanah],[almanah],[http://live.gnome.org/Almanah_Diary])
 
-AC_CONFIG_SRCDIR([src/main.h])
+AC_CONFIG_SRCDIR([src/main.c])
 AC_CONFIG_HEADERS([config.h])
 AC_USE_SYSTEM_EXTENSIONS
 
diff --git a/src/Makefile.am b/src/Makefile.am
index cf85ddd..2f0de84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,6 @@ almanah_SOURCES = \
 	$(ALMANAH_MARSHAL_FILES)	\
 	$(ALMANAH_ENUM_FILES)		\
 	main.c				\
-	main.h				\
 	application.c			\
 	application.h			\
 	interface.c			\
diff --git a/src/date-entry-dialog.c b/src/date-entry-dialog.c
index e2a756d..8fad8f0 100644
--- a/src/date-entry-dialog.c
+++ b/src/date-entry-dialog.c
@@ -23,7 +23,6 @@
 #include <gtk/gtk.h>
 
 #include "date-entry-dialog.h"
-#include "main.h"
 #include "interface.h"
 
 static void almanah_date_entry_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
diff --git a/src/entry.c b/src/entry.c
index 4ff1fed..3ca403f 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -23,7 +23,6 @@
 #include <gtk/gtk.h>
 
 #include "entry.h"
-#include "main.h"
 #include "widgets/hyperlink-tag.h"
 
 GQuark
diff --git a/src/event-manager.c b/src/event-manager.c
index e64b3bf..ba0044a 100644
--- a/src/event-manager.c
+++ b/src/event-manager.c
@@ -33,7 +33,6 @@ typedef struct {
 #ifdef HAVE_EVO
 #include "calendar.h"
 #endif /* HAVE_EVO */
-#include "main.h"
 
 const EventFactoryType event_factory_types[] = {
 #ifdef HAVE_EVO
diff --git a/src/event.c b/src/event.c
index 7c03f54..9bc1665 100644
--- a/src/event.c
+++ b/src/event.c
@@ -23,7 +23,6 @@
 #include <string.h>
 
 #include "event.h"
-#include "main.h"
 
 static void almanah_event_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
diff --git a/src/events/calendar-appointment.c b/src/events/calendar-appointment.c
index 029182d..f8dd521 100644
--- a/src/events/calendar-appointment.c
+++ b/src/events/calendar-appointment.c
@@ -22,7 +22,7 @@
 
 #include "event.h"
 #include "calendar-appointment.h"
-#include "main.h"
+#include "interface.h"
 
 static void almanah_calendar_appointment_event_finalize (GObject *object);
 static const gchar *almanah_calendar_appointment_event_format_value (AlmanahEvent *event);
diff --git a/src/events/calendar-task.c b/src/events/calendar-task.c
index d315967..d07703b 100644
--- a/src/events/calendar-task.c
+++ b/src/events/calendar-task.c
@@ -22,7 +22,7 @@
 
 #include "event.h"
 #include "calendar-task.h"
-#include "main.h"
+#include "interface.h"
 
 static void almanah_calendar_task_event_finalize (GObject *object);
 static const gchar *almanah_calendar_task_event_format_value (AlmanahEvent *event);
diff --git a/src/export-operation.c b/src/export-operation.c
index 2f30a0b..9925e47 100644
--- a/src/export-operation.c
+++ b/src/export-operation.c
@@ -25,7 +25,6 @@
 #include "export-operation.h"
 #include "entry.h"
 #include "storage-manager.h"
-#include "main.h"
 
 typedef gboolean (*ExportFunc) (AlmanahExportOperation *self, GFile *destination, AlmanahExportProgressCallback progress_callback,
                                 gpointer progress_user_data, GCancellable *cancellable, GError **error);
diff --git a/src/import-export-dialog.c b/src/import-export-dialog.c
index cf6de22..2fcef97 100644
--- a/src/import-export-dialog.c
+++ b/src/import-export-dialog.c
@@ -26,7 +26,6 @@
 #include "import-operation.h"
 #include "export-operation.h"
 #include "interface.h"
-#include "main.h"
 #include "main-window.h"
 
 static void response_cb (GtkDialog *dialog, gint response_id, AlmanahImportExportDialog *self);
diff --git a/src/import-operation.c b/src/import-operation.c
index 2e888ff..27d3156 100644
--- a/src/import-operation.c
+++ b/src/import-operation.c
@@ -25,7 +25,6 @@
 #include "import-operation.h"
 #include "entry.h"
 #include "storage-manager.h"
-#include "main.h"
 
 typedef gboolean (*ImportFunc) (AlmanahImportOperation *self, GFile *source, AlmanahImportProgressCallback callback, gpointer user_data,
                                 GCancellable *cancellable, GError **error);
diff --git a/src/interface.c b/src/interface.c
index b77ba04..e25da32 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -21,7 +21,6 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include "main.h"
 #include "main-window.h"
 #include "search-dialog.h"
 #ifdef ENABLE_ENCRYPTION
@@ -65,3 +64,30 @@ almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect
 				    "underline", PANGO_UNDERLINE_SINGLE,
 				    NULL);
 }
+
+gboolean
+almanah_run_on_screen (GdkScreen *screen, const gchar *command_line, GError **error)
+{
+	gboolean retval;
+	GAppInfo *app_info;
+	GdkAppLaunchContext *context;
+
+	app_info = g_app_info_create_from_commandline (command_line,
+	                                               "Almanah Execute",
+	                                               G_APP_INFO_CREATE_NONE,
+	                                               error);
+
+	if (app_info == NULL) {
+		return FALSE;
+	}
+
+	context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+	gdk_app_launch_context_set_screen (context, screen);
+
+	retval = g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (context), error);
+
+	g_object_unref (context);
+	g_object_unref (app_info);
+
+	return retval;
+}
diff --git a/src/interface.h b/src/interface.h
index f08cadd..0d02179 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -27,6 +27,7 @@ G_BEGIN_DECLS
 const gchar *almanah_get_interface_filename (void);
 void almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect_events);
 void almanah_calendar_month_changed_cb (GtkCalendar *calendar, gpointer user_data);
+gboolean almanah_run_on_screen (GdkScreen *screen, const gchar *command_line, GError **error);
 
 G_END_DECLS
 
diff --git a/src/main-window.c b/src/main-window.c
index 2006d92..38d0521 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -28,7 +28,6 @@
 #endif /* ENABLE_SPELL_CHECKING */
 
 #include "main-window.h"
-#include "main.h"
 #include "interface.h"
 #include "preferences-dialog.h"
 #include "search-dialog.h"
diff --git a/src/main.c b/src/main.c
index fc2080f..ae45e13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /*
  * Almanah
- * Copyright (C) Philip Withnall 2008-2009 <philip tecnocode co uk>
+ * Copyright (C) Philip Withnall 2008, 2009, 2011 <philip tecnocode co uk>
  * 
  * Almanah is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,37 +18,11 @@
  */
 
 #include <config.h>
-#include <gtk/gtk.h>
+#include <glib.h>
+#include <gio/gio.h>
 
-#include "main.h"
 #include "application.h"
 
-gboolean
-almanah_run_on_screen (GdkScreen *screen, const gchar *commandline, GError **error)
-{
-	gboolean retval;
-	GAppInfo *appinfo;
-	GdkAppLaunchContext *context;
-
-	appinfo = g_app_info_create_from_commandline (commandline,
-                                                "Almanah Execute",
-                                                G_APP_INFO_CREATE_NONE,
-                                                error);
-
-	if (!appinfo)
-		return FALSE;
-
-	context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
-	gdk_app_launch_context_set_screen (context, screen);
-
-	retval = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
-
-	g_object_unref (context);
-	g_object_unref (appinfo);
-
-	return retval;
-}
-
 int
 main (int argc, char *argv[])
 {
diff --git a/src/preferences-dialog.c b/src/preferences-dialog.c
index 85f2023..71cdbab 100644
--- a/src/preferences-dialog.c
+++ b/src/preferences-dialog.c
@@ -32,7 +32,6 @@
 
 #include "preferences-dialog.h"
 #include "interface.h"
-#include "main.h"
 #include "main-window.h"
 
 static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
diff --git a/src/printing.c b/src/printing.c
index 8d738fe..a1ed791 100644
--- a/src/printing.c
+++ b/src/printing.c
@@ -23,7 +23,6 @@
 
 #include "storage-manager.h"
 #include "interface.h"
-#include "main.h"
 #include "printing.h"
 #include "widgets/calendar.h"
 
diff --git a/src/search-dialog.c b/src/search-dialog.c
index 7946851..002b0b2 100644
--- a/src/search-dialog.c
+++ b/src/search-dialog.c
@@ -24,7 +24,6 @@
 
 #include "search-dialog.h"
 #include "interface.h"
-#include "main.h"
 #include "main-window.h"
 
 static void sd_response_cb (GtkDialog *dialog, gint response_id, AlmanahSearchDialog *search_dialog);
diff --git a/src/storage-manager.c b/src/storage-manager.c
index 1fb648b..3d19a05 100644
--- a/src/storage-manager.c
+++ b/src/storage-manager.c
@@ -22,6 +22,7 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
+#include <gtk/gtk.h>
 #include <sqlite3.h>
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -30,7 +31,6 @@
 #include <gpgme.h>
 #endif /* ENABLE_ENCRYPTION */
 
-#include "main.h"
 #include "entry.h"
 #include "storage-manager.h"
 #include "almanah-marshal.h"
diff --git a/src/uri-entry-dialog.c b/src/uri-entry-dialog.c
index fe61f7b..77690fd 100644
--- a/src/uri-entry-dialog.c
+++ b/src/uri-entry-dialog.c
@@ -23,7 +23,6 @@
 #include <gtk/gtk.h>
 
 #include "uri-entry-dialog.h"
-#include "main.h"
 #include "interface.h"
 
 static void almanah_uri_entry_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
diff --git a/src/widgets/calendar.c b/src/widgets/calendar.c
index 986242f..1696f36 100644
--- a/src/widgets/calendar.c
+++ b/src/widgets/calendar.c
@@ -22,7 +22,6 @@
 
 #include "calendar.h"
 #include "storage-manager.h"
-#include "main.h"
 
 static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);



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