Changeset 859

Show
Ignore:
Timestamp:
03/03/06 15:25:22 (3 years ago)
Author:
ehabkost
Message:

Revert revision 800: "Removed osync_plugin_accept_(objtype|format)"

The refactoring of the osync_plugin_accept_*() functions will be done
after the IPC code is working.

Location:
branches/ipc-branch/opensync
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/ipc-branch/opensync/opensync_member.c

    r849 r859  
    14931493} 
    14941494 
    1495 void osync_member_accept_objtype(OSyncMember *member, const char *objtypestr) 
    1496 { 
    1497         OSyncObjTypeTemplate *template = osync_plugin_find_objtype_template(member->plugin, objtypestr); 
    1498   OSyncObjTypeSink *sink = osync_objtype_sink_from_template(member->group, template); 
    1499  
    1500   member->objtype_sinks = g_list_append(member->objtype_sinks, sink); 
    1501 } 
    1502  
    1503 void osync_member_accept_objformat(OSyncMember *member, const char *objtypestr, const char *formatstr, const char *extension) 
    1504 { 
    1505         OSyncObjTypeTemplate *template = osync_plugin_find_objtype_template(member->plugin, objtypestr); 
    1506         osync_assert(template, "Unable to accept objformat. Did you forget to add the objtype?"); 
    1507  
    1508   OSyncObjFormatTemplate *format_template = osync_plugin_find_objformat_template(template, formatstr); 
    1509         OSyncObjFormatSink *sink = osync_objformat_sink_from_template(member->group, format_template); 
    1510  
    1511   member->format_sinks = g_list_append(member->format_sinks, sink); 
    1512 } 
    1513  
    1514 void osync_member_clear_accepted_types(OSyncMember *member) 
    1515 { 
    1516   int i; 
    1517  
    1518   for (i = 0; i < g_list_length(member->objtype_sinks); ++i) 
    1519     osync_objtypesink_free(g_list_nth_data(member->objtype_sinks, i)); 
    1520   g_list_free(member->objtype_sinks); 
    1521  
    1522   for (i = 0; i < g_list_length(member->format_sinks); ++i) 
    1523     osync_objtypesink_free(g_list_nth_data(member->format_sinks, i)); 
    1524   g_list_free(member->format_sinks); 
    1525 } 
    1526  
    1527 void osync_objtypesink_free(OSyncObjTypeSink *sink) 
    1528 { 
    1529   g_list_free(sink->formatsinks); 
    1530   g_list_free(sink->properties); 
    1531 } 
    1532  
    1533 void osync_objformatsink_free(OSyncObjFormatSink *sink) 
    1534 { 
    1535   g_free(sink->extension_name); 
    1536   g_list_free(sink->commit_changes); 
    1537   g_list_free(sink->commit_contexts); 
    1538 } 
    1539  
    15401495/*@}*/ 
  • branches/ipc-branch/opensync/opensync_member.h

    r800 r859  
    7272void *osync_member_get_plugindata(OSyncMember *member); 
    7373 
    74 void osync_member_accept_objtype(OSyncMember *member, const char *objtypestr); 
    75 void osync_member_accept_objformat(OSyncMember *member, const char *objtypestr, const char *formatstr, const char *extension); 
    76 void osync_member_clear_accepted_types(OSyncMember *member); 
    77  
    7874void *osync_member_get_loop(OSyncMember *member); 
    7975void osync_member_set_loop(OSyncMember *member, void *loop); 
  • branches/ipc-branch/opensync/opensync_member_internals.h

    r800 r859  
    4949OSyncObjFormatSink *osync_member_make_random_data(OSyncMember *member, OSyncChange *change, const char *objtypename); 
    5050osync_bool osync_member_require_sink_info(OSyncMember *member, OSyncError **error); 
    51  
    52 void osync_objtypesink_free(OSyncObjTypeSink *sink); 
    53 void osync_objformatsink_free(OSyncObjFormatSink *sink); 
    54  
  • branches/ipc-branch/opensync/opensync_plugin.c

    r823 r859  
    557557} 
    558558 
     559/*! @brief Tells opensync that the plugin can accepts this object 
     560 *  
     561 * Tells opensync that the plugin can accepts this object. Used by the plugin 
     562 * in the get_info() function 
     563 *  
     564 * @param info The plugin info on which to operate 
     565 * @param objtypestr The name of the object which to accept 
     566 *  
     567 */ 
     568void osync_plugin_accept_objtype(OSyncPluginInfo *info, const char *objtypestr) 
     569{ 
     570        OSyncObjTypeTemplate *template = g_malloc0(sizeof(OSyncObjTypeTemplate)); 
     571        template->name = g_strdup(objtypestr); 
     572        info->plugin->accepted_objtypes = g_list_append(info->plugin->accepted_objtypes, template); 
     573} 
     574 
     575/*! @brief Tells opensync that the plugin can accepts this format for the given object 
     576 *  
     577 * Tells opensync that the plugin can accepts this format. Used by the plugin 
     578 * in the get_info() function 
     579 *  
     580 * @param info The plugin info on which to operate 
     581 * @param objtypestr The name of the objecttype 
     582 * @param formatstr The name of the format to accept 
     583 * @param extension The name of the extension that the plugin wants. NULL if none 
     584 *  
     585 */ 
     586void osync_plugin_accept_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, const char *extension) 
     587{ 
     588        OSyncObjTypeTemplate *template = osync_plugin_find_objtype_template(info->plugin, objtypestr); 
     589        osync_assert(template, "Unable to accept objformat. Did you forget to add the objtype?"); 
     590        OSyncObjFormatTemplate *format_template = g_malloc0(sizeof(OSyncObjFormatTemplate)); 
     591        format_template->name = g_strdup(formatstr); 
     592        if (extension) 
     593                format_template->extension_name = g_strdup(extension); 
     594        template->formats = g_list_append(template->formats, format_template); 
     595} 
     596 
    559597/*@}*/ 
  • branches/ipc-branch/opensync/opensync_plugin.h

    r800 r859  
    132132 
    133133void *osync_plugin_get_function(OSyncPlugin *plugin, const char *name, OSyncError **error); 
     134void osync_plugin_accept_objtype(OSyncPluginInfo *info, const char *objtypestr); 
     135void osync_plugin_accept_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, const char *extension); 
    134136void osync_plugin_set_commit_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommitFn commit_change); 
    135137void osync_plugin_set_access_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatAccessFn access_fn);