static void files_changed_cb (GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { BgPicturesSource *self = BG_PICTURES_SOURCE (user_data); char *uri; switch (event_type) { case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: file_added (file, self); break; case G_FILE_MONITOR_EVENT_DELETED: uri = g_file_get_uri (file); bg_pictures_source_remove (self, uri); g_free (uri); break; default: return; } }
static void remove_button_clicked (GtkButton *button, CcBackgroundPanel *panel) { CcBackgroundItem *item; GtkListStore *store; GtkTreePath *path; CcBackgroundPanelPrivate *priv; priv = panel->priv; item = get_selected_item (panel); if (item == NULL) g_assert_not_reached (); bg_pictures_source_remove (panel->priv->pictures_source, item); g_object_unref (item); /* Are there any items left in the pictures tree store? */ store = bg_source_get_liststore (BG_SOURCE (panel->priv->pictures_source)); if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("sources-combobox")), SOURCE_WALLPAPERS); path = gtk_tree_path_new_from_string ("0"); gtk_icon_view_select_path (GTK_ICON_VIEW (WID ("backgrounds-iconview")), path); gtk_tree_path_free (path); }