int main (int argc, char *argv[]) { int status; program_argv0 = argv[0]; /* text domain */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* run the main application */ Main_Application = gth_application_new (); status = g_application_run (G_APPLICATION (Main_Application), argc, argv); gth_main_release (); gth_pref_release (); g_object_unref (Main_Application); /* restart if requested by the user */ if (Restart) g_spawn_command_line_async (program_argv0, NULL); return status; }
/* Create the windows. */ static void prepare_app (void) { CORBA_Object factory; gboolean use_factory = FALSE; CORBA_Environment env; GNOME_GThumb_Application app; GList *scan; factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application_Factory", Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, NULL); if (factory != NULL) { use_factory = TRUE; CORBA_exception_init (&env); app = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application", 0, NULL, &env); } if (session_is_restored ()) { load_session (use_factory, app, &env); return; } if (ImportPhotos) { if (use_factory) GNOME_GThumb_Application_import_photos (app, &env); else gth_browser_activate_action_file_camera_import (NULL, NULL); } else if (! view_comline_catalog && (n_dir_urls == 0) && (n_file_urls == 0)) { open_browser_window (NULL, TRUE, use_factory, app, &env); } else if (view_single_image) { if (use_factory && eel_gconf_get_boolean (PREF_SINGLE_WINDOW, FALSE)) { GNOME_GThumb_Application_load_image (app, file_urls->data, &env); } else { if (UseViewer) open_viewer_window (file_urls->data, use_factory, app, &env); else open_browser_window (file_urls->data, TRUE, use_factory, app, &env); } } else if (view_comline_catalog) { char *catalog_path; char *catalog_uri; ViewFirstImage = TRUE; HideSidebar = TRUE; catalog_path = get_command_line_catalog_path (); catalog_uri = g_strconcat ("catalog://", remove_host_from_uri (catalog_path), NULL); open_browser_window (catalog_uri, TRUE, use_factory, app, &env); g_free (catalog_path); g_free (catalog_uri); } for (scan = dir_urls; scan; scan = scan->next) { /* Go to the specified directory. */ open_browser_window (scan->data, TRUE, use_factory, app, &env); } path_list_free (file_urls); path_list_free (dir_urls); /**/ if (use_factory) { bonobo_object_release_unref (app, &env); CORBA_exception_free (&env); gdk_notify_startup_complete (); exit (0); } else gth_application = gth_application_new (gdk_screen_get_default ()); }