Changeset 112

Show
Ignore:
Timestamp:
01/10/05 19:12:55 (4 years ago)
Author:
abauer
Message:

Added evo2_sync.h for the evo path struct

Added the missing list functions for tasks and addressbook in the plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/engine/osengine_engine.c

    r109 r112  
    595595void osync_engine_finalize(OSyncEngine *engine) 
    596596{ 
     597        g_assert(engine); 
    597598        _osync_debug(engine, "ENG", 3, "finalizing engine %p", engine); 
    598599        g_main_loop_quit(engine->syncloop); 
     
    618619osync_bool osync_engine_synchronize(OSyncEngine *engine, OSyncError **error) 
    619620{ 
     621        g_assert(engine); 
    620622        osync_flag_set(engine->fl_running); 
    621623        return TRUE; 
  • trunk/plugins/evolution2_sync/src/Makefile.am

    r33 r112  
    11plugindir=@OPENSYNC_PLUGINDIR@/plugins 
    22configdir=@OPENSYNC_CONFIGDIR@/defaults 
    3  
     3headerdir=$(includedir)/opensync/ 
    44INCLUDES = @PACKAGE_CFLAGS@ 
    55 
     
    88#FIXME: the 'evo2-sync' file is missing from subversion 
    99config_DATA = evo2-sync 
     10 
     11header_HEADERS = \ 
     12        evo2_sync.h 
    1013 
    1114plugin_LTLIBRARIES = evo2_sync.la 
  • trunk/plugins/evolution2_sync/src/evo2-sync

    r34 r112  
    1 <config><adress_path></adress_path><calendat_path></calendar_path><tasks_path></tasks_path></config> 
     1<config><adress_path></adress_path><calendar_path></calendar_path><tasks_path></tasks_path></config> 
  • trunk/plugins/evolution2_sync/src/evolution_sync.c

    r111 r112  
    1717                for (s = e_source_group_peek_sources (group); s; s = s->next) { 
    1818                        source = E_SOURCE (s->data); 
    19                         char *path = g_strdup_printf("%s:%s", e_source_get_uri(source), e_source_peek_name(source)); 
     19                        evo2_location *path = g_malloc0(sizeof(evo2_location)); 
     20                        path->uri = g_strdup(e_source_get_uri(source)); 
     21                        path->name = g_strdup(e_source_peek_name(source)); 
     22                        paths = g_list_append(paths, path); 
     23                } 
     24        } 
     25        return paths; 
     26
     27 
     28GList *evo2_list_tasks(evo_environment *env, void *data) 
     29
     30        GList *paths = NULL; 
     31        ESourceList *sources = NULL; 
     32        ESource *source = NULL; 
     33         
     34        if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_TODO, NULL)) { 
     35                return NULL; 
     36        } 
     37 
     38        GSList *g = NULL; 
     39        for (g = e_source_list_peek_groups (sources); g; g = g->next) { 
     40                ESourceGroup *group = E_SOURCE_GROUP (g->data); 
     41                GSList *s = NULL; 
     42                for (s = e_source_group_peek_sources (group); s; s = s->next) { 
     43                        source = E_SOURCE (s->data); 
     44                        evo2_location *path = g_malloc0(sizeof(evo2_location)); 
     45                        path->uri = g_strdup(e_source_get_uri(source)); 
     46                        path->name = g_strdup(e_source_peek_name(source)); 
     47                        paths = g_list_append(paths, path); 
     48                } 
     49        } 
     50        return paths; 
     51
     52 
     53GList *evo2_list_addressbooks(evo_environment *env, void *data) 
     54
     55        GList *paths = NULL; 
     56        ESourceList *sources = NULL; 
     57        ESource *source = NULL; 
     58         
     59        if (!e_book_get_addressbooks(&sources, NULL)) { 
     60            return NULL; 
     61    } 
     62 
     63        GSList *g = NULL; 
     64        for (g = e_source_list_peek_groups (sources); g; g = g->next) { 
     65                ESourceGroup *group = E_SOURCE_GROUP (g->data); 
     66                GSList *s = NULL; 
     67                for (s = e_source_group_peek_sources (group); s; s = s->next) { 
     68                        source = E_SOURCE (s->data); 
     69                        evo2_location *path = g_malloc0(sizeof(evo2_location)); 
     70                        path->uri = g_strdup(e_source_get_uri(source)); 
     71                        path->name = g_strdup(e_source_peek_name(source)); 
    2072                        paths = g_list_append(paths, path); 
    2173                } 
  • trunk/plugins/evolution2_sync/src/evolution_sync.h

    r60 r112  
    11#ifndef EVO2_SYNC_H 
    22#define EVO2_SYNC_H 
     3 
     4#include "evo2_sync.h" 
    35 
    46#include <opensync/opensync.h> 
  • trunk/src/opensync_env.c

    r109 r112  
    520520        osync_bool ret = FALSE; 
    521521        GError *error = NULL; 
     522         
     523        if (!filename) { 
     524                osync_debug("OSYNC", 3, "No file open specified"); 
     525                osync_error_set(oserror, OSYNC_ERROR_IO_ERROR, "No file to open specified"); 
     526                return FALSE; 
     527        } 
    522528        GIOChannel *chan = g_io_channel_new_file(filename, "r", &error); 
    523529        if (!chan) { 
  • trunk/src/opensync_member.c

    r109 r112  
    8787}        
    8888 
     89void osync_member_unload_plugin(OSyncMember *member) 
     90{ 
     91        g_assert(member); 
     92        if (!member->plugin) 
     93                return; 
     94                 
     95        if (!member->plugin->info.is_threadsafe) { 
     96                osync_plugin_unload(member->plugin); 
     97                osync_plugin_free(member->plugin); 
     98        } 
     99         
     100        g_list_free(member->objtype_sinks); 
     101        g_list_free(member->format_sinks); 
     102        //Really free the formats! 
     103         
     104        member->objtype_sinks = NULL; 
     105        member->format_sinks = NULL; 
     106        member->plugin = NULL; 
     107} 
     108 
    89109osync_bool osync_member_instance_plugin(OSyncMember *member, OSyncPlugin *plugin, OSyncError **error) 
    90110{ 
     
    92112        g_assert(plugin); 
    93113        osync_debug("OSMEM", 3, "Instancing plugin %s for member %i", plugin->info.name, member->id); 
     114        osync_member_unload_plugin(member); 
     115         
    94116        if (plugin->info.is_threadsafe) { 
    95117                member->plugin = plugin; 
     
    126148} 
    127149 
     150OSyncPlugin *osync_member_get_plugin(OSyncMember *member) 
     151{ 
     152        g_assert(member); 
     153        return member->plugin; 
     154} 
     155 
    128156const char *osync_member_get_pluginname(OSyncMember *member) 
    129157{ 
     
    145173        if (!osync_member_read_config(member, data, size, error)) { 
    146174                char *filename = g_strdup_printf(OPENSYNC_CONFIGDIR"/defaults/%s", osync_plugin_get_name(member->plugin)); 
    147                 osync_debug("OSMEM", 3, "Reading default config file for member %i", member->id); 
     175                osync_debug("OSMEM", 3, "Reading default2 config file for member %lli from %s", member->id, filename); 
    148176                ret = osync_file_read(filename, data, size, error); 
    149177                g_free(filename); 
  • trunk/src/opensync_member.h

    r109 r112  
    33 
    44osync_bool osync_member_instance_plugin(OSyncMember *member, OSyncPlugin *plugin, OSyncError **error); 
    5 osync_bool osync_member_set_name(OSyncMember *member, char *name); 
    6 const char *osync_member_get_name(OSyncMember *member); 
     5OSyncPlugin *osync_member_get_plugin(OSyncMember *member); 
     6 
    77const char *osync_member_get_configdir(OSyncMember *member); 
    88osync_bool osync_member_get_config(OSyncMember *member, char **data, int *size, OSyncError **error);