static NemoWindow * create_window (NemoApplication *application, GdkScreen *screen) { NemoWindow *window; g_return_val_if_fail (NEMO_IS_APPLICATION (application), NULL); window = g_object_new (NEMO_TYPE_WINDOW, "screen", screen, NULL); g_signal_connect_data (window, "delete_event", G_CALLBACK (nemo_window_delete_event_callback), NULL, NULL, G_CONNECT_AFTER); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); /* Do not yet show the window. It will be shown later on if it can * successfully display its initial URI. Otherwise it will be destroyed * without ever having seen the light of day. */ return window; }
static NemoWindow * nemo_main_application_create_window (NemoApplication *application, GdkScreen *screen) { NemoWindow *window; char *geometry_string; gboolean maximized; g_return_val_if_fail (NEMO_IS_APPLICATION (application), NULL); window = nemo_window_new (GTK_APPLICATION (application), screen); maximized = g_settings_get_boolean (nemo_window_state, NEMO_WINDOW_STATE_MAXIMIZED); if (maximized) { gtk_window_maximize (GTK_WINDOW (window)); } else { gtk_window_unmaximize (GTK_WINDOW (window)); } geometry_string = g_settings_get_string (nemo_window_state, NEMO_WINDOW_STATE_GEOMETRY); if (geometry_string != NULL && geometry_string[0] != 0) { /* Ignore saved window position if a window with the same * location is already showing. That way the two windows * wont appear at the exact same location on the screen. */ eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window), geometry_string, NEMO_WINDOW_MIN_WIDTH, NEMO_WINDOW_MIN_HEIGHT, TRUE); } g_free (geometry_string); nemo_undo_manager_attach (application->undo_manager, G_OBJECT (window)); DEBUG ("Creating a new navigation window"); return window; }
static gboolean check_required_directories (NemoApplication *application) { char *user_directory; char *desktop_directory; GSList *directories; gboolean ret; g_assert (NEMO_IS_APPLICATION (application)); ret = TRUE; user_directory = nemo_get_user_directory (); desktop_directory = nemo_get_desktop_directory (); directories = NULL; if (!g_file_test (user_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, user_directory); } if (!g_file_test (desktop_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, desktop_directory); } if (directories != NULL) { int failed_count; GString *directories_as_string; GSList *l; char *error_string; const char *detail_string; GtkDialog *dialog; ret = FALSE; failed_count = g_slist_length (directories); directories_as_string = g_string_new ((const char *)directories->data); for (l = directories->next; l != NULL; l = l->next) { g_string_append_printf (directories_as_string, ", %s", (const char *)l->data); } if (failed_count == 1) { error_string = g_strdup_printf (_("Nemo could not create the required folder \"%s\"."), directories_as_string->str); detail_string = _("Before running Nemo, please create the following folder, or " "set permissions such that Nemo can create it."); } else { error_string = g_strdup_printf (_("Nemo could not create the following required folders: " "%s."), directories_as_string->str); detail_string = _("Before running Nemo, please create these folders, or " "set permissions such that Nemo can create them."); } dialog = eel_show_error_dialog (error_string, detail_string, NULL); /* We need the main event loop so the user has a chance to see the dialog. */ gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (dialog)); g_string_free (directories_as_string, TRUE); g_free (error_string); } g_slist_free (directories); g_free (user_directory); g_free (desktop_directory); return ret; }