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 (!nemo_bookmark_uri_known_not_to_exist (bookmark)) { 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); } /* Set icon based on available information. */ nemo_bookmark_update_icon (bookmark); if (bookmark->details->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 unity_bookmarks_handler_update_bookmarks () { NemoBookmark *bookmark; guint bookmark_count; guint index; GList *l; /* append new set of bookmarks */ bookmark_count = nemo_bookmark_list_length (bookmarks); for (index = 0; index < bookmark_count; ++index) { bookmark = nemo_bookmark_list_item_at (bookmarks, index); if (nemo_bookmark_uri_known_not_to_exist (bookmark)) { continue; } for (l = unity_quicklist_get_launcher_entries (unity_quicklist_handler); l; l = l->next) { UnityLauncherEntry *entry = l->data; DbusmenuMenuitem* menuitem = dbusmenu_menuitem_new(); gchar *bookmark_name_dbusmenu = eel_str_replace_substring (nemo_bookmark_get_name (bookmark), "_", "__"); dbusmenu_menuitem_property_set (menuitem, "label", bookmark_name_dbusmenu); g_free (bookmark_name_dbusmenu); g_signal_connect (menuitem, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, (GCallback) activate_bookmark_by_quicklist, bookmark); unity_quicklist_handler_append_menuitem (entry, menuitem); } } }
static void nemo_bookmark_set_icon_to_default (NemoBookmark *bookmark) { GIcon *icon, *emblemed_icon, *folder; GEmblem *emblem; char *uri; if (g_file_is_native (bookmark->details->location)) { folder = g_themed_icon_new (NEMO_ICON_FOLDER); } else { uri = nemo_bookmark_get_uri (bookmark); if (g_str_has_prefix (uri, EEL_SEARCH_URI)) { folder = g_themed_icon_new (NEMO_ICON_FOLDER_SAVED_SEARCH); } else { folder = g_themed_icon_new (NEMO_ICON_FOLDER_REMOTE); } g_free (uri); } if (nemo_bookmark_uri_known_not_to_exist (bookmark)) { DEBUG ("%s: file does not exist, add emblem", nemo_bookmark_get_name (bookmark)); icon = g_themed_icon_new (GTK_STOCK_DIALOG_WARNING); emblem = g_emblem_new (icon); emblemed_icon = g_emblemed_icon_new (folder, emblem); g_object_unref (emblem); g_object_unref (icon); g_object_unref (folder); folder = emblemed_icon; } DEBUG ("%s: setting icon to default", nemo_bookmark_get_name (bookmark)); g_object_set (bookmark, "icon", folder, NULL); g_object_unref (folder); }