Пример #1
0
static void
add_send_options_to_source (EGwSendOptions *n_opts)
{
	GConfClient *gconf = gconf_client_get_default ();
	ESource *csource, *tsource;
	ESourceList *list;
	EGwSendOptionsGeneral *gopts;
	EGwSendOptionsStatusTracking *topts, *copts;

	list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
	csource = get_source (list);

	list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
	tsource = get_source (list);

	gopts = e_gw_sendoptions_get_general_options (n_opts);
	copts = e_gw_sendoptions_get_status_tracking_options (n_opts, "calendar");
	topts = e_gw_sendoptions_get_status_tracking_options (n_opts, "task");

	if (csource)
		put_options_in_source (csource, gopts, copts);

	if (tsource)
		put_options_in_source (tsource, gopts, topts);

	g_object_unref (gconf);
}
Пример #2
0
ESourceList *
config_data_get_calendars (const char *key)
{
	ESourceList *cal_sources;
	gboolean state;
	GSList *gconf_list;

	if (!inited)
		conf_client = gconf_client_get_default ();

	gconf_list = gconf_client_get_list (conf_client,
					    key,
					    GCONF_VALUE_STRING,
					    NULL);
	cal_sources = e_source_list_new_for_gconf (conf_client, key);

	if (cal_sources && g_slist_length (gconf_list)) {
		g_slist_foreach (gconf_list, (GFunc) g_free, NULL);
		g_slist_free (gconf_list);
		return cal_sources;
	}

	state = gconf_client_get_bool (conf_client,
				      "/apps/evolution/calendar/notify/notify_with_tray",
				      NULL);
	if (!state) /* Should be old client*/ {
		GSList *source;
		gconf_client_set_bool (conf_client,
				      "/apps/evolution/calendar/notify/notify_with_tray",
				      TRUE,
				      NULL);
		source = gconf_client_get_list (conf_client,
						"/apps/evolution/calendar/sources",
						GCONF_VALUE_STRING,
						NULL);
		gconf_client_set_list (conf_client,
				       key,
				       GCONF_VALUE_STRING,
				       source,
				       NULL);
		cal_sources = e_source_list_new_for_gconf (conf_client, key);

		if (source) {
			g_slist_foreach (source, (GFunc) g_free, NULL);
			g_slist_free (source);
		}
	}

	if (gconf_list) {
		g_slist_foreach (gconf_list, (GFunc) g_free, NULL);
		g_slist_free (gconf_list);
	}

	return cal_sources;

}
Пример #3
0
static void
add_planner_file (const gchar *conf_key,
		  const gchar *uri)
{
	ESourceList  *source_list;
	ESourceGroup *group;
	ESource      *source;
	char         *group_name;

	source_list = e_source_list_new_for_gconf (conf_client, conf_key);

	group_name = g_strdup_printf ("Projects");
	group = e_source_group_new (group_name, "planner://");
	e_source_list_add_group (source_list, group, -1);

	g_free (group_name);
	group_name = g_strdup_printf ("%s", uri);
	source = e_source_new ("Calendar", group_name);
	e_source_group_add_source (group, source, -1);

	e_source_list_sync (source_list, NULL);

	g_free (group_name);
	g_object_unref (source);
	g_object_unref (group);
	g_object_unref (source_list);
}
Пример #4
0
GtkWidget *
contact_list_editor_create_source_combo_box (gchar *name,
                                             gchar *string1,
                                             gchar *string2,
                                             gint int1,
                                             gint int2)
{
	const gchar *key = "/apps/evolution/addressbook/sources";

	GtkWidget *combo_box;
	GConfClient *client;
	ESourceList *source_list;

	client = gconf_client_get_default ();
	source_list = e_source_list_new_for_gconf (client, key);
	combo_box = e_source_combo_box_new (source_list);
	g_object_unref (source_list);
	g_object_unref (client);

	g_signal_connect (
		combo_box, "changed", G_CALLBACK (
		contact_list_editor_source_menu_changed_cb), NULL);

	gtk_widget_show (combo_box);

	return combo_box;
}
static gint
on_idle_create_widget (const gchar *gconf_path)
{
	GtkWidget *window;
	GtkWidget *combo_box;
	ESourceList *source_list;
	GConfClient *gconf_client;

	gconf_client = gconf_client_get_default ();
	source_list = e_source_list_new_for_gconf (gconf_client, gconf_path);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	combo_box = e_source_combo_box_new (source_list);
	g_signal_connect (
		combo_box, "changed",
		G_CALLBACK (source_changed_cb), NULL);

	gtk_container_add (GTK_CONTAINER (window), combo_box);
	gtk_widget_show_all (window);

	g_object_unref (gconf_client);
	g_object_unref (source_list);

	return FALSE;
}
Пример #6
0
static void eee_accounts_manager_init(EeeAccountsManager *self)
{
    self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, EEE_TYPE_ACCOUNTS_MANAGER, EeeAccountsManagerPriv);

    self->priv->gconf = gconf_client_get_default();
    self->priv->ealist = e_account_list_new(self->priv->gconf);
    self->priv->eslist = e_source_list_new_for_gconf(self->priv->gconf, CALENDAR_SOURCES);

    eee_accounts_manager_load_access_accounts_list(self);
    eee_accounts_manager_activate_accounts(self);

    g_signal_connect(self->priv->ealist, "account_added", G_CALLBACK(account_list_changed), self);
    g_signal_connect(self->priv->ealist, "account_changed", G_CALLBACK(account_list_changed), self);
    g_signal_connect(self->priv->ealist, "account_removed", G_CALLBACK(account_list_changed), self);

    if (!eee_plugin_online)
    {
        self->priv->sync_request = SYNC_REQ_PAUSE;
    }
    else
    {
        self->priv->sync_request = SYNC_REQ_START;
    }

    self->priv->sync_thread = g_thread_create(sync_thread_func, self, FALSE, NULL);
}
Пример #7
0
static void
calendar_sources_load_sources (CalendarSources    *sources,
			       CalendarSourceData *source_data,
			       const char         *sources_key,
			       const char         *selected_sources_key,
			       const char         *selected_sources_dir)
{
  GConfClient *gconf_client;
  GError      *error;

  dprintf ("---------------------------\n");
  dprintf ("Loading sources:\n");
  dprintf ("  sources_key: %s\n", sources_key);
  dprintf ("  selected_sources_key: %s\n", selected_sources_key);
  dprintf ("  selected_sources_dir: %s\n", selected_sources_dir);

  gconf_client = sources->priv->gconf_client;

  error = NULL;
  source_data->selected_sources = gconf_client_get_list (gconf_client,
							 selected_sources_key,
							 GCONF_VALUE_STRING,
							 &error);
  if (error)
    {
      g_warning ("Failed to get selected sources from '%s': %s\n",
		 selected_sources_key,
		 error->message);
      g_error_free (error);
      return;
    }

  gconf_client_add_dir (gconf_client,
			selected_sources_dir,
			GCONF_CLIENT_PRELOAD_NONE,
			NULL);
  source_data->selected_sources_dir = g_strdup (selected_sources_dir);

  source_data->selected_sources_listener =
    gconf_client_notify_add (gconf_client,
			     selected_sources_dir,
			     (GConfClientNotifyFunc) calendar_sources_selected_sources_notify,
			     source_data, NULL, NULL);

  source_data->esource_list = e_source_list_new_for_gconf (gconf_client, sources_key);
  g_signal_connect (source_data->esource_list, "changed",
		    G_CALLBACK (calendar_sources_esource_list_changed),
		    source_data);

  calendar_sources_load_esource_list (source_data);

  source_data->loaded = TRUE;

  dprintf ("---------------------------\n");
}
Пример #8
0
/* Ensures that the configuration values have been read */
static void
ensure_inited (void)
{
	if (inited)
		return;

	inited = TRUE;

	conf_client = gconf_client_get_default ();
	if (!GCONF_IS_CLIENT (conf_client)) {
		inited = FALSE;
		return;
	}

	g_atexit ((GVoidFunc) do_cleanup);

	/* load the sources for calendars and tasks */
	calendar_source_list = e_source_list_new_for_gconf (conf_client,
							    "/apps/evolution/calendar/sources");
	tasks_source_list = e_source_list_new_for_gconf (conf_client,
							 "/apps/evolution/tasks/sources");

}
Пример #9
0
void
publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri)
{
	GSList *l;
	ESourceList *source_list;
	GConfClient *gconf_client;

	gconf_client = gconf_client_get_default ();

	/* events */
	source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources");
	l = uri->events;
	while (l) {
		gchar *uid = l->data;
		if (!write_calendar (uid, source_list, stream))
			break;
		l = g_slist_next (l);
	}
	g_object_unref (source_list);

	g_object_unref (gconf_client);
}
static void
add_account (const char *conf_key, const char *hostname, const char *username, const char *password)
{
    ESourceList *source_list;
    ESourceGroup *group;
    ESource *source;
    char *group_name;

    source_list = e_source_list_new_for_gconf (conf_client, conf_key);

    group_name = g_strdup_printf ("%s@%s:7181/soap", username, hostname);
    group = e_source_group_new ("Groupwise", "groupwise://");
    e_source_list_add_group (source_list, group, -1);

    if (password && *password) {
        g_free (group_name);
        group_name = g_strdup_printf ("%s:%s@%s/soap/", username, password, hostname);
    }
    source = e_source_new ("Frequent Contacts", group_name);
    e_source_set_property (source, "auth", "ldap/simple-binddn");
    e_source_set_property(source, "binddn", "user1");
    e_source_group_add_source (group, source, -1);
    /*
    	source = e_source_new ("Test User1", group_name);
    	e_source_set_property (source, "auth", "ldap/simple-binddn");
    	e_source_set_property(source, "binddn", "user1");
    	e_source_group_add_source (group, source, -1);
    	source = e_source_new ("mybook1", group_name);
    	e_source_set_property (source, "auth", "ldap/simple-binddn");
    	e_source_set_property(source, "binddn", "user1");
    	e_source_group_add_source (group, source, -1);*/
    e_source_list_sync (source_list, NULL);

    g_free (group_name);
    g_object_unref (source);
    g_object_unref (group);
    g_object_unref (source_list);
}
Пример #11
0
static void
eds_plugin_import (GtkAction   *action,
		   gpointer     user_data,
		   const gchar *cname)
{
	PlannerPlugin     *plugin;
	PlannerPluginPriv *priv;
	GtkCellRenderer   *renderer;
	GConfClient       *gconf_client;
	ESourceList       *source_list;
	GSList            *groups;
	gchar             *filename;

	plugin = PLANNER_PLUGIN (user_data);
	priv = plugin->priv;

	filename = mrp_paths_get_glade_dir ("/eds.glade");
	priv->glade = glade_xml_new (filename, NULL, NULL);
	g_free (filename);

	priv->dialog_get_resources = glade_xml_get_widget (priv->glade, "resources_get");

	gtk_window_set_transient_for (GTK_WINDOW (priv->dialog_get_resources),
				      GTK_WINDOW (plugin->main_window));
	priv->select_group = GTK_COMBO_BOX (glade_xml_get_widget (priv->glade,
								  "select_group"));
	g_signal_connect (priv->select_group, "changed",
			  G_CALLBACK (eds_group_selected),
			  user_data);

	priv->resources_tree_view = GTK_TREE_VIEW (glade_xml_get_widget (priv->glade,
									 "resources"));

	g_signal_connect (glade_xml_get_widget (priv->glade, "ok_button"),
			  "clicked",
			  G_CALLBACK (eds_ok_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "cancel_button"),
			  "clicked",
			  G_CALLBACK (eds_cancel_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "search_button"),
			  "clicked",
			  G_CALLBACK (eds_search_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "all_button"),
			  "clicked",
			  G_CALLBACK (eds_all_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "none_button"),
			  "clicked",
			  G_CALLBACK (eds_none_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "stop_button"),
			  "clicked",
			  G_CALLBACK (eds_stop_button_clicked),
			  plugin);
	g_signal_connect (glade_xml_get_widget (priv->glade, "search_entry"),
			  "key-press-event",
			  G_CALLBACK (eds_search_key_pressed),
			  plugin);

	gtk_widget_show (priv->dialog_get_resources);


	gconf_client = gconf_client_get_default ();
	source_list = e_source_list_new_for_gconf (gconf_client,
						   "/apps/evolution/addressbook/sources");
	/* List with addressbook groups */
	groups = e_source_list_peek_groups (source_list);
	eds_create_groups_model (groups, plugin);
	gtk_combo_box_set_model (priv->select_group, priv->groups_model);
	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->select_group),
				    renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->select_group),
					renderer, "text", 0, NULL);
	/* g_object_unref (source_list); */
}
Пример #12
0
void
e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, char * type)
{
	ESendOptionsGeneral *gopts = NULL;
	ESendOptionsStatusTracking *sopts;
	GConfClient *gconf = gconf_client_get_default ();
	ESourceList *source_list;
	const char *uid;
	const char *value;

	gopts = sod->data->gopts;
	sopts = sod->data->sopts;

	if (!strcmp (type, "calendar"))
		source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
	else
		source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");

	uid = e_source_peek_uid (source);
	source = e_source_list_peek_source_by_uid (source_list, uid);

		/* priority */
	value = e_source_get_property (source, "priority");
	if (value) {
		if (!strcmp (value, "high"))
			gopts->priority = E_PRIORITY_HIGH;
		else if (!strcmp (value, "standard"))
			gopts->priority = E_PRIORITY_STANDARD;
		else if (!strcmp (value, "low"))
			gopts->priority = E_PRIORITY_LOW;
		else
			gopts->priority = E_PRIORITY_UNDEFINED;
	}
		/* Reply requested */
	value = e_source_get_property (source, "reply-requested");
	if (value) {
		if (!strcmp (value, "none"))
			gopts->reply_enabled = FALSE;
		else if (!strcmp (value, "convinient")) {
			gopts->reply_enabled = TRUE;
			gopts->reply_convenient = TRUE;
		} else {
			gint i = atoi (value);
			gopts->reply_within = i;
		}
	}
		/* Delay delivery */
	value = e_source_get_property (source, "delay-delivery");
	if (value) {
		if (!strcmp (value, "none"))
			gopts->delay_enabled = FALSE;
		else {
			gopts->delay_enabled = TRUE;
			gopts->delay_until = icaltime_as_timet (icaltime_from_string (value));
		}
	}
		/* Expiration Date */
	value = e_source_get_property (source, "expiration");
	if (value) {
		if (!strcmp (value, "none"))
			gopts->expiration_enabled = FALSE;
		else {
			gint i = atoi (value);
			if (i == 0)
				gopts->expiration_enabled = FALSE;
			else
				gopts->expiration_enabled = TRUE;
			gopts->expire_after = i;
		}
	}
		/* status tracking */
	value = e_source_get_property (source, "status-tracking");
	if (value) {
		if (!strcmp (value, "none"))
			sopts->tracking_enabled = FALSE;
		else {
			sopts->tracking_enabled = TRUE;
			if (!strcmp (value, "delivered"))
				sopts->track_when = E_DELIVERED;
			else if (!strcmp (value, "delivered-opened"))
				sopts->track_when = E_DELIVERED_OPENED;
			else
				sopts->track_when = E_ALL;
		}
	}

		/* Return Notifications */

	value = e_source_get_property (source, "return-open");
	if (value) {
		if (!strcmp (value, "none"))
			sopts->opened = E_RETURN_NOTIFY_NONE;
		else
			sopts->opened = E_RETURN_NOTIFY_MAIL;
	}

	value = e_source_get_property (source, "return-accept");
	if (value) {
		if (!strcmp (value, "none"))
			sopts->accepted = E_RETURN_NOTIFY_NONE;
		else
			sopts->accepted = E_RETURN_NOTIFY_MAIL;
	}

 	value = e_source_get_property (source, "return-decline");
	if (value) {
		if (!strcmp (value, "none"))
			sopts->declined = E_RETURN_NOTIFY_NONE;
		else
			sopts->declined = E_RETURN_NOTIFY_MAIL;
	}

	value = e_source_get_property (source, "return-complete");
	if (value) {
		if (!strcmp (value, "none"))
			sopts->completed = E_RETURN_NOTIFY_NONE;
		else
			sopts->completed = E_RETURN_NOTIFY_MAIL;
	}

	g_object_unref (gconf);
}
Пример #13
0
static gint
on_idle_do_stuff (gpointer unused_data)
{
	GConfClient *client = gconf_client_get_default ();
	ESourceGroup *new_group = NULL;
	ESource *new_source = NULL;

	list = e_source_list_new_for_gconf (client, key_arg);
	g_object_unref (client);

	if (add_group_arg != NULL) {
		if (group_arg != NULL) {
			fprintf (stderr, "--add-group and --group cannot be used at the same time.\n");
			exit (1);
		}
		if (set_base_uri_arg == NULL) {
			fprintf (stderr, "When using --add-group, you need to specify a base URI using --set-base-uri.\n");
			exit (1);
		}

		new_group = e_source_group_new (add_group_arg, set_base_uri_arg);
		e_source_list_add_group (list, new_group, -1);
		g_object_unref (new_group);

		e_source_list_sync (list, NULL);
	}

	if (remove_group_arg != NULL) {
		ESourceGroup *group;

		group = e_source_list_peek_group_by_uid (list, remove_group_arg);
		if (group == NULL) {
			fprintf (stderr, "No such group \"%s\".\n", remove_group_arg);
			exit (1);
		}

		e_source_list_remove_group (list, group);
		e_source_list_sync (list, NULL);
	}

	if (add_source_arg != NULL) {
		ESourceGroup *group;

		if (group_arg == NULL && new_group == NULL) {
			fprintf (stderr,
				 "When using --add-source, you need to specify a group using either --group\n"
				 "or --add-group.\n");
			exit (1);
		}
		if (set_relative_uri_arg == NULL) {
			fprintf (stderr,
				 "When using --add-source, you need to specify a relative URI using\n"
				 "--set-relative-uri.\n");
			exit (1);
		}

		if (group_arg == NULL) {
			group = new_group;
		} else {
			group = e_source_list_peek_group_by_uid (list, group_arg);
			if (group == NULL) {
				fprintf (stderr, "No such group \"%s\".\n", group_arg == NULL ? add_group_arg : group_arg);
				exit (1);
			}
		}

		new_source = e_source_new (add_source_arg, set_relative_uri_arg);
		e_source_group_add_source (group, new_source, -1);
		e_source_list_sync (list, NULL);
	}

	if (remove_source_arg != NULL) {
		ESource *source;

		source = e_source_list_peek_source_by_uid (list, remove_source_arg);
		if (source == NULL) {
			fprintf (stderr, "No such source \"%s\".\n", remove_source_arg);
			exit (1);
		}

		e_source_list_remove_source_by_uid (list, remove_source_arg);
		e_source_list_sync (list, NULL);
	}

	if (set_name_arg != NULL) {
		if (group_arg == NULL && source_arg == NULL) {
			fprintf (stderr,
				 "When using --set-name, you need to specify a source (using --source"
				 "alone) or a group (using --group alone).\n");
			exit (1);
		}

		if (source_arg != NULL) {
			ESource *source = e_source_list_peek_source_by_uid (list, source_arg);

			if (source != NULL) {
				e_source_set_name (source, set_name_arg);
			} else {
				fprintf (stderr, "No such source \"%s\".\n", source_arg);
				exit (1);
			}
		} else {
			ESourceGroup *group = e_source_list_peek_group_by_uid (list, group_arg);

			if (group != NULL) {
				e_source_group_set_name (group, set_name_arg);
			} else {
				fprintf (stderr, "No such group \"%s\".\n", group_arg);
				exit (1);
			}
		}

		e_source_list_sync (list, NULL);
	}

	if (set_relative_uri_arg != NULL && add_source_arg == NULL) {
		ESource *source;

		if (source_arg == NULL) {
			fprintf (stderr,
				 "When using --set-relative-uri, you need to specify a source using "
				 "--source.\n");
			exit (1);
		}

		source = e_source_list_peek_source_by_uid (list, source_arg);
		e_source_set_relative_uri (source, set_relative_uri_arg);
		e_source_list_sync (list, NULL);
	}

	if (set_color_arg != NULL) {
		ESource *source;

		if (add_source_arg == NULL && source_arg == NULL) {
			fprintf (stderr,
				 "When using --set-color, you need to specify a source using --source\n");
			exit (1);
		}

		if (add_source_arg != NULL)
			source = new_source;
		else
			source = e_source_list_peek_source_by_uid (list, source_arg);

		e_source_set_color_spec (source, set_color_arg);
		e_source_list_sync (list, NULL);
	}

	if (unset_color) {
		ESource *source;

		if (add_source_arg == NULL && source_arg == NULL) {
			fprintf (stderr,
				 "When using --unset-color, you need to specify a source using --source\n");
			exit (1);
		}

		if (add_source_arg != NULL)
			source = new_source;
		else
			source = e_source_list_peek_source_by_uid (list, source_arg);

		e_source_set_color_spec (source, NULL);
		e_source_list_sync (list, NULL);
	}

	if (set_base_uri_arg != NULL && add_group_arg == NULL) {
		ESourceGroup *group;

		if (group_arg == NULL) {
			fprintf (stderr,
				 "When using --set-base-uri, you need to specify a group using --group.\n");
			exit (1);
		}

		group = e_source_list_peek_group_by_uid (list, group_arg);
		e_source_group_set_base_uri (group, set_base_uri_arg);
		e_source_list_sync (list, NULL);
	}

	if (set_value_arg != NULL) {
		ESource *source;

		if (add_source_arg == NULL && source_arg == NULL) {
			fprintf (stderr,
				 "When using --set-value, you need to specify a source using --source\n");
			exit (1);
		}

		if (property_arg == NULL) {
			fprintf (stderr,
				 "When using --set-value, you need to specify a property using --property\n");
			exit (1);
		}

		if (add_source_arg != NULL)
			source = new_source;
		else
			source = e_source_list_peek_source_by_uid (list, source_arg);

		e_source_set_property (source, property_arg, set_value_arg);
		e_source_list_sync (list, NULL);
	}

	if (unset_value) {
		ESource *source;

		if (add_source_arg == NULL && source_arg == NULL) {
			fprintf (stderr,
				 "When using --unset-value, you need to specify a source using --source\n");
			exit (1);
		}

		if (property_arg == NULL) {
			fprintf (stderr,
				 "When using --unset-value, you need to specify a property using --property\n");
			exit (1);
		}

		if (add_source_arg != NULL)
			source = new_source;
		else
			source = e_source_list_peek_source_by_uid (list, source_arg);

		e_source_set_property (source, property_arg, NULL);
		e_source_list_sync (list, NULL);
	}

	connect_list ();

	if (dump)
		dump_list ();

	if (!listen)
		g_main_loop_quit (main_loop);

	return FALSE;
}