static void unsubscribe_dialog_ab_response (GtkDialog *dialog, int response, gpointer data) { if (response == GTK_RESPONSE_OK) { ExchangeAccount *account = NULL; gchar *path = NULL; gchar *uri = NULL; const char *source_uid = NULL; ESourceGroup *source_group = NULL; ESource *source = NULL; EABPopupTargetSource *target = data; account = exchange_operations_get_exchange_account (); if (!account) return; source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); uri = e_source_get_uri (source); path = g_strdup (uri + strlen ("exchange://") + strlen (account->account_filename)); source_uid = e_source_peek_uid (source); exchange_account_remove_shared_folder (account, path); source_group = e_source_peek_group (source); e_source_group_remove_source_by_uid (source_group, source_uid); g_free (path); gtk_widget_destroy (GTK_WIDGET (dialog)); } if (response == GTK_RESPONSE_CANCEL) gtk_widget_destroy (GTK_WIDGET (dialog)); if (response == GTK_RESPONSE_DELETE_EVENT) gtk_widget_destroy (GTK_WIDGET (dialog)); }
static void on_permissions_cb(GtkAction *action, EShellView *shell_view) { EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); ESourceSelector *selector; g_object_get (shell_sidebar, "selector", &selector, NULL); ESource *source = e_source_selector_peek_primary_selection (selector); ESourceGroup *group = e_source_peek_group (source); EeeAccount *account; if (!e_source_is_3e (source)) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), _("This action is available only for 3e calendars.")); g_object_unref (selector); return; } if (!eee_plugin_online) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), _("This action is not available with 3e plugin in offline mode.")); g_object_unref (selector); return; } g_object_unref (selector); account = eee_accounts_manager_find_account_by_source(mgr(), source); acl_gui_create(mgr(), account, source); }
static void import_items(ICalImporterData *icidata) { ESource *source; g_return_if_fail (icidata != NULL); source = e_source_selector_peek_primary_selection ((ESourceSelector *)icidata->selector); g_return_if_fail ( source != NULL); icidata->client = auth_new_cal_from_source (source, icidata->source_type); e_cal_open (icidata->client, FALSE, NULL); switch (icidata->source_type) { case E_CAL_SOURCE_TYPE_EVENT: prepare_events (icidata->icalcomp, NULL); if (!update_objects (icidata->client, icidata->icalcomp)) /* FIXME: e_error ... */; break; case E_CAL_SOURCE_TYPE_TODO: prepare_tasks (icidata->icalcomp, NULL); if (!update_objects (icidata->client, icidata->icalcomp)) /* FIXME: e_error ... */; break; default: g_assert_not_reached (); } ical_import_done (icidata); }
static void unsubscribe_dialog_response (GtkDialog *dialog, int response, gpointer data) { if (response == GTK_RESPONSE_OK) { GSList *ids, *node_to_be_deleted; ExchangeAccount *account = NULL; gchar *path = NULL; gchar *ruri = NULL; const char *source_uid = NULL; GConfClient *client; ESourceGroup *source_group = NULL; ESource *source = NULL; ECalPopupTargetSource *target = data; client = gconf_client_get_default (); account = exchange_operations_get_exchange_account (); if (!account) return; source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); ruri = (gchar *) e_source_peek_relative_uri (source); source_uid = e_source_peek_uid (source); path = g_strdup (ruri + strlen (account->account_filename)); exchange_account_remove_shared_folder (account, path); ids = gconf_client_get_list (client, CONF_KEY_SELECTED_CAL_SOURCES, GCONF_VALUE_STRING, NULL); if (ids) { node_to_be_deleted = g_slist_find_custom ( ids, source_uid, (GCompareFunc) strcmp); if (node_to_be_deleted) { g_free (node_to_be_deleted->data); ids = g_slist_delete_link (ids, node_to_be_deleted); gconf_client_set_list (client, CONF_KEY_SELECTED_CAL_SOURCES, GCONF_VALUE_STRING, ids, NULL); } g_slist_foreach (ids, (GFunc) g_free, NULL); g_slist_free (ids); } source_group = e_source_peek_group (source); e_source_group_remove_source_by_uid (source_group, source_uid); g_free (path); gtk_widget_destroy (GTK_WIDGET (dialog)); } if (response == GTK_RESPONSE_CANCEL) gtk_widget_destroy (GTK_WIDGET (dialog)); if (response == GTK_RESPONSE_DELETE_EVENT) gtk_widget_destroy (GTK_WIDGET (dialog)); }
void org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, void *data) { GtkWidget *dialog = NULL; EABPopupTargetSource *target = data; ESource *source = NULL; ExchangeAccount *account = NULL; gchar *title = NULL; gchar *displayed_folder_name = NULL; gint response; gint mode; ExchangeConfigListenerStatus status; account = exchange_operations_get_exchange_account (); if (!account) return; status = exchange_is_offline (&mode); if (status != CONFIG_LISTENER_STATUS_OK) { g_warning ("Config listener not found"); return; } else if (mode == OFFLINE_MODE) { e_error_run (NULL, ERROR_DOMAIN ":account-offline-generic", NULL); return; } source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); displayed_folder_name = (gchar *) e_source_peek_name (source); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Really unsubscribe from folder \"%s\"?"), displayed_folder_name); gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_REMOVE, GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6); title = g_strdup_printf (_("Unsubscribe from \"%s\""), displayed_folder_name); gtk_window_set_title (GTK_WINDOW (dialog), title); response = gtk_dialog_run (GTK_DIALOG (dialog)); g_free (title); g_free (displayed_folder_name); gtk_widget_show (dialog); unsubscribe_dialog_ab_response (GTK_DIALOG (dialog), response, data); }
static void on_delete_cb(GtkAction *action, EShellView *shell_view) { EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar(shell_view); ESourceSelector *selector; g_object_get(shell_sidebar, "selector", &selector, NULL); ESource *source = e_source_selector_peek_primary_selection(selector); if (e_alert_run_dialog_for_args(GTK_WINDOW(shell_view), "calendar:prompt-delete-calendar", e_source_peek_name(source), NULL) != GTK_RESPONSE_YES) { g_object_unref (selector); return; } ESourceGroup *group = e_source_peek_group(source); char *calname = (char *)e_source_get_property(source, "eee-calname"); EeeAccount *account; GError *err = NULL; if (!eee_plugin_online) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), _("This action is not available with 3e plugin in offline mode.")); g_object_unref (selector); return; } if (!e_source_is_3e_owned_calendar(source)) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), _("This action is available only for 3e calendars.")); g_object_unref (selector); return; } g_object_unref (selector); account = eee_accounts_manager_find_account_by_source(mgr(), source); if (eee_account_delete_calendar(account, calname)) { // get ECal and remove calendar from the server ECalClient *ecal = e_cal_client_new(source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &err); if (!e_client_remove_sync((EClient *)ecal, NULL, &err)) { g_warning("** EEE ** ECal remove failed (%d:%s)", err->code, err->message); g_clear_error(&err); } g_object_unref(ecal); e_source_group_remove_source(group, source); } eee_account_disconnect(account); eee_accounts_manager_restart_sync(mgr()); }
static void annum_shell_view_selector_primary_changed_cb (AnnumShellView * self, ESourceSelector * selector) { AnnumShellContent *prox_shell_content; GnomeCalendar *calendar; ESource *source; /* XXX ESourceSelector -really- needs a "primary-selection" * ESource property. Then we could just use EBindings. */ prox_shell_content = self->priv->prox_shell_content; calendar = annum_shell_content_get_calendar (prox_shell_content); source = e_source_selector_peek_primary_selection (selector); /* FIXME: removed in 7c02582ae70e45d58bf0966d60e23b50f854a06a */ /* if (source != NULL) */ /* gnome_calendar_set_default_source (calendar, source); */ }
void org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSource *target) { GSList *menus = NULL; int i = 0; ESource *source = NULL; gchar *uri = NULL; gchar *path = NULL; char *sub_folder = NULL; const char *base_uri; ExchangeAccount *account = NULL; ESourceGroup *group; account = exchange_operations_get_exchange_account (); if (!account) return; source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); group = e_source_peek_group (source); base_uri = e_source_group_peek_base_uri (group); if (!base_uri || strcmp (base_uri, "exchange://")) return; uri = e_source_get_uri (source); path = g_strdup (uri + strlen ("exchange://") + strlen (account->account_filename) + strlen ("/;")); g_free (uri); sub_folder = strchr (path, '@'); if (!sub_folder) { g_free (path); return; } for (i = 0; i < sizeof (popup_ab_items) / sizeof (popup_ab_items[0]); i++) menus = g_slist_prepend (menus, &popup_ab_items[i]); e_popup_add_items (target->target.popup, menus, NULL, popup_ab_free, target); g_free (path); }
static void update_uri_for_primary_selection (MemosComponentView *component_view) { ESource *source; EMemoTable *cal_table; ETable *etable; source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)); if (!source) return; /* Set the default */ e_memos_set_default_source (component_view->memos, source); cal_table = e_memos_get_calendar_table (component_view->memos); etable = e_memo_table_get_table (cal_table); memos_control_sensitize_commands (component_view->view_control, component_view->memos, e_table_selected_count (etable)); /* Save the selection for next time we start up */ calendar_config_set_primary_memos (e_source_peek_uid (source)); }