static void interesting_folder_bar_response_cb (GtkInfoBar *infobar, gint response_id, gpointer user_data) { NemoInterestingFolderBar *bar; GFile *f = NULL; bar = NEMO_INTERESTING_FOLDER_BAR (infobar); switch (response_id) { case INTERESTING_FOLDER_BAR_ACTION_OPEN_DOC: f = g_file_new_for_path ("/usr/share/nemo/actions/sample.nemo_action"); if (g_file_query_exists (f, NULL)) nemo_view_activate_file (bar->priv->view, nemo_file_get (f), NEMO_WINDOW_OPEN_FLAG_NEW_WINDOW); g_object_unref (f); break; case INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC: f = g_file_new_for_path ("/usr/share/nemo/script-info.md"); if (g_file_query_exists (f, NULL)) nemo_view_activate_file (bar->priv->view, nemo_file_get (f), NEMO_WINDOW_OPEN_FLAG_NEW_WINDOW); g_object_unref (f); break; default: break; } }
void nemo_application_open_location (NemoApplication *application, GFile *location, GFile *selection, const char *startup_id) { NemoWindow *window; GList *sel_list = NULL; window = nemo_application_create_window (application, gdk_screen_get_default ()); gtk_window_set_startup_id (GTK_WINDOW (window), startup_id); if (selection != NULL) { sel_list = g_list_prepend (sel_list, nemo_file_get (selection)); } nemo_window_slot_open_location (nemo_window_get_active_slot (window), location, 0, sel_list); if (sel_list != NULL) { nemo_file_list_free (sel_list); } }
static void nemo_bookmark_connect_file (NemoBookmark *bookmark) { if (bookmark->details->file != NULL) { DEBUG ("%s: file already connected, returning", nemo_bookmark_get_name (bookmark)); return; } if (bookmark->details->exists) { DEBUG ("%s: creating file", nemo_bookmark_get_name (bookmark)); bookmark->details->file = nemo_file_get (bookmark->details->location); g_assert (!nemo_file_is_gone (bookmark->details->file)); g_signal_connect_object (bookmark->details->file, "changed", G_CALLBACK (bookmark_file_changed_callback), bookmark, 0); } if (bookmark->details->icon == NULL || bookmark->details->symbolic_icon == NULL) { nemo_bookmark_set_icon_to_default (bookmark); } if (bookmark->details->file != NULL && nemo_file_check_if_ready (bookmark->details->file, NEMO_FILE_ATTRIBUTE_INFO)) { bookmark_set_name_from_ready_file (bookmark, bookmark->details->file); } if (bookmark->details->name == NULL) { bookmark->details->name = nemo_compute_title_for_location (bookmark->details->location); } }
static void action_activated_callback (GtkMenuItem *item, NemoAction *action) { GFile *desktop_location = nemo_get_desktop_location (); NemoFile *desktop_file = nemo_file_get (desktop_location); g_object_unref (desktop_location); nemo_action_activate (NEMO_ACTION (action), NULL, desktop_file); }
char * nemo_compute_title_for_location (GFile *location) { NemoFile *file; char *title; char *builder; /* TODO-gio: This doesn't really work all that great if the info about the file isn't known atm... */ if (nemo_is_home_directory (location)) { return g_strdup (_("Home")); } builder = NULL; if (location) { file = nemo_file_get (location); builder = nemo_file_get_description (file); if (builder == NULL) { builder = nemo_file_get_display_name (file); } nemo_file_unref (file); } if (builder == NULL) { builder = g_file_get_basename (location); } if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_FULL_PATH_TITLES)) { file = nemo_file_get (location); char *path = g_filename_from_uri (nemo_file_get_uri (file), NULL, NULL); if (path != NULL) { title = g_strdup_printf("%s - %s", builder, path); } else { title = g_strdup(builder); } nemo_file_unref (file); g_free (path); g_free (builder); } else { title = g_strdup(builder); g_free (builder); } return title; }
void nemo_directory_schedule_position_set (GList *position_setting_list) { GList *p; const NemoFileChangesQueuePosition *item; NemoFile *file; char str[64]; time_t now; time (&now); for (p = position_setting_list; p != NULL; p = p->next) { item = (NemoFileChangesQueuePosition *) p->data; file = nemo_file_get (item->location); if (item->set) { g_snprintf (str, sizeof (str), "%d,%d", item->point.x, item->point.y); } else { str[0] = 0; } nemo_file_set_metadata (file, NEMO_METADATA_KEY_ICON_POSITION, NULL, str); if (item->set) { nemo_file_set_time_metadata (file, NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP, now); } else { nemo_file_set_time_metadata (file, NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP, UNDEFINED_TIME); } if (item->set) { g_snprintf (str, sizeof (str), "%d", item->monitor); } else { str[0] = 0; } nemo_file_set_metadata (file, NEMO_METADATA_KEY_MONITOR, NULL, str); nemo_file_unref (file); } }
void nemo_launch_application_for_mount (GAppInfo *app_info, GMount *mount, GtkWindow *parent_window) { GFile *root; NemoFile *file; GList *files; root = g_mount_get_root (mount); file = nemo_file_get (root); g_object_unref (root); files = g_list_append (NULL, file); nemo_launch_application (app_info, files, parent_window); g_list_free_full (files, (GDestroyNotify) nemo_file_unref); }