/* find EeeAccount for ESourceGroup object */
EeeAccount *eee_accounts_manager_find_account_by_group(EeeAccountsManager *self, ESourceGroup *group)
{
    g_return_val_if_fail(IS_EEE_ACCOUNTS_MANAGER(self), NULL);
    g_return_val_if_fail(E_IS_SOURCE_GROUP(group), NULL);
    g_return_val_if_fail(e_source_group_is_3e(group), NULL);

    return eee_accounts_manager_find_account_by_name(self, e_source_group_peek_name(group) + 4);
}
Example #2
0
static void
group_changed_callback (ESourceGroup *group)
{
	static gint count = 0;

	g_print ("** Event: group \"%s\" changed (%d)\n", e_source_group_peek_name (group), ++count);

	dump_on_idle ();
}
Example #3
0
static void
group_removed_callback (ESourceList *list,
			ESourceGroup *group)
{
	static gint count = 0;

	g_print ("** Event: group \"%s\" removed (%d)\n", e_source_group_peek_name (group), ++count);

	disconnect_group (group);
	dump_on_idle ();
}
Example #4
0
static void
dump_group (ESourceGroup *group)
{
	GSList *sources, *p;

	g_print ("Group %s\n", e_source_group_peek_uid (group));
	g_print ("\tname: %s\n", e_source_group_peek_name (group));
	g_print ("\tbase_uri: %s\n", e_source_group_peek_base_uri (group));

	sources = e_source_group_peek_sources (group);
	for (p = sources; p != NULL; p = p->next) {
		ESource *source = E_SOURCE (p->data);

		dump_source (source);

		if (e_source_peek_group (source) != group)
			g_warning ("\t\t** ERROR ** parent pointer is %p, should be %p",
				   (gpointer) e_source_peek_group (source),
				   (gpointer) group);
	}
}
Example #5
0
static void
eds_create_groups_model (GSList        *groups,
			 PlannerPlugin *plugin)
{
	GtkListStore *model;
	GtkTreeIter   iter;
	GSList       *sl;
	const gchar  *name;

	if (groups == NULL) {
		return;
	}

	model = gtk_list_store_new (NUM_GROUP_COLS, G_TYPE_STRING, G_TYPE_OBJECT);

	for (sl = groups; sl; sl = sl->next) {
		name = e_source_group_peek_name (sl->data);
		gtk_list_store_append (model, &iter);
		gtk_list_store_set (model, &iter,
				    COL_GROUP_NAME, name,
				    COL_GROUP_OBJECT, sl->data, -1);
	}
	plugin->priv->groups_model = GTK_TREE_MODEL (model);
}
Example #6
0
static void
source_list_changed_cb (ESourceList *source_list,
                        ESourceComboBox *source_combo_box)
{
	ESourceComboBoxPrivate *priv;
	GtkComboBox *combo_box;
	GtkTreeModel *model;
	GtkListStore *store;
	GtkTreeIter iter;
	GtkTreePath *path;
	GSList *groups;
	GSList *sources, *s;
	const gchar *name;
	const gchar *uid;
	gchar *indented_name;
	gboolean visible = FALSE;
	gboolean iter_valid;

	priv = source_combo_box->priv;
	g_hash_table_remove_all (priv->uid_index);

	combo_box = GTK_COMBO_BOX (source_combo_box);
	gtk_combo_box_set_active (combo_box, -1);

	model = gtk_combo_box_get_model (combo_box);
	store = GTK_LIST_STORE (model);
	gtk_list_store_clear (store);

	for (groups = e_source_list_peek_groups (source_list);
		groups != NULL; groups = groups->next) {

		/* Only show source groups that have sources. */
		if (e_source_group_peek_sources (groups->data) == NULL)
			continue;

		name = e_source_group_peek_name (groups->data);
		gtk_list_store_append (store, &iter);
		gtk_list_store_set (
			store, &iter,
			COLUMN_COLOR, NULL,
			COLUMN_NAME, name,
			COLUMN_SENSITIVE, FALSE,
			COLUMN_SOURCE, groups->data,
			-1);

		sources = get_sorted_sources (e_source_group_peek_sources (groups->data));
		for (s = sources; s != NULL; s = s->next) {
			const gchar *color_spec;
			GdkColor color;

			name = e_source_peek_name (s->data);
			indented_name = g_strconcat ("    ", name, NULL);

			color_spec = e_source_peek_color_spec (s->data);
			if (color_spec != NULL) {
				gdk_color_parse (color_spec, &color);
				visible = TRUE;
			}

			gtk_list_store_append (store, &iter);
			gtk_list_store_set (
				store, &iter,
				COLUMN_COLOR, color_spec ? &color : NULL,
				COLUMN_NAME, indented_name,
				COLUMN_SENSITIVE, TRUE,
				COLUMN_SOURCE, s->data,
				-1);

			uid = e_source_peek_uid (s->data);
			path = gtk_tree_model_get_path (model, &iter);
			g_hash_table_insert (
				priv->uid_index, g_strdup (uid),
				gtk_tree_row_reference_new (model, path));
			gtk_tree_path_free (path);

			g_free (indented_name);
		}
		g_slist_free (sources);
	}

	/* Set the visible column based on whether we've seen a color. */
	iter_valid = gtk_tree_model_get_iter_first (model, &iter);
	while (iter_valid) {
		gtk_list_store_set (
			store, &iter, COLUMN_VISIBLE, visible, -1);
		iter_valid = gtk_tree_model_iter_next (model, &iter);
	}
}
Example #7
0
void
dates_update_calendars (ESourceList *cal_list, DatesData *d)
{
    GSList *groups, *g;

    /* TODO: Don't reload *all* calendars on update */
    d->dcal = NULL;
    gtk_list_store_clear (d->cal_list_store);
    dates_view_remove_all_calendars (d->view);
    groups = e_source_list_peek_groups (cal_list);

#ifdef DEBUG
    if (d->debug & DATES_DEBUG_CALENDAR)
	g_debug ("Updating Calendars");
#endif

    /* Disable creating of calendars until we know there's a valid
     * calendar to add events to.
     */
	d->cal_loaded = FALSE;
	
	if (d->TBNew)
	{
#ifdef DEBUG
		if (d->debug & DATES_DEBUG_CALENDAR)
			g_debug ("*** Setting TBNew button insensitive ***");
#endif
		gtk_widget_set_sensitive (d->TBNew, FALSE);
	}
	
    for (g = groups; g; g = g->next) {
	GSList *sources, *s;
#ifdef DEBUG
	if (d->debug & DATES_DEBUG_CALENDAR)
	    g_debug ("Group %s (%s)",
		     e_source_group_peek_name (
			 E_SOURCE_GROUP (g->data)),
		     e_source_group_peek_base_uri (
			 E_SOURCE_GROUP (g->data)));
#endif
	sources = e_source_group_peek_sources (
	    E_SOURCE_GROUP (g->data));
	for (s = sources; s; s = s->next) {
	    ESource *source = E_SOURCE (s->data);
	    ECal *ecal;
			
	    ecal = dates_load_esource (source,
				 E_CAL_SOURCE_TYPE_EVENT, NULL, d);
	    if (!ecal) {
#ifdef DEBUG
		if (d->debug & DATES_DEBUG_CALENDAR)
		    g_debug ("No EVENTS in this source");
#endif
		continue;
	    }

#ifdef DEBUG
	    if (d->debug & DATES_DEBUG_CALENDAR)
		g_debug ("Found EVENTS in this source");
#endif

	    g_signal_connect (G_OBJECT (ecal), "cal_opened",
			      G_CALLBACK (dates_cal_open_cb), d);

	    e_cal_open_async (ecal, FALSE);
	    
	    /* 
	     * Set the calendar mode to CAL_MODE_REMOTE. This is necessary to get the
	     * remote (webcal) calendars to work. It doesn't seem to have any effect
	     * on the file backend.
	     */
	    e_cal_set_mode (ecal, CAL_MODE_REMOTE);
	}
    }	
}