~ubuntu-branches/ubuntu/raring/almanah/raring-proposed

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2011-04-18 16:21:36 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110418162136-l0ik4snrl420srer
Tags: 0.8.0-1
* New upstream release
* Temporarily remove evolution support in unstable
* Disable AM_GCONF_SOURCE_2 macro to fix ftbfs in unstable
  - debian/patches/disable_am_gconf_source_2
  - Build-Depends on dh-autoreconf
  - Use --with autoreconf in rules
* debian/control:
  - Build-Depends on libgtk-3-dev
* debian/rules:
  - Remove unnecessary override_dh_auto_install
* debian/copyright:
  - Update copyright years
  - Update license stanza
* Bump Standards-Version to 3.9.1 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <stdlib.h>
22
22
#include <gtk/gtk.h>
23
23
#include <glib/gi18n.h>
24
 
#include <gconf/gconf.h>
 
24
#include <gio/gio.h>
25
25
 
26
26
#include "main.h"
27
27
#include "storage-manager.h"
49
49
        }
50
50
 
51
51
        g_object_unref (almanah->storage_manager);
52
 
        g_object_unref (almanah->gconf_client);
 
52
        g_object_unref (almanah->settings);
53
53
        g_object_unref (almanah->page_setup);
54
54
        g_object_unref (almanah->print_settings);
55
55
 
61
61
        exit (0);
62
62
}
63
63
 
 
64
gboolean
 
65
almanah_run_on_screen (GdkScreen *screen, const gchar *commandline, GError **error)
 
66
{
 
67
        gboolean retval;
 
68
        GAppInfo *appinfo;
 
69
        GdkAppLaunchContext *context;
 
70
 
 
71
        appinfo = g_app_info_create_from_commandline (commandline,
 
72
                                                "Almanah Execute",
 
73
                                                G_APP_INFO_CREATE_NONE,
 
74
                                                error);
 
75
 
 
76
        if (!appinfo)
 
77
                return FALSE;
 
78
 
 
79
        context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
 
80
        gdk_app_launch_context_set_screen (context, screen);
 
81
 
 
82
        retval = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
 
83
 
 
84
        g_object_unref (context);
 
85
        g_object_unref (appinfo);
 
86
 
 
87
        return retval;
 
88
}
 
89
 
64
90
void
65
91
almanah_quit (void)
66
92
{
73
99
                gtk_widget_destroy (almanah->search_dialog);
74
100
        if (almanah->date_entry_dialog != NULL)
75
101
                gtk_widget_destroy (almanah->date_entry_dialog);
76
 
        if (almanah->import_dialog != NULL)
77
 
                gtk_widget_destroy (almanah->import_dialog);
78
102
#ifdef ENABLE_ENCRYPTION
79
103
        if (almanah->preferences_dialog != NULL)
80
104
                gtk_widget_destroy (almanah->preferences_dialog);
94
118
{
95
119
        GOptionContext *context;
96
120
        GError *error = NULL;
97
 
        gboolean debug = FALSE, import_mode = FALSE;
 
121
        gboolean debug = FALSE;
98
122
        gchar *db_filename;
99
123
 
100
124
        const GOptionEntry options[] = {
101
125
                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug mode"), NULL },
102
 
                { "import-mode", 0, 0, G_OPTION_ARG_NONE, &import_mode, N_("Enable import mode"), NULL },
103
126
                { NULL }
104
127
        };
105
128
 
109
132
        textdomain (GETTEXT_PACKAGE);
110
133
#endif
111
134
 
112
 
        gtk_set_locale ();
 
135
        g_thread_init (NULL);
113
136
        gtk_init (&argc, &argv);
114
137
        g_set_application_name (_("Almanah Diary"));
115
138
        gtk_window_set_default_icon_name ("almanah");
139
162
        /* Setup */
140
163
        almanah = g_new0 (Almanah, 1);
141
164
        almanah->debug = debug;
142
 
        almanah->import_mode = import_mode;
143
165
 
144
 
        /* Open GConf */
145
 
        almanah->gconf_client = gconf_client_get_default ();
146
 
        gconf_client_add_dir (almanah->gconf_client, "/apps/almanah", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
166
        /* Open GSettings */
 
167
        almanah->settings = g_settings_new ("org.gnome.almanah");
147
168
 
148
169
        /* Ensure the DB directory exists */
149
170
        if (g_file_test (g_get_user_data_dir (), G_FILE_TEST_IS_DIR) == FALSE)