diff options
Diffstat (limited to 'mate-dictionary/src/gdict-app.c')
-rw-r--r-- | mate-dictionary/src/gdict-app.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/mate-dictionary/src/gdict-app.c b/mate-dictionary/src/gdict-app.c index a8b79b38..fe5e5b32 100644 --- a/mate-dictionary/src/gdict-app.c +++ b/mate-dictionary/src/gdict-app.c @@ -55,12 +55,12 @@ static void gdict_app_finalize (GObject *object) { GdictApp *app = GDICT_APP (object); - + if (app->loader) g_object_unref (app->loader); - + app->current_window = NULL; - + g_slist_free_full (app->windows, (GDestroyNotify) gtk_widget_destroy); g_slist_free_full (app->lookup_words, g_free); g_slist_free_full (app->match_words, g_free); @@ -75,7 +75,7 @@ static void gdict_app_class_init (GdictAppClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->finalize = gdict_app_finalize; } @@ -92,16 +92,16 @@ gdict_window_destroy_cb (GtkWidget *widget, { GdictWindow *window = GDICT_WINDOW (widget); GdictApp *app = GDICT_APP (user_data); - + g_assert (GDICT_IS_APP (app)); app->windows = g_slist_remove (app->windows, window); - + if (window == app->current_window) app->current_window = app->windows ? app->windows->data : NULL; - + if (app->windows == NULL) - gtk_main_quit (); + gtk_main_quit (); } static void @@ -110,7 +110,7 @@ gdict_window_created_cb (GdictWindow *parent, gpointer user_data) { GdictApp *app = GDICT_APP (user_data); - + /* this might seem convoluted - but it's necessary, since I don't want * GdictWindow to know about the GdictApp singleton. every time a new * window is created by a GdictWindow, it will register its "child window" @@ -125,7 +125,7 @@ gdict_window_created_cb (GdictWindow *parent, if (gtk_window_get_group (GTK_WINDOW (parent))) gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (parent)), GTK_WINDOW (new_window)); - + app->windows = g_slist_prepend (app->windows, new_window); app->current_window = new_window; } @@ -147,15 +147,15 @@ gdict_create_window (GdictApp *app) G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); - + gtk_widget_show (window); return; } - + for (l = singleton->lookup_words; l != NULL; l = l->next) { gchar *word = l->data; @@ -165,15 +165,15 @@ gdict_create_window (GdictApp *app) singleton->loader, singleton->source_name, word); - + g_signal_connect (window, "created", G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); - + gtk_widget_show (window); } @@ -186,12 +186,12 @@ gdict_create_window (GdictApp *app) singleton->loader, singleton->source_name, word); - + g_signal_connect (window, "created", G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); @@ -244,7 +244,7 @@ gdict_look_up_word_and_quit (GdictApp *app) GdictSource *source; GdictContext *context; GSList *l; - + if (!app->lookup_words) { g_print (_("See mate-dictionary --help for usage\n")); @@ -336,15 +336,15 @@ gdict_init (int *argc, char ***argv) N_("Words to look up"), N_("word") }, { NULL }, }; - - g_assert (singleton == NULL); - + + g_assert (singleton == NULL); + singleton = GDICT_APP (g_object_new (GDICT_TYPE_APP, NULL)); g_assert (GDICT_IS_APP (singleton)); - + /* create the new option context */ context = g_option_context_new (_(" - Look up words in dictionaries")); - + g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, gdict_app_goptions, GETTEXT_PACKAGE); g_option_context_add_group (context, gdict_get_option_group ()); @@ -360,10 +360,10 @@ gdict_init (int *argc, char ***argv) exit (1); } - + g_set_application_name (_("Dictionary")); gtk_window_set_default_icon_name ("accessories-dictionary"); - + if (!gdict_create_data_dir ()) { gdict_cleanup (); @@ -373,9 +373,9 @@ gdict_init (int *argc, char ***argv) singleton->settings = g_settings_new ("org.mate.dictionary"); - /* add user's path for fetching dictionary sources */ + /* add user's path for fetching dictionary sources */ singleton->loader = gdict_source_loader_new (); - loader_path = gdict_get_data_dir (); + loader_path = gdict_get_data_dir (); gdict_source_loader_add_search_path (singleton->loader, loader_path); g_free (loader_path); @@ -401,7 +401,7 @@ gdict_init (int *argc, char ***argv) if (database) singleton->database = g_strdup (database); - + if (source_name) singleton->source_name = g_strdup (source_name); @@ -417,12 +417,12 @@ gdict_main (void) g_warning ("You must initialize GdictApp using gdict_init()\n"); return; } - + if (!singleton->no_window) gdict_create_window (singleton); else gdict_look_up_word_and_quit (singleton); - + gtk_main (); } |