[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src prefs.c,1.31.2.5,1.31.2.6 prefs.h,1.6.2.
From: |
Andy Maloney <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src prefs.c,1.31.2.5,1.31.2.6 prefs.h,1.6.2.4,1.6.2.5 prefs_window.c,1.5.2.4,1.5.2.5 |
Date: |
Fri, 28 Mar 2003 13:04:38 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv28176/src
Modified Files:
Tag: new_prefs
prefs.c prefs.h prefs_window.c
Log Message:
Second step for module prefs
Finish moving reading/writing of all prefs into prefs.c
Many other changes
Index: prefs.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs.c,v
retrieving revision 1.31.2.5
retrieving revision 1.31.2.6
diff -u -r1.31.2.5 -r1.31.2.6
--- prefs.c 28 Mar 2003 12:40:57 -0000 1.31.2.5
+++ prefs.c 28 Mar 2003 18:04:36 -0000 1.31.2.6
@@ -62,16 +62,27 @@
static const int font_size_default = 4;
-static int compare_ptr_key(gconstpointer a, gconstpointer b)
+static int s_compare_ptr_key( const void *a, const void *b )
{
- if(!strcmp( ((ptr_list *)a)->key, (char *)b))
- return(0);
- return(1);
+ if ( !strcmp( ((ptr_list *)a)->key, (const char *)b) )
+ return( 0 );
+
+ return( 1 );
+}
+
+static int s_compare_plugin_name( const void *a, const void *b)
+{
+ const module_pref *pref = a;
+
+ if ( pref->name && !strcmp( pref->name, (const char *)b) )
+ return( 0 );
+
+ return( 1 );
}
-static void AddPref( const char *key, void *data )
+static void s_AddPref( const char *key, void *data )
{
- ptr_list *PrefData = calloc( 1, sizeof(ptr_list) );
+ ptr_list *PrefData = calloc( 1, sizeof( ptr_list ) );
strcpy( PrefData->key, key );
PrefData->value=(void *)data;
@@ -79,20 +90,27 @@
s_global_prefs = l_list_append( s_global_prefs, PrefData );
}
-static char *strip_whitespace( char *inStr )
+static char *s_strip_whitespace( char *inStr )
{
char *ptr = inStr;
int len = strlen( inStr );
+ if ( (inStr == NULL) || (inStr[0] == '\0') )
+ return( inStr );
+
while ( isspace( *ptr ) )
ptr++;
if ( ptr != inStr )
- memmove( inStr, ptr, len - (ptr - inStr) );
+ {
+ const int new_len = len - (ptr - inStr);
+
+ memmove( inStr, ptr, new_len );
+ inStr[new_len] = '\0';
+ }
len = strlen( inStr ) - 1;
-
ptr = inStr + len;
while ( isspace( *ptr ) )
@@ -107,7 +125,126 @@
return( inStr );
}
-static LList *create_module_prefs_list( void )
+static char *s_strdup_allow_null( const char *inStr )
+{
+ if ( inStr == NULL )
+ return( NULL );
+
+ return( strdup( inStr ) );
+}
+
+static char *s_strdup_pref( const char *inStr )
+{
+ char *returnStr = NULL;
+
+ returnStr = calloc( 1, MAX_PREF_LEN );
+
+ if ( inStr == NULL )
+ returnStr[0] = '\0';
+ else
+ strncpy( returnStr, inStr, MAX_PREF_LEN );
+
+ return( returnStr );
+}
+
+static input_list *s_copy_input_list( input_list *inList )
+{
+ input_list *new_list = NULL;
+ input_list *list = inList;
+ input_list *prev = NULL;
+
+
+ while ( list != NULL )
+ {
+ input_list *new_item = calloc( 1, sizeof( input_list ) );
+
+
+ new_item->type = list->type;
+ new_item->next = NULL;
+
+ switch( list->type )
+ {
+ case EB_INPUT_CHECKBOX:
+ {
+ new_item->widget.checkbox.name =
s_strdup_allow_null( list->widget.checkbox.name );
+ new_item->widget.checkbox.label =
s_strdup_allow_null( list->widget.checkbox.label );
+ new_item->widget.checkbox.value =
calloc( 1, sizeof( int ) );
+
+ if ( list->widget.checkbox.value !=
NULL )
+
*(new_item->widget.checkbox.value) = *(list->widget.checkbox.value);
+
+ }
+ break;
+
+ case EB_INPUT_ENTRY:
+ {
+ new_item->widget.entry.name =
s_strdup_allow_null( list->widget.entry.name );
+ new_item->widget.entry.label =
s_strdup_allow_null( list->widget.entry.label );
+ new_item->widget.entry.value =
s_strdup_pref( list->widget.entry.value );
+ new_item->widget.entry.entry = NULL;
/* this will be filled in when rendered - we ignore this field */
+ }
+ break;
+
+ default:
+ assert( FALSE );
+ break;
+ }
+
+ if ( prev == NULL )
+ new_list = new_item;
+ else
+ prev->next = new_item;
+
+ prev = new_item;
+
+ list = list->next;
+ }
+
+ return( new_list );
+}
+
+static void s_destroy_input_list( input_list *inList )
+{
+ input_list *list = inList;
+
+
+ while ( list != NULL )
+ {
+ input_list *saved = list;
+
+ switch( list->type )
+ {
+ case EB_INPUT_CHECKBOX:
+ {
+ free( list->widget.checkbox.name );
+ free( list->widget.checkbox.label );
+ free( list->widget.checkbox.value );
+ }
+ break;
+
+ case EB_INPUT_ENTRY:
+ {
+ free( list->widget.entry.name );
+ free( list->widget.entry.label );
+ free( list->widget.entry.value );
+ }
+ break;
+
+ default:
+ assert( FALSE );
+ break;
+ }
+
+ list = list->next;
+
+ memset( saved, 0, sizeof( input_list ) );
+
+ free( saved );
+ }
+}
+
+
+static LList *s_create_module_prefs_list( void )
{
const LList *plugins = GetPref( EB_PLUGIN_LIST );
LList *module_prefs_list = NULL;
@@ -115,22 +252,23 @@
for ( ; plugins; plugins = plugins->next )
{
const eb_PLUGIN_INFO *epi = plugins->data;
- plugin_pref *pref_info = NULL;
+ module_pref *pref_info = NULL;
if ( epi == NULL )
continue;
- pref_info = calloc( 1, sizeof( plugin_pref ) );
+ pref_info = calloc( 1, sizeof( module_pref ) );
pref_info->type = PLUGIN_TYPE_TXT[epi->pi.type-1];
- pref_info->brief_desc = strdup( epi->pi.brief_desc );
+ pref_info->brief_desc = s_strdup_allow_null( epi->pi.brief_desc
);
pref_info->status = PLUGIN_STATUS_TXT[epi->status];
- pref_info->version = strdup( epi->pi.version );
- pref_info->date = strdup( epi->pi.date );
- pref_info->name = strdup( epi->name );
- pref_info->status_desc = strdup( epi->status_desc );
- pref_info->service_name = strdup( epi->service );
+ pref_info->version = s_strdup_allow_null( epi->pi.version );
+ pref_info->date = s_strdup_allow_null( epi->pi.date );
+ pref_info->name = s_strdup_allow_null( epi->name );
+ pref_info->status_desc = s_strdup_allow_null( epi->status_desc
);
+ pref_info->service_name = s_strdup_allow_null( epi->service );
+ pref_info->pref_list = s_copy_input_list( epi->pi.prefs );
module_prefs_list = l_list_append( module_prefs_list,
pref_info);
}
@@ -138,11 +276,11 @@
return( l_list_nth( module_prefs_list, 0 ) );
}
-static void destroy_module_prefs_list( LList *io_module_prefs_list )
+static void s_destroy_module_prefs_list( LList *io_module_prefs_list )
{
for ( ; io_module_prefs_list != NULL; io_module_prefs_list =
io_module_prefs_list->next )
{
- plugin_pref *pref_info = io_module_prefs_list->data;
+ module_pref *pref_info = io_module_prefs_list->data;
if ( pref_info == NULL )
@@ -154,21 +292,107 @@
free( (void *)pref_info->name );
free( (void *)pref_info->status_desc );
free( (void *)pref_info->service_name );
+
+ s_destroy_input_list( pref_info->pref_list );
}
l_list_free( io_module_prefs_list );
}
-static void free_pref_struct( struct prefs *ioPrefs )
+static void s_free_pref_struct( struct prefs *ioPrefs )
{
if ( ioPrefs == NULL )
return;
// clean up memory
- destroy_module_prefs_list( ioPrefs->module.module_info );
+ s_destroy_module_prefs_list( ioPrefs->module.module_info );
free( ioPrefs );
}
+static void s_write_module_prefs( void *inListItem, void *inData )
+{
+ eb_PLUGIN_INFO *plugin_info = inListItem;
+ FILE *fp = (FILE *)inData;
+ LList *master_prefs = NULL;
+ LList *current_prefs = NULL;
+
+
+ fprintf( fp, "\t%s\n", plugin_info->name );
+
+ master_prefs = GetPref( plugin_info->name );
+ master_prefs = value_pair_remove( master_prefs, "load" );
+ current_prefs = eb_input_to_value_pair( plugin_info->pi.prefs );
+
+ if ( plugin_info->status == PLUGIN_LOADED )
+ value_pair_add( current_prefs, "load", "1" );
+ else
+ value_pair_add( current_prefs, "load", "0" );
+
+ master_prefs = value_pair_update( master_prefs, current_prefs );
+ SetPref( plugin_info->name, master_prefs );
+ value_pair_print_values( master_prefs, fp, 2 );
+ fprintf( fp, "\tend\n" );
+ value_pair_free( current_prefs );
+}
+
+static void s_apply_or_cancel_module_prefs( void *inListItem, void *inData )
+{
+ module_pref *the_prefs = inListItem;
+ int apply = (int)inData;
+
+
+ if ( apply )
+ {
+ eb_PLUGIN_INFO *plugin_info = NULL;
+
+
+ /* now we have to apply to the things that have pointers in the
'real' list
+ NOTE that this will hopefully be solved by changing the
way prefs are
+ applied to plugins
+ */
+ plugin_info = FindPluginByName( the_prefs->name );
+
+ if ( plugin_info != NULL )
+ {
+ input_list *real_list = plugin_info->pi.prefs;
+ input_list *local_copy = the_prefs->pref_list;
+
+ while ( real_list != NULL )
+ {
+ switch ( real_list->type )
+ {
+ case EB_INPUT_CHECKBOX:
+ {
+ if (
(real_list->widget.checkbox.value != NULL) &&
+
(local_copy->widget.checkbox.value != NULL) )
+ {
+
*(real_list->widget.checkbox.value) = *(local_copy->widget.checkbox.value);
+ }
+
+ }
+ break;
+
+ case EB_INPUT_ENTRY:
+ {
+ strncpy(
real_list->widget.entry.value, local_copy->widget.entry.value, MAX_PREF_LEN );
+ }
+ break;
+
+ default:
+ assert( FALSE );
+ break;
+ }
+
+ real_list = real_list->next;
+
+ assert( local_copy != NULL );
+
+ local_copy = local_copy->next;
+ }
+ }
+ }
+}
+
void ayttm_prefs_init( void )
{
@@ -219,19 +443,6 @@
cSetLocalPref( "accel_prev_tab", "<Control>Left" );
cSetLocalPref( "accel_next_tab", "<Control>Right" );
- /* modules */
-#ifdef __MINGW32__
- {
- const int buff_size = 1024;
- char buff[buff_size];
-
- snprintf( buff, buff_size, "%s%s", config_dir, MODULE_DIR );
- cSetLocalPref( "modules_path", buff );
- }
-#else
- cSetLocalPref( "modules_path", MODULE_DIR );
-#endif
-
/* sound */
iSetLocalPref( "do_no_sound_when_away", 0 );
iSetLocalPref( "do_no_sound_for_ignore", 1 );
@@ -285,6 +496,19 @@
iSetLocalPref( "use_recoding", 0 );
cSetLocalPref( "local_encoding", "" );
cSetLocalPref( "remote_encoding", "" );
+
+ /* modules */
+#ifdef __MINGW32__
+ {
+ const int buff_size = 1024;
+ char buff[buff_size];
+
+ snprintf( buff, buff_size, "%s%s", config_dir, MODULE_DIR );
+ cSetLocalPref( "modules_path", buff );
+ }
+#else
+ cSetLocalPref( "modules_path", MODULE_DIR );
+#endif
}
void ayttm_prefs_read( void )
@@ -314,7 +538,7 @@
char *val = buff;
- strip_whitespace( param );
+ s_strip_whitespace( param );
if ( !strcasecmp( param, "plugins" ) )
pref_type = PLUGIN_PREF;
@@ -332,7 +556,7 @@
fgets( param, buffer_size, fp );
- strip_whitespace( param );
+ s_strip_whitespace( param );
if ( !strcasecmp( param, "end" ) )
break;
@@ -358,7 +582,7 @@
fgets( param, buffer_size, fp );
- strip_whitespace( param );
+ s_strip_whitespace( param );
if ( !strcasecmp( param, "end" ) )
{
@@ -496,10 +720,8 @@
fprintf( fp, "do_smiley=%d\n", iGetLocalPref("do_smiley" ) );
fprintf( fp, "accel_next_tab=%s\n", cGetLocalPref("accel_next_tab") );
fprintf( fp, "accel_prev_tab=%s\n", cGetLocalPref("accel_prev_tab") );
-
- /* modules */
- fprintf( fp, "modules_path=%s\n", cGetLocalPref("modules_path") );
-
+ fprintf( fp, "end\n" );
+
/* sound */
fprintf( fp, "do_no_sound_when_away=%d\n",
iGetLocalPref("do_no_sound_when_away") );
fprintf( fp, "do_no_sound_for_ignore=%d\n",
iGetLocalPref("do_no_sound_for_ignore") );
@@ -527,6 +749,11 @@
fprintf( fp, "local_encoding=%s\n", cGetLocalPref("local_encoding") );
fprintf( fp, "remote_encoding=%s\n", cGetLocalPref("remote_encoding") );
+ /* modules */
+ fprintf( fp, "modules_path=%s\n", cGetLocalPref("modules_path") );
+ fprintf( fp, "plugins\n" );
+ l_list_foreach( GetPref(EB_PLUGIN_LIST), s_write_module_prefs, fp );
+
fprintf( fp, "end\n" );
fclose( fp );
@@ -571,9 +798,6 @@
strncpy( prefs->chat.accel_next_tab, cGetLocalPref("accel_next_tab"),
MAX_PREF_LEN );
strncpy( prefs->chat.accel_prev_tab, cGetLocalPref("accel_prev_tab"),
MAX_PREF_LEN );
-
- /* modules */
- prefs->module.module_info = create_module_prefs_list();
/* sound prefs */
prefs->sound.do_no_sound_when_away =
iGetLocalPref("do_no_sound_when_away");
@@ -603,10 +827,34 @@
prefs->advanced.use_recoding = iGetLocalPref("use_recoding");
strncpy( prefs->advanced.local_encoding,
cGetLocalPref("local_encoding"), MAX_PREF_LEN );
strncpy( prefs->advanced.remote_encoding,
cGetLocalPref("remote_encoding"), MAX_PREF_LEN );
+
+ /* modules */
+ prefs->module.module_info = s_create_module_prefs_list();
prefs_window_create( prefs );
}
+module_pref *ayttm_prefs_find_module_by_name( const struct prefs *inPrefs,
const char *inName )
+{
+ LList *module_list = NULL;
+ LList *search_result =NULL;
+
+ if ( (inPrefs == NULL) || (inName == NULL) )
+ return( NULL );
+
+ module_list = inPrefs->module.module_info;
+
+ if ( module_list == NULL )
+ return( NULL );
+
+ search_result = l_list_find_custom( module_list, inName,
s_compare_plugin_name );
+
+ if ( search_result == NULL )
+ return( NULL );
+
+ return( search_result->data );
+}
+
void ayttm_prefs_apply( struct prefs *inPrefs )
{
assert( inPrefs != NULL );
@@ -640,8 +888,6 @@
cSetLocalPref( "accel_prev_tab", inPrefs->chat.accel_prev_tab );
cSetLocalPref( "accel_next_tab", inPrefs->chat.accel_next_tab );
-
- /* modules */
/* sound */
iSetLocalPref( "do_no_sound_when_away",
inPrefs->sound.do_no_sound_when_away );
@@ -671,6 +917,9 @@
iSetLocalPref( "use_recoding", inPrefs->advanced.use_recoding );
cSetLocalPref( "local_encoding", inPrefs->advanced.local_encoding );
cSetLocalPref( "remote_encoding", inPrefs->advanced.remote_encoding );
+
+ /* modules */
+ l_list_foreach( inPrefs->module.module_info,
s_apply_or_cancel_module_prefs, (void *)1 );
ayttm_prefs_write();
@@ -680,101 +929,110 @@
proxy_set_auth( iGetLocalPref("do_proxy_auth"),
cGetLocalPref("proxy_user"), cGetLocalPref("proxy_password") );
}
- free_pref_struct( inPrefs );
+ s_free_pref_struct( inPrefs );
}
void ayttm_prefs_cancel( struct prefs *inPrefs )
{
- free_pref_struct( inPrefs );
+ assert( inPrefs != NULL );
+
+ l_list_foreach( inPrefs->module.module_info,
s_apply_or_cancel_module_prefs, (void *)0 );
+
+ s_free_pref_struct( inPrefs );
}
/* Find old pref data, and replace with new, returning old data */
-void *SetPref( const char *key, void *data )
+void *SetPref( const char *key, void *data )
{
ptr_list *PrefData = NULL;
void *old_data = NULL;
- LList *ListData = l_list_find_custom(s_global_prefs, key,
compare_ptr_key);
+ LList *ListData = l_list_find_custom( s_global_prefs, key,
s_compare_ptr_key );
- if (!ListData)
+ if ( !ListData )
{
- AddPref(key, data);
- return(NULL);
+ s_AddPref( key, data );
+
+ return( NULL );
}
- PrefData=(ptr_list *)ListData->data;
- old_data=PrefData->value;
+
+ PrefData = (ptr_list *)ListData->data;
+ old_data = PrefData->value;
PrefData->value=data;
- return(old_data);
+
+ return( old_data );
}
-void *GetPref(const char *key)
+void *GetPref( const char *key )
{
ptr_list *PrefData = NULL;
- LList *ListData = l_list_find_custom(s_global_prefs, key,
compare_ptr_key);
+ LList *ListData = l_list_find_custom( s_global_prefs, key,
s_compare_ptr_key );
- if(!ListData)
- return(NULL);
+ if( !ListData )
+ return( NULL );
+
PrefData = ListData->data;
- if(!PrefData)
- return(NULL);
- return(PrefData->value);
+ if ( !PrefData )
+ return( NULL );
+
+ return( PrefData->value );
}
-void cSetLocalPref(const char *key, char *data)
+void cSetLocalPref( const char *key, char *data )
{
char newkey[MAX_PREF_NAME_LEN];
char *oldvalue = NULL;
- snprintf(newkey, MAX_PREF_NAME_LEN, "Local::%s", key);
- oldvalue = SetPref(newkey, strdup(data));
- if(oldvalue)
- g_free(oldvalue);
- return;
+ snprintf( newkey, MAX_PREF_NAME_LEN, "Local::%s", key );
+ oldvalue = SetPref( newkey, strdup(data) );
+ if ( oldvalue )
+ free( oldvalue );
}
-void iSetLocalPref(const char *key, int data)
+void iSetLocalPref( const char *key, int data )
{
char value[MAX_PREF_LEN];
- snprintf(value, MAX_PREF_LEN, "%i", data);
- cSetLocalPref(key, value);
- return;
+ snprintf( value, MAX_PREF_LEN, "%i", data );
+ cSetLocalPref( key, value );
}
-void fSetLocalPref(const char *key, float data)
+void fSetLocalPref( const char *key, float data )
{
char value[MAX_PREF_LEN];
- snprintf(value, MAX_PREF_LEN, "%f", data);
- cSetLocalPref(key, value);
- return;
+ snprintf( value, MAX_PREF_LEN, "%f", data );
+ cSetLocalPref( key, value );
}
-char *cGetLocalPref(const char *key)
+char *cGetLocalPref(const char *key)
{
char newkey[MAX_PREF_NAME_LEN];
char *value = NULL;
snprintf( newkey, MAX_PREF_NAME_LEN, "Local::%s", key );
- value = (char *)GetPref(newkey);
- if(!value)
+ value = (char *)GetPref( newkey );
+ if ( !value )
value="";
- return(value);
+
+ return( value );
}
-float fGetLocalPref(const char *key)
+float fGetLocalPref( const char *key )
{
float value = 0.0;
- value=atof(cGetLocalPref(key));
- return(value);
+ value = atof( cGetLocalPref( key ) );
+
+ return( value );
}
-int iGetLocalPref(const char *key)
+int iGetLocalPref( const char *key )
{
int value = 0;
- value=atoi(cGetLocalPref(key));
- return(value);
+ value = atoi( cGetLocalPref( key ) );
+
+ return( value );
}
/* Used when loading service modules later, so passwords and user names are
still available
Index: prefs.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs.h,v
retrieving revision 1.6.2.4
retrieving revision 1.6.2.5
diff -u -r1.6.2.4 -r1.6.2.5
--- prefs.h 28 Mar 2003 12:40:58 -0000 1.6.2.4
+++ prefs.h 28 Mar 2003 18:04:36 -0000 1.6.2.5
@@ -25,7 +25,7 @@
#ifndef __PREFS_H__
#define __PREFS_H__
-#include "llist.h"
+#include "input_list.h"
#define MAX_PREF_NAME_LEN 255
@@ -43,10 +43,12 @@
const char *status;
const char *version;
const char *date;
- const char *name; /* File Name */
- const char *status_desc; /* Error description */
- const char *service_name; /* NULL if not service */
-} plugin_pref;
+ const char *name;
+ const char *status_desc;
+ const char *service_name;
+
+ input_list *pref_list;
+} module_pref;
struct prefs
{
@@ -90,11 +92,6 @@
struct
{
- LList *module_info;
- } module;
-
- struct
- {
int do_no_sound_when_away;
int do_no_sound_for_ignore;
int do_online_sound;
@@ -126,6 +123,11 @@
char local_encoding[MAX_PREF_LEN];
char remote_encoding[MAX_PREF_LEN];
} advanced;
+
+ struct
+ {
+ LList *module_info;
+ } module;
};
@@ -133,26 +135,27 @@
void ayttm_prefs_read( void );
void ayttm_prefs_write( void );
-void ayttm_prefs_show_window( void );
-void ayttm_prefs_apply( struct prefs *inPrefs );
-void ayttm_prefs_cancel( struct prefs *inPrefs );
+void ayttm_prefs_show_window( void );
+module_pref *ayttm_prefs_find_module_by_name( const struct prefs *inPrefs,
const char *inName );
+void ayttm_prefs_apply( struct prefs *inPrefs );
+void ayttm_prefs_cancel( struct prefs *inPrefs );
#if defined(__MINGW32__) && defined(__IN_PLUGIN__)
-__declspec(dllimport) void *GetPref(const char *key);
+__declspec(dllimport) void *GetPref( const char *key );
#else
-void *GetPref(const char *key);
+void *GetPref( const char *key );
#endif
-void *SetPref(const char *key, void *data);
+void *SetPref( const char *key, void *data );
-void iSetLocalPref(const char *key, int data);
-int iGetLocalPref(const char *key);
+void iSetLocalPref( const char *key, int data );
+int iGetLocalPref( const char *key );
-void fSetLocalPref(const char *key, float data);
-float fGetLocalPref(const char *key);
+void fSetLocalPref( const char *key, float data );
+float fGetLocalPref( const char *key);
-void cSetLocalPref(const char *key, char *data);
-char *cGetLocalPref(const char *key);
+void cSetLocalPref( const char *key, char *data );
+char *cGetLocalPref( const char *key );
void save_account_info( const char *service, LList *pairs );
Index: prefs_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs_window.c,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -r1.5.2.4 -r1.5.2.5
--- prefs_window.c 28 Mar 2003 12:42:48 -0000 1.5.2.4
+++ prefs_window.c 28 Mar 2003 18:04:36 -0000 1.5.2.5
@@ -593,7 +593,7 @@
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_accelerator_parse( s_prefs->chat.accel_next_tab,
&(local_accel_next_tab.keyval), &(local_accel_next_tab.modifiers) );
- gtk_accelerator_parse( s_prefs->chat.accel_next_tab,
&(local_accel_prev_tab.keyval), &(local_accel_prev_tab.modifiers) );
+ gtk_accelerator_parse( s_prefs->chat.accel_prev_tab,
&(local_accel_prev_tab.keyval), &(local_accel_prev_tab.modifiers) );
add_key_set(_("Hotkey to go to previous tab (requires a modifier)"),
&local_accel_prev_tab, vbox);
add_key_set(_("Hotkey to go to next tab (requires a modifier)"),
&local_accel_next_tab, vbox);
@@ -926,7 +926,7 @@
for ( ; module_info != NULL; module_info = module_info->next )
{
- plugin_pref *pref_info = module_info->data;
+ module_pref *pref_info = module_info->data;
if ( pref_info == NULL )
continue;
@@ -971,6 +971,7 @@
eb_import_window(import_submenuitem);
gtk_widget_draw(GTK_WIDGET(import_submenuitem), NULL);
}
+
void rebuild_profile_menu()
{
GtkWidget *profile_submenuitem;
@@ -1024,28 +1025,32 @@
static void plugin_selected(GtkCList *clist, int row, int column,
GdkEventButton *event, gpointer userdata)
{
- char *plugin_path=NULL;
- eb_PLUGIN_INFO *epi=NULL;
+ char *plugin_path=NULL;
+ module_pref *pref_info;
- if(!event)
+ if ( !event )
return;
+
eb_debug(DBG_CORE, "row: %i column: %i button: %i\n", row, column,
event->button);
gtk_clist_get_text(GTK_CLIST(clist), row, PLUGIN_PATH_COL,
&plugin_path);
eb_debug(DBG_CORE, "plugin: %s\n", plugin_path);
- epi=FindPluginByName(plugin_path);
- if(!epi) {
- fprintf(stderr, "Unable to find plugin %s in plugin
list!\n", plugin_path);
- return;
+ pref_info = ayttm_prefs_find_module_by_name( s_prefs, plugin_path );
+
+ if ( !pref_info )
+ {
+ fprintf( stderr, "Unable to find plugin %s in plugin list!\n",
plugin_path );
+ return;
}
- if(event->button == 1)
+
+ if ( event->button == 1 )
{
GString *windowName = g_string_new( NULL );
const char *pluginDescr = _("Plugin");
- if ( epi->service != NULL )
- pluginDescr = epi->service;
+ if ( pref_info->service_name != NULL )
+ pluginDescr = pref_info->service_name;
windowName = g_string_append( windowName, pluginDescr );
windowName = g_string_append( windowName, _(" Preferences") );
@@ -1084,24 +1089,26 @@
GtkWidget *buttonHBox = gtk_hbox_new( TRUE, 5 );
GtkWidget *vbox = gtk_vbox_new( FALSE, 5 );
-
/* Show the plugin prefs */
- if ( epi->pi.prefs != NULL )
- eb_input_render( epi->pi.prefs, vbox );
- else {
+ if ( pref_info->pref_list != NULL )
+ {
+ eb_input_render( pref_info->pref_list, vbox );
+ }
+ else
+ {
GtkLabel *label = GTK_LABEL(gtk_label_new( NULL
));
GString *labelText = g_string_new( _("No
preferences for ") );
int newWidth = 0;
int newHeight = 0;
- if ( epi->service != NULL )
+ if ( pref_info->service_name != NULL )
{
- labelText = g_string_append( labelText,
epi->service );
+ labelText = g_string_append( labelText,
pref_info->service_name );
}
else
{
labelText = g_string_append( labelText, "'" );
- labelText = g_string_append( labelText,
epi->pi.brief_desc );
+ labelText = g_string_append( labelText,
pref_info->brief_desc );
labelText = g_string_append( labelText, "'" );
}
@@ -1144,7 +1151,7 @@
gtk_widget_show( button );
gtk_signal_connect( GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(update_plugin_prefs),
(gpointer)epi->pi.prefs );
+ GTK_SIGNAL_FUNC(update_plugin_prefs),
(gpointer)pref_info->pref_list );
gtk_container_add( GTK_CONTAINER(button), hbox );
@@ -1167,7 +1174,7 @@
gtk_widget_show( button );
gtk_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(cancel_plugin_prefs),
(gpointer)epi->pi.prefs );
+ GTK_SIGNAL_FUNC(cancel_plugin_prefs),
(gpointer)pref_info->pref_list );
gtk_container_add( GTK_CONTAINER (button), hbox );
@@ -1245,8 +1252,7 @@
gtk_widget_show(w);
gtk_box_pack_start(GTK_BOX(vbox), w, TRUE, TRUE, 10);
- SetPref("widget::module_list", module_list);
- build_modules_list(module_list);
+ build_modules_list( module_list );
gtk_clist_set_reorderable(GTK_CLIST(module_list), TRUE);
gtk_clist_set_auto_sort(GTK_CLIST(module_list), TRUE);
@@ -1276,30 +1282,6 @@
static void set_module_prefs( void )
{
-/*
- GList *plugins=NULL;
- LList *master_prefs=NULL;
- LList *current_prefs=NULL;
- eb_PLUGIN_INFO *epi=NULL;
-
- fprintf(fp,"plugins\n");
- for(plugins=GetPref(EB_PLUGIN_LIST); plugins; plugins=plugins->next) {
- epi=plugins->data;
- fprintf(fp, "\t%s\n", epi->name);
- master_prefs=GetPref(epi->name);
- master_prefs=value_pair_remove(master_prefs, "load");
- current_prefs=eb_input_to_value_pair(epi->pi.prefs);
- if(epi->status==PLUGIN_LOADED)
- value_pair_add(current_prefs, "load", "1");
- else
- value_pair_add(current_prefs, "load", "0");
- master_prefs=value_pair_update(master_prefs, current_prefs);
- SetPref(epi->name, master_prefs);
- value_pair_print_values(master_prefs, fp, 2);
- fprintf(fp, "\tend\n");
- value_pair_free(current_prefs);
- }
- fprintf(fp,"end\n");*/
}
/*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src prefs.c,1.31.2.5,1.31.2.6 prefs.h,1.6.2.4,1.6.2.5 prefs_window.c,1.5.2.4,1.5.2.5,
Andy Maloney <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/src plugin.c,1.9.2.1,1.9.2.2 plugin.h,1.7,1.7.2.1
- Next by Date:
[Ayttm-commits] CVS: ayttm/src add_contact_window.c,1.21,1.22 away_window.c,1.16,1.17 edit_account_window.c,1.14,1.15 edit_contact_window.c,1.14,1.15 smileys.c,1.21,1.22trigger.c,1.14,1.15
- Previous by thread:
[Ayttm-commits] CVS: ayttm/src plugin.c,1.9.2.1,1.9.2.2 plugin.h,1.7,1.7.2.1
- Next by thread:
[Ayttm-commits] CVS: ayttm/src add_contact_window.c,1.21,1.22 away_window.c,1.16,1.17 edit_account_window.c,1.14,1.15 edit_contact_window.c,1.14,1.15 smileys.c,1.21,1.22trigger.c,1.14,1.15
- Index(es):