File: plugins.h

package info (click to toggle)
jpilot 0.97-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,244 kB
  • ctags: 957
  • sloc: ansic: 13,558; makefile: 192; sh: 153
file content (128 lines) | stat: -rw-r--r-- 3,421 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* plugins.h
 * 
 * Copyright (C) 1999 by Judd Montgomery
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#include "config.h"
#ifdef  ENABLE_PLUGINS

# ifndef __PLUGINS_H__
#define __PLUGINS_H__

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>

struct search_result
{
   char *line;
   unsigned int unique_id;
   struct search_result *next;
};

typedef struct
{
   char *base_dir;
   int *major_version;
   int *minor_version;
} jp_startup_info;

struct plugin_s
{
   char *full_path;
   void *handle;
   char *name;
   char *menu_name;
   char *help_name;
   char *db_name;
   int number;
   int (*plugin_get_name)(char *name, int len);
   int (*plugin_get_menu_name)(char *name, int len);
   int (*plugin_get_help_name)(char *name, int len);
   int (*plugin_get_db_name)(char *db_name, int len);
   int (*plugin_startup)(jp_startup_info *info);
   int (*plugin_gui)(GtkWidget *vbox, GtkWidget *hbox, unsigned int unique_id);
   int (*plugin_help)(char **text, int *width, int *height);
   int (*plugin_gui_cleanup)(void);
   int (*plugin_pre_sync)(void);
   int (*plugin_sync)(int sd);
   int (*plugin_search)(char *search_string, int case_sense, struct search_result **sr);
   int (*plugin_post_sync)(void);
   int (*plugin_exit_cleanup)(void);
};

int load_plugins();
GList *get_plugin_list();

/*
 * Read a pdb file out of the $(JPILOT_HOME || HOME)/.jpilot directory
 * It also reads the PC file
 */
int jp_read_DB_files(char *DB_name, GList *records);

/*
 * Free the record list
 */
int jp_free_DB_records(GList **records);

/*
 * Free the search_result record list
 */
void free_search_result(struct search_result **sr);

/*
 * Free the plugin_list
 */
void free_plugin_list(GList **plugin_list);

/*
 *  * Write a new Record
 *  */
int jp_write_new_DB_record(void *new_record);

/*
 * Delete a Record
 */
int jp_delete_DB_record(void *record);

/* functions that may, or may not be implemented by the plugin */

/*
 * This will be called during the sync process.
 * DB_name is the name of a DB to be synced during the Sync process.
 * You can not implement this function if syncing isn't desired.
 */


/*
 * These should be implemented by the plugin library if needed
 */
int plugin_get_name(char *name, int len);
int plugin_get_menu_name(char *name, int len);
int plugin_get_help_name(char *name, int len);
int plugin_get_db_name(char *name, int len);
int plugin_startup(jp_startup_info *info);
int plugin_gui(GtkWidget *vbox, GtkWidget *hbox, unsigned int unique_id);
int plugin_help(char **text, int *width, int *height);
int plugin_gui_cleanup(void);
int plugin_pre_sync(void);
int plugin_sync(int sd);
int plugin_post_sync(void);
int plugin_exit_cleanup(void);
                            
#endif
#endif