Ejemplo n.º 1
0
static void
source_viewer_source_changed_cb (ESourceRegistry *registry,
                                 ESource *source,
                                 ESourceViewer *viewer)
{
	ESource *selected;

	source_viewer_update_row (viewer, source);

	selected = e_source_viewer_ref_selected_source (viewer);
	if (selected != NULL) {
		if (e_source_equal (source, selected))
			source_viewer_set_text (viewer, source);
		g_object_unref (selected);
	}
}
Ejemplo n.º 2
0
void
contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
{
	EContactListEditor *editor;
	ESource *source;

	editor = contact_list_editor_extract (widget);
	source = e_source_combo_box_get_active (E_SOURCE_COMBO_BOX (widget));

	if (e_source_equal (e_book_get_source (editor->priv->book), source))
		return;

	editor->priv->load_book = e_book_new (source, NULL);
	editor->priv->load_source_id = addressbook_load (
		editor->priv->load_book, (EBookCallback)
		contact_list_editor_book_loaded, editor);
}
Ejemplo n.º 3
0
/* The clients are just created here but not loaded */
static ECal *
get_ecal_from_source (ESource        *esource,
		      ECalSourceType  source_type,
		      GSList         *existing_clients)
{
  ECal *retval;

  if (existing_clients)
    {
      GSList *l;

      for (l = existing_clients; l; l = l->next)
	{
	  ECal *client = E_CAL (l->data);

	  if (e_source_equal (esource, e_cal_get_source (client)))
	    {
	      dprintf ("        load_esource: found existing source ... returning that\n");

	      return g_object_ref (client);
	    }
	}
    }

  retval = e_cal_new (esource, source_type);
  if (!retval)
    {
      g_warning ("Could not load source '%s' from '%s'\n",
		 e_source_peek_name (esource),
		 e_source_peek_relative_uri (esource));
      return NULL;
    }

  e_cal_set_auth_func (retval, auth_func_cb, NULL);

  return retval;
}
Ejemplo n.º 4
0
/* The following function taken from gnome clock-applet
 * (gnome-panel/applets/clock/calendar-sources.c)
 */
ECal *
dates_load_esource (ESource        *esource,
	      ECalSourceType  source_type,
	      GSList         *existing_clients,
	      DatesData      *d)
{
    ECal   *retval;
    GError *error;


    if (existing_clients)
    {
	GSList *l;

	for (l = existing_clients; l; l = l->next)
	{
	    ECal *client = E_CAL (l->data);

	    if (e_source_equal (esource, e_cal_get_source (client)))
	    {
#ifdef DEBUG
		if (d->debug & DATES_DEBUG_CALENDAR)
		    g_debug ("load_esource: found existing source, returning that");
#endif
		return g_object_ref (client);
	    }
	}
    }

    retval = e_cal_new (esource, source_type);
    if (!retval)
    {
	g_warning ("Could not load source '%s' from '%s'\n",
		   e_source_peek_name (esource),
		   e_source_get_uri (esource));
	return NULL;
    }

    error = NULL;
    if (!e_cal_open (retval, FALSE, &error))
    {
	g_assert (error != NULL);
	g_warning ("Cannot open calendar from uri '%s': %s\n",
		   e_cal_get_uri (retval), error->message);
	g_error_free (error);
	g_object_unref (retval);
	return NULL;
    }
#ifdef DEBUG
    if (d->debug & DATES_DEBUG_CALENDAR)
	g_debug ("Loaded calendar from uri '%s'",
		 e_cal_get_uri (retval));
#endif

    /* 
     * 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 (retval, CAL_MODE_REMOTE);

    return retval;
}