anjuta r4880 - in branches/preferences_singleton: . libanjuta manuals/reference/libanjuta plugins/build-basic-autotools plugins/class-inheritance plugins/cvs-plugin plugins/debug-manager plugins/document-manager plugins/file-loader plugins/file-manager plugins/gdb plugins/macro plugins/message-view plugins/project-import plugins/project-wizard plugins/scintilla plugins/scratchbox plugins/sourceview plugins/subversion plugins/symbol-db plugins/terminal plugins/tools src
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4880 - in branches/preferences_singleton: . libanjuta manuals/reference/libanjuta plugins/build-basic-autotools plugins/class-inheritance plugins/cvs-plugin plugins/debug-manager plugins/document-manager plugins/file-loader plugins/file-manager plugins/gdb plugins/macro plugins/message-view plugins/project-import plugins/project-wizard plugins/scintilla plugins/scratchbox plugins/sourceview plugins/subversion plugins/symbol-db plugins/terminal plugins/tools src
- Date: Thu, 19 Mar 2009 13:31:18 +0000 (UTC)
Author: jhs
Date: Thu Mar 19 13:31:18 2009
New Revision: 4880
URL: http://svn.gnome.org/viewvc/anjuta?rev=4880&view=rev
Log:
Update preferences in plugins
Modified:
branches/preferences_singleton/ChangeLog
branches/preferences_singleton/libanjuta/anjuta-preferences-dialog.c
branches/preferences_singleton/libanjuta/anjuta-preferences.c
branches/preferences_singleton/libanjuta/anjuta-preferences.h
branches/preferences_singleton/manuals/reference/libanjuta/libanjuta.types
branches/preferences_singleton/plugins/build-basic-autotools/plugin.c
branches/preferences_singleton/plugins/class-inheritance/class-inherit.c
branches/preferences_singleton/plugins/cvs-plugin/cvs-callbacks.c
branches/preferences_singleton/plugins/debug-manager/command.c
branches/preferences_singleton/plugins/debug-manager/info.c
branches/preferences_singleton/plugins/debug-manager/registers.c
branches/preferences_singleton/plugins/debug-manager/stack_trace.c
branches/preferences_singleton/plugins/document-manager/plugin.c
branches/preferences_singleton/plugins/file-loader/plugin.c
branches/preferences_singleton/plugins/file-manager/plugin.c
branches/preferences_singleton/plugins/gdb/debugger.c
branches/preferences_singleton/plugins/macro/macro-util.c
branches/preferences_singleton/plugins/message-view/anjuta-msgman.c
branches/preferences_singleton/plugins/message-view/anjuta-msgman.h
branches/preferences_singleton/plugins/message-view/message-view.c
branches/preferences_singleton/plugins/message-view/message-view.h
branches/preferences_singleton/plugins/message-view/plugin.c
branches/preferences_singleton/plugins/project-import/project-import.c
branches/preferences_singleton/plugins/project-wizard/druid.c
branches/preferences_singleton/plugins/project-wizard/parser.c
branches/preferences_singleton/plugins/scintilla/text_editor.c
branches/preferences_singleton/plugins/scintilla/text_editor.h
branches/preferences_singleton/plugins/scintilla/text_editor_prefs.c
branches/preferences_singleton/plugins/scratchbox/plugin.c
branches/preferences_singleton/plugins/sourceview/sourceview-prefs.c
branches/preferences_singleton/plugins/sourceview/sourceview-private.h
branches/preferences_singleton/plugins/subversion/subversion-ui-utils.c
branches/preferences_singleton/plugins/symbol-db/symbol-db-prefs.c
branches/preferences_singleton/plugins/terminal/terminal.c
branches/preferences_singleton/plugins/tools/fileop.c
branches/preferences_singleton/src/anjuta-app.c
Modified: branches/preferences_singleton/libanjuta/anjuta-preferences-dialog.c
==============================================================================
--- branches/preferences_singleton/libanjuta/anjuta-preferences-dialog.c (original)
+++ branches/preferences_singleton/libanjuta/anjuta-preferences-dialog.c Thu Mar 19 13:31:18 2009
@@ -270,10 +270,10 @@
COL_PIXBUF, icon,
COL_WIDGET, page,
-1);
-
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dlg->priv->store),
- &first);
- gtk_tree_selection_select_iter (selection, &first);
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dlg->priv->store),
+ &first);
+ gtk_tree_selection_select_iter (selection, &first);
}
/**
Modified: branches/preferences_singleton/libanjuta/anjuta-preferences.c
==============================================================================
--- branches/preferences_singleton/libanjuta/anjuta-preferences.c (original)
+++ branches/preferences_singleton/libanjuta/anjuta-preferences.c Thu Mar 19 13:31:18 2009
@@ -114,7 +114,6 @@
struct _AnjutaPreferencesForeachData
{
AnjutaPreferences *pr;
- AnjutaPreferencesFilterType filter;
AnjutaPreferencesCallback callback;
gpointer callback_data;
};
@@ -132,6 +131,14 @@
return buffer;
}
+static const gchar*
+unbuild_key (const gchar* key)
+{
+ if (g_str_has_prefix (key, GCONF_KEY_PREFIX))
+ return key + strlen (GCONF_KEY_PREFIX);
+ return NULL;
+}
+
/**
* anjuta_preferences_get:
* @pr: A #AnjutaPreferences object
@@ -267,9 +274,6 @@
case GCONF_VALUE_INT:
ret_val = gconf_value_get_int (value);
break;
- case GCONF_VALUE_BOOL:
- ret_val = gconf_value_get_bool (value);
- break;
default:
g_warning ("Invalid gconf type for key: %s", key);
}
@@ -1085,10 +1089,7 @@
{
if (p->object_type != ANJUTA_PROPERTY_OBJECT_TYPE_COMBO)
{
- if (data->filter == ANJUTA_PREFERENCES_FILTER_NONE)
- return data->callback (data->pr, key, data->callback_data);
- else if (p->flags & data->filter)
- return data->callback (data->pr, key, data->callback_data);
+ return data->callback (data->pr, key, data->callback_data);
}
return TRUE;
@@ -1300,9 +1301,7 @@
data_type == ANJUTA_PROPERTY_DATA_TYPE_BOOL) ||
(value->type == GCONF_VALUE_INT &&
data_type == ANJUTA_PROPERTY_DATA_TYPE_INT) ||
- (value->type == GCONF_VALUE_STRING &&
- data_type != ANJUTA_PROPERTY_DATA_TYPE_BOOL &&
- data_type != ANJUTA_PROPERTY_DATA_TYPE_INT)))
+ (value->type == GCONF_VALUE_STRING)))
{
gconf_client_unset (pr->priv->gclient, build_key (key), NULL);
}
@@ -1527,14 +1526,12 @@
*/
void
anjuta_preferences_foreach (AnjutaPreferences *pr,
- AnjutaPreferencesFilterType filter,
AnjutaPreferencesCallback callback,
gpointer data)
{
struct _AnjutaPreferencesForeachData foreach_data;
foreach_data.pr = pr;
- foreach_data.filter = filter;
foreach_data.callback = callback;
foreach_data.callback_data = data;
@@ -1834,24 +1831,28 @@
GUINT_TO_POINTER(id));
if (entry->value)
{
+ const gchar* real_key = unbuild_key (entry->key);
switch (entry->value->type)
{
case GCONF_VALUE_INT:
{
AnjutaPreferencesNotifyInt int_func = notify;
- int_func (prefs, gconf_value_get_int (entry->value), user_data);
+ int_func (prefs, real_key,
+ gconf_value_get_int (entry->value), user_data);
break;
}
case GCONF_VALUE_STRING:
{
AnjutaPreferencesNotify str_func = notify;
- str_func (prefs, gconf_value_get_string (entry->value), user_data);
+ str_func (prefs, real_key,
+ gconf_value_get_string (entry->value), user_data);
break;
}
case GCONF_VALUE_BOOL:
{
AnjutaPreferencesNotifyBool bool_func = notify;
- bool_func (prefs, gconf_value_get_bool (entry->value), user_data);
+ bool_func (prefs, real_key,
+ gconf_value_get_bool (entry->value), user_data);
break;
}
default:
@@ -1872,13 +1873,13 @@
build_key (key),
(GConfClientNotifyFunc) gconf_notify, data, destroy_notify, NULL);
g_hash_table_insert (pr->priv->notifications,
- GUINT_TO_POINTER (id),
+ id,
func);
return id;
}
/**
- * anjuta_preferences_notify_add:
+ * anjuta_preferences_notify_add_string:
* @pr: A #AnjutaPreferences object.
* @key: Key to monitor.
* @func: User callback function.
@@ -1892,7 +1893,7 @@
* Return value: Notify ID.
*/
guint
-anjuta_preferences_notify_add (AnjutaPreferences *pr,
+anjuta_preferences_notify_add_string (AnjutaPreferences *pr,
const gchar *key,
AnjutaPreferencesNotify func,
gpointer data,
@@ -1903,7 +1904,7 @@
build_key (key),
(GConfClientNotifyFunc)gconf_notify, data, destroy_notify, NULL);
g_hash_table_insert (pr->priv->notifications,
- GUINT_TO_POINTER (id),
+ id,
func);
return id;
}
@@ -1920,7 +1921,7 @@
build_key (key),
(GConfClientNotifyFunc)gconf_notify, data, destroy_notify, NULL);
g_hash_table_insert (pr->priv->notifications,
- GUINT_TO_POINTER (id),
+ id,
func);
return id;
}
Modified: branches/preferences_singleton/libanjuta/anjuta-preferences.h
==============================================================================
--- branches/preferences_singleton/libanjuta/anjuta-preferences.h (original)
+++ branches/preferences_singleton/libanjuta/anjuta-preferences.h Thu Mar 19 13:31:18 2009
@@ -50,12 +50,6 @@
ANJUTA_PROPERTY_DATA_TYPE_FONT
} AnjutaPropertyDataType;
-typedef enum
-{
- ANJUTA_PREFERENCES_FILTER_NONE = 0,
- ANJUTA_PREFERENCES_FILTER_PROJECT = 1
-} AnjutaPreferencesFilterType;
-
typedef struct _AnjutaProperty AnjutaProperty;
/* Get functions. Add more get functions for AnjutaProperty, if required */
@@ -133,29 +127,10 @@
void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
-gboolean
-anjuta_preferences_load_gconf (AnjutaPreferences *pr);
-
-gboolean
-anjuta_preferences_save (AnjutaPreferences *pr, FILE *stream);
-
-/* Save excluding the filtered properties. This will save only those
- * properties which DOES NOT have the flags set to values given by the filter.
- */
-gboolean
-anjuta_preferences_save_filtered (AnjutaPreferences *pr, FILE *stream,
- AnjutaPreferencesFilterType filter);
-gboolean
-anjuta_preferences_save_gconf (AnjutaPreferences *pr,
- AnjutaPreferencesFilterType filter);
-
-
-
/* Calls the callback function for each of the properties with the flags
* matching with the given filter
*/
void anjuta_preferences_foreach (AnjutaPreferences *pr,
- AnjutaPreferencesFilterType filter,
AnjutaPreferencesCallback callback,
gpointer data);
@@ -215,14 +190,18 @@
/* Key notifications */
typedef void (*AnjutaPreferencesNotify) (AnjutaPreferences *pr,
- const gchar* value,
- gpointer data);
+ const gchar* key,
+ const gchar* value,
+ gpointer data);
typedef void (*AnjutaPreferencesNotifyInt) (AnjutaPreferences *pr,
- gint value,
- gpointer data);
-typedef void (*AnjutaPreferencesNotifyBool) (AnjutaPreferences *pr,
- gboolean value,
+ const gchar* key,
+ gint value,
gpointer data);
+typedef void (*AnjutaPreferencesNotifyBool) (AnjutaPreferences *pr,
+ const gchar* key,
+
+ gboolean value,
+ gpointer data);
guint anjuta_preferences_notify_add_int (AnjutaPreferences *pr,
const gchar *key,
@@ -230,11 +209,11 @@
gpointer data,
GFreeFunc destroy_notify);
-guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
- const gchar *key,
- AnjutaPreferencesNotify func,
- gpointer data,
- GFreeFunc destroy_notify);
+guint anjuta_preferences_notify_add_string (AnjutaPreferences *pr,
+ const gchar *key,
+ AnjutaPreferencesNotify func,
+ gpointer data,
+ GFreeFunc destroy_notify);
guint anjuta_preferences_notify_add_bool (AnjutaPreferences *pr,
const gchar *key,
Modified: branches/preferences_singleton/manuals/reference/libanjuta/libanjuta.types
==============================================================================
--- branches/preferences_singleton/manuals/reference/libanjuta/libanjuta.types (original)
+++ branches/preferences_singleton/manuals/reference/libanjuta/libanjuta.types Thu Mar 19 13:31:18 2009
@@ -5,7 +5,6 @@
anjuta_ui_get_type
anjuta_status_get_type
anjuta_plugin_handle_get_type
-anjuta_cell_renderer_captioned_image_get_type
anjuta_plugin_get_type
anjuta_preferences_dialog_get_type
anjuta_plugin_manager_get_type
@@ -13,7 +12,6 @@
anjuta_encoding_get_type
anjuta_save_prompt_get_type
anjuta_session_get_type
-anjuta_c_module_get_type
anjuta_profile_get_type
anjuta_preferences_get_type
anjuta_launcher_get_type
@@ -25,7 +23,6 @@
anjuta_profile_error_get_type
anjuta_property_object_type_get_type
anjuta_property_data_type_get_type
-anjuta_preferences_filter_type_get_type
anjuta_launcher_output_type_get_type
anjuta_session_phase_get_type
anjuta_serializer_mode_get_type
@@ -33,7 +30,6 @@
anjuta_command_get_type
anjuta_profile_manager_get_type
g_error_get_type
-anjuta_c_plugin_factory_get_type
anjuta_vcs_status_tree_view_get_type
anjuta_async_command_get_type
anjuta_message_area_get_type
Modified: branches/preferences_singleton/plugins/build-basic-autotools/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/build-basic-autotools/plugin.c (original)
+++ branches/preferences_singleton/plugins/build-basic-autotools/plugin.c Thu Mar 19 13:31:18 2009
@@ -1224,22 +1224,6 @@
return context;
}
-/* Save all current anjuta files */
-static void
-save_all_files (AnjutaPlugin *plugin)
-{
- IAnjutaDocumentManager *docman;
- IAnjutaFileSavable* save;
-
- docman = anjuta_shell_get_interface (plugin->shell, IAnjutaDocumentManager, NULL);
- /* No document manager, so no file to save */
- if (docman != NULL)
- {
- save = IANJUTA_FILE_SAVABLE (docman);
- if (save) ianjuta_file_savable_save (save, NULL);
- }
-}
-
static void
build_set_command_in_context (BuildContext* context, BuildProgram *prog)
{
Modified: branches/preferences_singleton/plugins/class-inheritance/class-inherit.c
==============================================================================
--- branches/preferences_singleton/plugins/class-inheritance/class-inherit.c (original)
+++ branches/preferences_singleton/plugins/class-inheritance/class-inherit.c Thu Mar 19 13:31:18 2009
@@ -65,7 +65,7 @@
static gint
gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
{
- return (gint)a - (gint)b;
+ return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
}
gchar *
Modified: branches/preferences_singleton/plugins/cvs-plugin/cvs-callbacks.c
==============================================================================
--- branches/preferences_singleton/plugins/cvs-plugin/cvs-callbacks.c (original)
+++ branches/preferences_singleton/plugins/cvs-plugin/cvs-callbacks.c Thu Mar 19 13:31:18 2009
@@ -60,7 +60,7 @@
gchar* message = g_strdup_printf(_("Please fill field: %s"), stringname);
GtkWidget* dlg = gtk_message_dialog_new(GTK_WINDOW(dialog),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE, message);
+ GTK_BUTTONS_CLOSE, "%s", message);
gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
return FALSE;
Modified: branches/preferences_singleton/plugins/debug-manager/command.c
==============================================================================
--- branches/preferences_singleton/plugins/debug-manager/command.c (original)
+++ branches/preferences_singleton/plugins/debug-manager/command.c Thu Mar 19 13:31:18 2009
@@ -1155,7 +1155,6 @@
gboolean ret = FALSE;
DmaDebuggerCommandType type = cmd->type & COMMAND_MASK;
IAnjutaDebuggerCallback callback = cmd->callback == NULL ? NULL : dma_debugger_queue_command_callback;
- GFile* file;
switch (type)
{
case EMPTY_COMMAND:
Modified: branches/preferences_singleton/plugins/debug-manager/info.c
==============================================================================
--- branches/preferences_singleton/plugins/debug-manager/info.c (original)
+++ branches/preferences_singleton/plugins/debug-manager/info.c Thu Mar 19 13:31:18 2009
@@ -179,7 +179,7 @@
if (!g_spawn_command_line_sync (command_line, &std_output,
NULL, NULL, &err))
{
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
return FALSE;
Modified: branches/preferences_singleton/plugins/debug-manager/registers.c
==============================================================================
--- branches/preferences_singleton/plugins/debug-manager/registers.c (original)
+++ branches/preferences_singleton/plugins/debug-manager/registers.c Thu Mar 19 13:31:18 2009
@@ -308,13 +308,13 @@
on_find_register_list (gconstpointer a, gconstpointer b)
{
const DmaThreadRegisterList *regs = (const DmaThreadRegisterList *)a;
- guint thread = (gint)b;
+ guint thread = GPOINTER_TO_UINT(b);
return regs->thread != thread;
}
static void
-dma_thread_set_register_list (CpuRegisters *self, gint thread)
+dma_thread_set_register_list (CpuRegisters *self, guint thread)
{
GList *list;
DmaThreadRegisterList *regs;
@@ -323,7 +323,7 @@
if (self->current->thread != thread)
{
- list = g_list_find_custom (self->list, (gconstpointer) thread, on_find_register_list);
+ list = g_list_find_custom (self->list, GUINT_TO_POINTER(thread), on_find_register_list);
if (list == NULL)
{
Modified: branches/preferences_singleton/plugins/debug-manager/stack_trace.c
==============================================================================
--- branches/preferences_singleton/plugins/debug-manager/stack_trace.c (original)
+++ branches/preferences_singleton/plugins/debug-manager/stack_trace.c Thu Mar 19 13:31:18 2009
@@ -381,13 +381,13 @@
on_find_stack_trace (gconstpointer a, gconstpointer b)
{
const DmaThreadStackTrace *trace = (const DmaThreadStackTrace *)a;
- guint thread = (gint)b;
+ guint thread = GPOINTER_TO_UINT(b);
return trace->thread != thread;
}
static void
-dma_thread_set_stack_trace (StackTrace *self, gint thread)
+dma_thread_set_stack_trace (StackTrace *self, guint thread)
{
GList *list;
DmaThreadStackTrace *trace;
@@ -396,7 +396,7 @@
{
self->current_frame = 0;
- list = g_list_find_custom (self->list, (gconstpointer) thread, on_find_stack_trace);
+ list = g_list_find_custom (self->list, GINT_TO_POINTER(thread), on_find_stack_trace);
if (list == NULL)
{
Modified: branches/preferences_singleton/plugins/document-manager/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/document-manager/plugin.c (original)
+++ branches/preferences_singleton/plugins/document-manager/plugin.c Thu Mar 19 13:31:18 2009
@@ -1481,8 +1481,8 @@
}
static void
-on_gconf_notify_prefs (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_prefs (AnjutaPreferences* prefs,
+ const gchar* key, gint value, gpointer user_data)
{
DocmanPlugin *ep = ANJUTA_PLUGIN_DOCMAN (user_data);
docman_plugin_set_tab_pos (ep);
@@ -1554,19 +1554,18 @@
}
static void
-on_gconf_notify_timer (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_timer (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
DocmanPlugin *plugin;
AnjutaDocman *docman;
- AnjutaPreferences* prefs;
gint auto_save_timer;
gboolean auto_save;
plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
docman = ANJUTA_DOCMAN (plugin->docman);
-
- prefs = anjuta_shell_get_preferences (docman->shell, NULL);
auto_save_timer = anjuta_preferences_get_int(prefs, AUTOSAVE_TIMER);
auto_save = anjuta_preferences_get_int(prefs, SAVE_AUTOMATIC);
@@ -1599,8 +1598,8 @@
}
}
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (ep->prefs, \
+#define REGISTER_NOTIFY(key, func, type) \
+ notify_id = anjuta_preferences_notify_add_##type (ep->prefs, \
key, func, ep, NULL); \
ep->gconf_notify_ids = g_list_prepend (ep->gconf_notify_ids, \
GUINT_TO_POINTER (notify_id));
@@ -1609,12 +1608,12 @@
{
guint notify_id;
docman_plugin_set_tab_pos (ep);
- REGISTER_NOTIFY (EDITOR_TABS_HIDE, on_gconf_notify_prefs);
- REGISTER_NOTIFY (EDITOR_TABS_POS, on_gconf_notify_prefs);
- REGISTER_NOTIFY (AUTOSAVE_TIMER, on_gconf_notify_timer);
- REGISTER_NOTIFY (SAVE_AUTOMATIC, on_gconf_notify_timer);
+ REGISTER_NOTIFY (EDITOR_TABS_HIDE, on_notify_prefs, bool);
+ REGISTER_NOTIFY (EDITOR_TABS_POS, on_notify_prefs, int);
+ REGISTER_NOTIFY (AUTOSAVE_TIMER, on_notify_timer, bool);
+ REGISTER_NOTIFY (SAVE_AUTOMATIC, on_notify_timer, bool);
- on_gconf_notify_timer(NULL,0,NULL, ep);
+ on_notify_timer(anjuta_preferences_default(), NULL, FALSE, ep);
}
static void
Modified: branches/preferences_singleton/plugins/file-loader/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/file-loader/plugin.c (original)
+++ branches/preferences_singleton/plugins/file-loader/plugin.c Thu Mar 19 13:31:18 2009
@@ -222,9 +222,10 @@
parent =
gtk_widget_get_toplevel (GTK_WIDGET(ANJUTA_PLUGIN (plugin)->shell));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK_CANCEL, message);
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK_CANCEL, "%s",
+ message);
g_free (message);
hbox = gtk_hbox_new (FALSE, 5);
Modified: branches/preferences_singleton/plugins/file-manager/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/file-manager/plugin.c (original)
+++ branches/preferences_singleton/plugins/file-manager/plugin.c Thu Mar 19 13:31:18 2009
@@ -46,8 +46,8 @@
#define PREF_FILTER_BACKUP "filemanager.filter.backup"
#define PREF_FILTER_UNVERSIONED "filemanager.filter.unversioned"
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (file_manager->prefs, \
+#define REGISTER_NOTIFY(key, func, type) \
+ notify_id = anjuta_preferences_notify_add_##type (file_manager->prefs, \
key, func, file_manager, NULL); \
file_manager->gconf_notify_ids = g_list_prepend (file_manager->gconf_notify_ids, \
GUINT_TO_POINTER(notify_id));
@@ -243,8 +243,10 @@
}
static void
-on_gconf_notify_root(GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_root(AnjutaPreferences* prefs,
+ const gchar* key,
+ const gchar* value,
+ gpointer user_data)
{
AnjutaFileManager* file_manager = (AnjutaFileManager*) user_data;
if (!file_manager->have_project)
@@ -253,9 +255,12 @@
file_view_refresh (file_manager->fv);
}
}
+
static void
-on_gconf_notify(GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify(AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
AnjutaFileManager* file_manager = (AnjutaFileManager*) user_data;
GtkTreeModel* sort_model = gtk_tree_view_get_model (GTK_TREE_VIEW (file_manager->fv));
@@ -329,12 +334,12 @@
project_root_removed, NULL);
- REGISTER_NOTIFY (PREF_ROOT, on_gconf_notify_root);
- REGISTER_NOTIFY (PREF_FILTER_BINARY, on_gconf_notify);
- REGISTER_NOTIFY (PREF_FILTER_BACKUP, on_gconf_notify);
- REGISTER_NOTIFY (PREF_FILTER_HIDDEN, on_gconf_notify);
- REGISTER_NOTIFY (PREF_FILTER_UNVERSIONED, on_gconf_notify);
- on_gconf_notify (NULL, 0, NULL, file_manager);
+ REGISTER_NOTIFY (PREF_ROOT, on_notify_root, string);
+ REGISTER_NOTIFY (PREF_FILTER_BINARY, on_notify, bool);
+ REGISTER_NOTIFY (PREF_FILTER_BACKUP, on_notify, bool);
+ REGISTER_NOTIFY (PREF_FILTER_HIDDEN, on_notify, bool);
+ REGISTER_NOTIFY (PREF_FILTER_UNVERSIONED, on_notify, bool);
+ on_notify (anjuta_preferences_default(), NULL, FALSE, file_manager);
return TRUE;
}
Modified: branches/preferences_singleton/plugins/gdb/debugger.c
==============================================================================
--- branches/preferences_singleton/plugins/gdb/debugger.c (original)
+++ branches/preferences_singleton/plugins/gdb/debugger.c Thu Mar 19 13:31:18 2009
@@ -3542,7 +3542,7 @@
g_return_if_fail (IS_DEBUGGER (debugger));
- buff = g_strdup_printf ("-stack-select-frame %u", frame);
+ buff = g_strdup_printf ("-stack-select-frame %" G_GSIZE_FORMAT, frame);
debugger_queue_command (debugger, buff, FALSE, FALSE, (DebuggerParserFunc)debugger_set_frame_finish, NULL, (gpointer)frame);
g_free (buff);
Modified: branches/preferences_singleton/plugins/macro/macro-util.c
==============================================================================
--- branches/preferences_singleton/plugins/macro/macro-util.c (original)
+++ branches/preferences_singleton/plugins/macro/macro-util.c Thu Mar 19 13:31:18 2009
@@ -41,7 +41,7 @@
gchar *buffer;
DateTime = g_new(gchar, 100);
- sprintf(DateTime,ctime(&cur_time));
+ sprintf("%s", DateTime,ctime(&cur_time));
buffer = g_strndup(DateTime, strlen(DateTime) - 1);
g_free(DateTime);
return buffer;
Modified: branches/preferences_singleton/plugins/message-view/anjuta-msgman.c
==============================================================================
--- branches/preferences_singleton/plugins/message-view/anjuta-msgman.c (original)
+++ branches/preferences_singleton/plugins/message-view/anjuta-msgman.c Thu Mar 19 13:31:18 2009
@@ -257,24 +257,20 @@
}
void
-on_gconf_notify_message_pref (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_message_pref (AnjutaPreferences* prefs, const gchar* key,
+ const gchar* value, gpointer user_data)
{
- AnjutaPreferences *pref;
-
- pref = ANJUTA_MSGMAN (user_data)->priv->preferences;
- set_message_tab(pref, GTK_NOTEBOOK (user_data));
+ set_message_tab(prefs, GTK_NOTEBOOK (user_data));
}
GtkWidget*
-anjuta_msgman_new (AnjutaPreferences *pref, GtkWidget *popup_menu)
+anjuta_msgman_new (GtkWidget *popup_menu)
{
GtkWidget *msgman = NULL;
msgman = gtk_widget_new (ANJUTA_TYPE_MSGMAN, NULL);
if (msgman)
{
- ANJUTA_MSGMAN (msgman)->priv->preferences = pref;
ANJUTA_MSGMAN (msgman)->priv->popup_menu = popup_menu;
}
return msgman;
@@ -373,7 +369,7 @@
g_return_val_if_fail (msgman != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
- mv = message_view_new (msgman->priv->preferences, msgman->priv->popup_menu);
+ mv = message_view_new (msgman->priv->popup_menu);
g_return_val_if_fail (mv != NULL, NULL);
g_object_set (G_OBJECT (mv), "highlite", TRUE, "label", name,
"pixmap", pixmap, NULL);
@@ -531,8 +527,7 @@
{
gchar *label, *pixmap;
GtkWidget *view;
- view = message_view_new (msgman->priv->preferences,
- msgman->priv->popup_menu);
+ view = message_view_new (msgman->priv->popup_menu);
g_return_val_if_fail (view != NULL, FALSE);
if (!message_view_deserialize (MESSAGE_VIEW (view), serializer))
{
Modified: branches/preferences_singleton/plugins/message-view/anjuta-msgman.h
==============================================================================
--- branches/preferences_singleton/plugins/message-view/anjuta-msgman.h (original)
+++ branches/preferences_singleton/plugins/message-view/anjuta-msgman.h Thu Mar 19 13:31:18 2009
@@ -49,7 +49,7 @@
};
GType anjuta_msgman_get_type (void);
-GtkWidget *anjuta_msgman_new (AnjutaPreferences * pref, GtkWidget* popup_menu);
+GtkWidget *anjuta_msgman_new (GtkWidget* popup_menu);
MessageView *anjuta_msgman_add_view (AnjutaMsgman * msgman,
const gchar * name,
@@ -74,7 +74,7 @@
AnjutaSerializer *serializer);
void
-on_gconf_notify_message_pref (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data);
+on_notify_message_pref (AnjutaPreferences* prefs, const gchar* key,
+ const gchar* value, gpointer user_data);
#endif /* _ANJUTA_MSGMAN_H */
Modified: branches/preferences_singleton/plugins/message-view/message-view.c
==============================================================================
--- branches/preferences_singleton/plugins/message-view/message-view.c (original)
+++ branches/preferences_singleton/plugins/message-view/message-view.c Thu Mar 19 13:31:18 2009
@@ -17,13 +17,12 @@
#include <libanjuta/anjuta-utils.h>
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-preferences.h>
#include <libanjuta/interfaces/ianjuta-message-view.h>
#include "message-view.h"
#define MESSAGE_TYPE message_get_type()
-#define HAVE_TOOLTIP_API (GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 12))
-
struct _MessageViewPrivate
{
//guint num_messages;
@@ -33,7 +32,6 @@
GtkTreeModel *model;
GtkTreeModel *filter;
- AnjutaPreferences* prefs;
GtkWidget *popup_menu;
gint adj_chgd_hdlr;
@@ -47,15 +45,8 @@
gchar *pixmap;
gboolean highlite;
-#if !HAVE_TOOLTIP_API
- GdkRectangle tooltip_rect;
- GtkWidget *tooltip_window;
- gulong tooltip_timeout;
- PangoLayout *tooltip_layout;
-#endif
-
/* gconf notification ids */
- GList *gconf_notify_ids;
+ GList *notify_ids;
};
typedef struct
@@ -230,7 +221,6 @@
return g_string_free (gstr, FALSE);
}
-#if HAVE_TOOLTIP_API
static gboolean
message_view_query_tooltip (GtkWidget* widget, gint x, gint y, gboolean keyboard,
GtkTooltip* tooltip)
@@ -270,224 +260,6 @@
}
return FALSE;
}
-#endif
-
-#if !HAVE_TOOLTIP_API
-/* Tooltip operations -- taken from gtodo */
-
-static gchar *
-tooltip_get_display_text (MessageView *view)
-{
- GtkTreePath *path;
- GtkTreeIter iter;
- GtkTreeModel *model;
-
- model = view->privat->model;
-
- if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(view->privat->tree_view),
- view->privat->tooltip_rect.x, view->privat->tooltip_rect.y,
- &path, NULL, NULL, NULL))
- {
- Message *message;
- gchar *text, *title, *desc;
-
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, COLUMN_MESSAGE, &message, -1);
- gtk_tree_path_free(path);
-
- if (!message->details || !message->summary ||
- strlen (message->details) <= 0 ||
- strlen (message->summary) <= 0)
- return NULL;
-
- title = escape_string (message->summary);
- desc = escape_string (message->details);
- text = g_strdup_printf ("<b>%s</b>\n%s", title, desc);
-
- g_free (title);
- g_free (desc);
-
- return text;
- }
- return NULL;
-}
-
-static void
-tooltip_paint (GtkWidget *widget, GdkEventExpose *event, MessageView *view)
-{
- GtkStyle *style;
- gchar *tooltiptext;
-
- tooltiptext = tooltip_get_display_text (view);
-
- if (!tooltiptext)
- tooltiptext = g_strdup (_("No message details"));
-
- pango_layout_set_markup (view->privat->tooltip_layout,
- tooltiptext,
- strlen (tooltiptext));
- pango_layout_set_wrap(view->privat->tooltip_layout, PANGO_WRAP_CHAR);
- pango_layout_set_width(view->privat->tooltip_layout, 600000);
- style = view->privat->tooltip_window->style;
-
- gtk_paint_flat_box (style, view->privat->tooltip_window->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, view->privat->tooltip_window,
- "tooltip", 0, 0, -1, -1);
-
- gtk_paint_layout (style, view->privat->tooltip_window->window,
- GTK_STATE_NORMAL, TRUE,
- NULL, view->privat->tooltip_window,
- "tooltip", 4, 4, view->privat->tooltip_layout);
- /*
- g_object_unref(layout);
- */
- g_free(tooltiptext);
- return;
-}
-
-static gboolean
-tooltip_timeout (MessageView *view)
-{
- gint scr_w,scr_h, w, h, x, y;
- gchar *tooltiptext;
-
- tooltiptext = tooltip_get_display_text (view);
-
- if (!tooltiptext)
- tooltiptext = g_strdup (_("No message details"));
-
- view->privat->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
- view->privat->tooltip_window->parent = view->privat->tree_view;
- gtk_widget_set_app_paintable (view->privat->tooltip_window, TRUE);
- gtk_window_set_resizable (GTK_WINDOW(view->privat->tooltip_window), FALSE);
- gtk_widget_set_name (view->privat->tooltip_window, "gtk-tooltips");
- g_signal_connect (G_OBJECT(view->privat->tooltip_window), "expose_event",
- G_CALLBACK(tooltip_paint), view);
- gtk_widget_ensure_style (view->privat->tooltip_window);
-
- view->privat->tooltip_layout =
- gtk_widget_create_pango_layout (view->privat->tooltip_window, NULL);
- pango_layout_set_wrap (view->privat->tooltip_layout, PANGO_WRAP_CHAR);
- pango_layout_set_width (view->privat->tooltip_layout, 600000);
- pango_layout_set_markup (view->privat->tooltip_layout, tooltiptext,
- strlen (tooltiptext));
- scr_w = gdk_screen_width();
- scr_h = gdk_screen_height();
- pango_layout_get_size (view->privat->tooltip_layout, &w, &h);
- w = PANGO_PIXELS(w) + 8;
- h = PANGO_PIXELS(h) + 8;
-
- gdk_window_get_pointer (NULL, &x, &y, NULL);
- if (GTK_WIDGET_NO_WINDOW (view->privat->tree_view))
- y += view->privat->tree_view->allocation.y;
-
- x -= ((w >> 1) + 4);
-
- if ((x + w) > scr_w)
- x -= (x + w) - scr_w;
- else if (x < 0)
- x = 0;
-
- if ((y + h + 4) > scr_h)
- y = y - h;
- else
- y = y + 6;
- /*
- g_object_unref(layout);
- */
- gtk_widget_set_size_request (view->privat->tooltip_window, w, h);
- gtk_window_move (GTK_WINDOW (view->privat->tooltip_window), x, y);
- gtk_widget_show (view->privat->tooltip_window);
- g_free (tooltiptext);
-
- return FALSE;
-}
-
-static gboolean
-tooltip_motion_cb (GtkWidget *tv, GdkEventMotion *event, MessageView *view)
-{
- GtkTreePath *path;
-
- if (view->privat->tooltip_rect.y == 0 &&
- view->privat->tooltip_rect.height == 0 &&
- view->privat->tooltip_timeout)
- {
- g_source_remove (view->privat->tooltip_timeout);
- view->privat->tooltip_timeout = 0;
- if (view->privat->tooltip_window) {
- gtk_widget_destroy (view->privat->tooltip_window);
- view->privat->tooltip_window = NULL;
- }
- return FALSE;
- }
- if (view->privat->tooltip_timeout) {
- if (((int)event->y > view->privat->tooltip_rect.y) &&
- (((int)event->y - view->privat->tooltip_rect.height)
- < view->privat->tooltip_rect.y))
- return FALSE;
-
- if(event->y == 0)
- {
- g_source_remove (view->privat->tooltip_timeout);
- view->privat->tooltip_timeout = 0;
- return FALSE;
- }
- /* We've left the cell. Remove the timeout and create a new one below */
- if (view->privat->tooltip_window) {
- gtk_widget_destroy (view->privat->tooltip_window);
- view->privat->tooltip_window = NULL;
- }
- g_source_remove (view->privat->tooltip_timeout);
- view->privat->tooltip_timeout = 0;
- }
-
- if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(view->privat->tree_view),
- event->x, event->y, &path,
- NULL, NULL, NULL))
- {
- GtkTreeSelection *selection;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view->privat->tree_view));
- if (gtk_tree_selection_path_is_selected (selection, path))
- {
- gtk_tree_view_get_cell_area (GTK_TREE_VIEW (view->privat->tree_view),
- path, NULL, &view->privat->tooltip_rect);
-
- if (view->privat->tooltip_rect.y != 0 &&
- view->privat->tooltip_rect.height != 0)
- {
- gchar *tooltiptext;
-
- tooltiptext = tooltip_get_display_text (view);
- if (tooltiptext == NULL)
- return FALSE;
- g_free (tooltiptext);
-
- view->privat->tooltip_timeout =
- g_timeout_add (500, (GSourceFunc) tooltip_timeout, view);
- }
- }
- gtk_tree_path_free (path);
- }
- return FALSE;
-}
-
-static void
-tooltip_leave_cb (GtkWidget *w, GdkEventCrossing *e, MessageView *view)
-{
- if (view->privat->tooltip_timeout) {
- g_source_remove (view->privat->tooltip_timeout);
- view->privat->tooltip_timeout = 0;
- }
- if (view->privat->tooltip_window) {
- gtk_widget_destroy (view->privat->tooltip_window);
- g_object_unref (view->privat->tooltip_layout);
- view->privat->tooltip_window = NULL;
- }
-}
-#endif
-
/* MessageView signal callbacks */
/* Send a signal if a message was double-clicked or ENTER or SPACE was pressed */
@@ -664,23 +436,11 @@
message_view_dispose (GObject *obj)
{
MessageView *mview = MESSAGE_VIEW (obj);
- if (mview->privat->gconf_notify_ids)
+ if (mview->privat->notify_ids)
{
prefs_finalize (mview);
- mview->privat->gconf_notify_ids = NULL;
- }
-#if !HAVE_TOOLTIP_API
- if (mview->privat->tooltip_timeout) {
- g_source_remove (mview->privat->tooltip_timeout);
- mview->privat->tooltip_timeout = 0;
- }
-
- if (mview->privat->tooltip_window) {
- gtk_widget_destroy (mview->privat->tooltip_window);
- g_object_unref (mview->privat->tooltip_layout);
- mview->privat->tooltip_window = NULL;
+ mview->privat->notify_ids = NULL;
}
-#endif
if (mview->privat->tree_view)
{
mview->privat->tree_view = NULL;
@@ -867,14 +627,9 @@
/* Connect signals */
g_signal_connect (G_OBJECT(self->privat->tree_view), "event",
G_CALLBACK (on_message_event), self);
-#if !HAVE_TOOLTIP_API
- g_signal_connect (G_OBJECT (self->privat->tree_view), "motion-notify-event",
- G_CALLBACK (tooltip_motion_cb), self);
- g_signal_connect (G_OBJECT (self->privat->tree_view), "leave-notify-event",
- G_CALLBACK (tooltip_leave_cb), self);
-#else
+
g_object_set (G_OBJECT(self), "has-tooltip", TRUE, NULL);
-#endif
+
}
static void
@@ -892,9 +647,8 @@
gobject_class->finalize = message_view_finalize;
gobject_class->dispose = message_view_dispose;
-#if HAVE_TOOLTIP_API
widget_class->query_tooltip = message_view_query_tooltip;
-#endif
+
message_view_spec_label = g_param_spec_string ("label",
"Label of the view",
@@ -928,10 +682,9 @@
/* Returns a new message-view instance */
GtkWidget *
-message_view_new (AnjutaPreferences* prefs, GtkWidget* popup_menu)
+message_view_new (GtkWidget* popup_menu)
{
MessageView * mv = MESSAGE_VIEW (g_object_new (message_view_get_type (), NULL));
- mv->privat->prefs = prefs;
mv->privat->popup_menu = popup_menu;
prefs_init (mv);
return GTK_WIDGET(mv);
@@ -1240,7 +993,7 @@
GtkTreeIter iter;
gboolean success;
- color = anjuta_preferences_get (mview->privat->prefs, color_pref_key);
+ color = anjuta_preferences_get (anjuta_preferences_default(), color_pref_key);
store = GTK_LIST_STORE (mview->privat->model);
success = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
while (success)
@@ -1259,49 +1012,47 @@
static void
-on_gconf_notify_color_warning (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_color (AnjutaPreferences* prefs, const gchar* key,
+ const gchar* value, gpointer user_data)
{
pref_change_color (MESSAGE_VIEW (user_data),
IANJUTA_MESSAGE_VIEW_TYPE_WARNING,
- "messages.color.warning");
-}
-
-static void
-on_gconf_notify_color_error (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- pref_change_color (MESSAGE_VIEW (user_data),
- IANJUTA_MESSAGE_VIEW_TYPE_ERROR,
- "messages.color.error");
+ key);
}
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (mview->privat->prefs, \
- key, func, mview, NULL); \
- mview->privat->gconf_notify_ids = g_list_prepend (mview->privat->gconf_notify_ids, \
- GINT_TO_POINTER(notify_id));
static void
prefs_init (MessageView *mview)
{
- guint notify_id;
- REGISTER_NOTIFY ("messages.color.warning", on_gconf_notify_color_warning);
- REGISTER_NOTIFY ("messages.color.error", on_gconf_notify_color_error);
+ gint id;
+ id = anjuta_preferences_notify_add_string (anjuta_preferences_default (),
+ "messages.color.error",
+ on_notify_color,
+ mview,
+ NULL);
+ mview->privat->notify_ids = g_list_append (mview->privat->notify_ids,
+ GINT_TO_POINTER (id));
+ id = anjuta_preferences_notify_add_string (anjuta_preferences_default (),
+ "messages.color.warning",
+ on_notify_color,
+ mview,
+ NULL);
+ mview->privat->notify_ids = g_list_append (mview->privat->notify_ids,
+ GINT_TO_POINTER (id));
}
static void
prefs_finalize (MessageView *mview)
{
GList *node;
- node = mview->privat->gconf_notify_ids;
+ node = mview->privat->notify_ids;
while (node)
{
- anjuta_preferences_notify_remove (mview->privat->prefs,
+ anjuta_preferences_notify_remove (anjuta_preferences_default(),
GPOINTER_TO_INT (node->data));
node = g_list_next (node);
}
- g_list_free (mview->privat->gconf_notify_ids);
- mview->privat->gconf_notify_ids = NULL;
+ g_list_free (mview->privat->notify_ids);
+ mview->privat->notify_ids = NULL;
}
/* IAnjutaMessageView interface implementation */
@@ -1405,14 +1156,14 @@
stock_id = GTK_STOCK_INFO;
break;
case IANJUTA_MESSAGE_VIEW_TYPE_WARNING:
- color = anjuta_preferences_get (view->privat->prefs,
+ color = anjuta_preferences_get (anjuta_preferences_default(),
"messages.color.warning");
/* FIXME: There is no GTK_STOCK_WARNING which would fit better here */
view->privat->warn_count++;
stock_id = GTK_STOCK_DIALOG_WARNING;
break;
case IANJUTA_MESSAGE_VIEW_TYPE_ERROR:
- color = anjuta_preferences_get (view->privat->prefs,
+ color = anjuta_preferences_get (anjuta_preferences_default(),
"messages.color.error");
view->privat->error_count++;
stock_id = GTK_STOCK_STOP;
Modified: branches/preferences_singleton/plugins/message-view/message-view.h
==============================================================================
--- branches/preferences_singleton/plugins/message-view/message-view.h (original)
+++ branches/preferences_singleton/plugins/message-view/message-view.h Thu Mar 19 13:31:18 2009
@@ -58,7 +58,7 @@
/* Note: MessageView implements IAnjutaMessageView interface */
GType message_view_get_type (void);
-GtkWidget* message_view_new (AnjutaPreferences* prefs, GtkWidget* popup_menu);
+GtkWidget* message_view_new (GtkWidget* popup_menu);
void message_view_next(MessageView* view);
void message_view_previous(MessageView* view);
Modified: branches/preferences_singleton/plugins/message-view/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/message-view/plugin.c (original)
+++ branches/preferences_singleton/plugins/message-view/plugin.c Thu Mar 19 13:31:18 2009
@@ -216,7 +216,7 @@
mv_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupMessageView");
mv_plugin->msgman =
- anjuta_msgman_new(anjuta_shell_get_preferences(plugin->shell, NULL), popup);
+ anjuta_msgman_new(popup);
g_signal_connect(G_OBJECT(mv_plugin->msgman), "view_changed",
G_CALLBACK(on_view_changed), mv_plugin);
GtkAction* action_next = anjuta_ui_get_action (ui, "ActionGroupGotoMessages",
@@ -416,8 +416,8 @@
anjuta_preferences_add_page (prefs, gxml,
"Messages", _("Messages"),
ANJUTA_PIXMAP_MESSAGES);
- notify_id = anjuta_preferences_notify_add (prefs, MESSAGES_TABS_POS,
- on_gconf_notify_message_pref, plugin->msgman, NULL);
+ notify_id = anjuta_preferences_notify_add_string (prefs, MESSAGES_TABS_POS,
+ on_notify_message_pref, plugin->msgman, NULL);
g_object_unref (gxml);
}
Modified: branches/preferences_singleton/plugins/project-import/project-import.c
==============================================================================
--- branches/preferences_singleton/plugins/project-import/project-import.c (original)
+++ branches/preferences_singleton/plugins/project-import/project-import.c Thu Mar 19 13:31:18 2009
@@ -116,7 +116,7 @@
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- message_text));
+ "%s", message_text));
g_free(message_text);
Modified: branches/preferences_singleton/plugins/project-wizard/druid.c
==============================================================================
--- branches/preferences_singleton/plugins/project-wizard/druid.c (original)
+++ branches/preferences_singleton/plugins/project-wizard/druid.c Thu Mar 19 13:31:18 2009
@@ -341,10 +341,8 @@
static gboolean
npw_druid_fill_selection_page (NPWDruid* druid)
{
- gboolean ok;
gchar* dir;
const gchar * const * sys_dir;
- const gchar * user_dir;
/* Remove all previous data */
druid->project_book = GTK_NOTEBOOK (gtk_assistant_get_nth_page (GTK_ASSISTANT (druid->window), PROJECT_PAGE));
Modified: branches/preferences_singleton/plugins/project-wizard/parser.c
==============================================================================
--- branches/preferences_singleton/plugins/project-wizard/parser.c (original)
+++ branches/preferences_singleton/plugins/project-wizard/parser.c Thu Mar 19 13:31:18 2009
@@ -619,7 +619,7 @@
if (!g_file_get_contents (filename, &content, &len, &err))
{
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
return FALSE;
@@ -646,7 +646,7 @@
if (g_error_matches (err, parser_error_quark (), NPW_STOP_PARSING) == FALSE)
{
/* Parsing error */
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
npw_header_free (header);
@@ -990,7 +990,7 @@
if (!g_file_get_contents (filename, &content, &len, &err))
{
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
return FALSE;
@@ -1007,7 +1007,7 @@
if (err != NULL)
{
/* Parsing error */
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
return FALSE;
@@ -1690,7 +1690,7 @@
g_markup_parse_context_parse (parser->ctx, text, len, &err);
if (err != NULL)
{
- g_warning (err->message);
+ g_warning ("%s", err->message);
}
return TRUE;
Modified: branches/preferences_singleton/plugins/scintilla/text_editor.c
==============================================================================
--- branches/preferences_singleton/plugins/scintilla/text_editor.c (original)
+++ branches/preferences_singleton/plugins/scintilla/text_editor.c Thu Mar 19 13:31:18 2009
@@ -130,7 +130,7 @@
te->props_base = 0;
te->first_time_expose = TRUE;
te->encoding = NULL;
- te->gconf_notify_ids = NULL;
+ te->notify_ids = NULL;
te->hover_tip_on = FALSE;
te->last_saved_content = NULL;
te->force_not_saved = FALSE;
@@ -612,10 +612,10 @@
te->editor_id = 0;
te->views = NULL;
}
- if (te->gconf_notify_ids)
+ if (te->notify_ids)
{
text_editor_prefs_finalize (te);
- te->gconf_notify_ids = NULL;
+ te->notify_ids = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
Modified: branches/preferences_singleton/plugins/scintilla/text_editor.h
==============================================================================
--- branches/preferences_singleton/plugins/scintilla/text_editor.h (original)
+++ branches/preferences_singleton/plugins/scintilla/text_editor.h Thu Mar 19 13:31:18 2009
@@ -95,8 +95,8 @@
/* Popup menu widget */
GtkWidget *popup_menu;
- /* Gconf notify IDs */
- GList* gconf_notify_ids;
+ /* notify IDs */
+ GList* notify_ids;
/* Current zoom factor */
gint zoom_factor;
Modified: branches/preferences_singleton/plugins/scintilla/text_editor_prefs.c
==============================================================================
--- branches/preferences_singleton/plugins/scintilla/text_editor_prefs.c (original)
+++ branches/preferences_singleton/plugins/scintilla/text_editor_prefs.c Thu Mar 19 13:31:18 2009
@@ -62,7 +62,7 @@
}
static void
-pref_gconf_notify (GConfClient *gclient, guint cnxn_id,
+pref_notify (GConfClient *gclient, guint cnxn_id,
GConfEntry *entry, gpointer user_data)
{
PrefPassedData *pd = (PrefPassedData*)user_data;
@@ -87,6 +87,17 @@
return val;
}
+static gint
+set_n_get_prop_bool (TextEditor *te, const gchar *key)
+{
+ gboolean val;
+ AnjutaPreferences *pr;
+ pr = te->preferences;
+ val = anjuta_preferences_get_bool (pr, key);
+ sci_prop_set_int_with_key (text_editor_get_props (), key, val);
+ return val;
+}
+
static gchar *
set_n_get_prop_string (TextEditor *te, const gchar *key)
{
@@ -99,8 +110,10 @@
}
static void
-on_gconf_notify_disable_hilite (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_disable_hilite (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
@@ -110,12 +123,14 @@
}
static void
-on_gconf_notify_zoom_factor (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_zoom_factor(AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gint zoom_factor;
-
+
te = TEXT_EDITOR (user_data);
zoom_factor = set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
text_editor_set_zoom_factor (te, zoom_factor);
@@ -123,222 +138,211 @@
}
static void
-on_gconf_notify_tab_size (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_tab_size (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gint tab_size;
-
+
te = TEXT_EDITOR (user_data);
tab_size = set_n_get_prop_int (te, TAB_SIZE);
text_editor_command (te, ANE_SETTABSIZE, tab_size, 0);
}
static void
-on_gconf_notify_use_tab_for_indentation (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_use_tab_for_indentation(AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean use_tabs;
-
+
te = TEXT_EDITOR (user_data);
use_tabs = set_n_get_prop_int (te, USE_TABS);
text_editor_command (te, ANE_SETUSETABFORINDENT, use_tabs, 0);
// text_editor_scintilla_command (te, SCI_SETTABWIDTH, use_tabs, 0);
}
-#if 0
-static void
-on_gconf_notify_automatic_indentation (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- TextEditor *te;
- gboolean indent_automatic;
-
- te = TEXT_EDITOR (user_data);
- indent_automatic = set_n_get_prop_int (te, INDENT_AUTOMATIC);
- text_editor_command (te, ANE_SETAUTOINDENTATION, indent_automatic, 0);
-}
-#endif
-
static void
-on_gconf_notify_indent_size (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_indent_size (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gint indent_size;
-
+
te = TEXT_EDITOR (user_data);
indent_size = set_n_get_prop_int (te, INDENT_SIZE);
text_editor_command (te, ANE_SETINDENTSIZE, indent_size, 0);
}
static void
-on_gconf_notify_wrap_bookmarks (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_wrap_bookmarks(AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, WRAP_BOOKMARKS);
text_editor_command (te, ANE_SETWRAPBOOKMARKS, state, 0);
}
static void
-on_gconf_notify_braces_check (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_braces_check (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, BRACES_CHECK);
text_editor_command (te, ANE_SETINDENTBRACESCHECK, state, 0);
}
-#if 0
-static void
-on_gconf_notify_indent_opening (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- TextEditor *te;
- gboolean state;
-
- te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_int (te, INDENT_OPENING);
- text_editor_command (te, ANE_SETINDENTOPENING, state, 0);
-}
-
static void
-on_gconf_notify_indent_closing (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_indent_maintain (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
- te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_int (te, INDENT_CLOSING);
- text_editor_command (te, ANE_SETINDENTCLOSING, state, 0);
-}
-
-#endif
-static void
-on_gconf_notify_indent_maintain (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- TextEditor *te;
- gboolean state;
-
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, INDENT_MAINTAIN);
text_editor_command (te, ANE_SETINDENTMAINTAIN, state, 0);
}
static void
-on_gconf_notify_tab_indents (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_tab_indents (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, TAB_INDENTS);
text_editor_command (te, ANE_SETTABINDENTS, state, 0);
}
static void
-on_gconf_notify_backspace_unindents (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_backspace_unindents (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, BACKSPACE_UNINDENTS);
text_editor_command (te, ANE_SETBACKSPACEUNINDENTS, state, 0);
}
static void
-on_gconf_notify_view_eols (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_eols (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_EOL);
text_editor_command (te, ANE_VIEWEOL, state, 0);
}
static void
-on_gconf_notify_view_whitespaces (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_whitespaces (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_WHITE_SPACES);
text_editor_command (te, ANE_VIEWSPACE, state, 0);
}
static void
-on_gconf_notify_view_linewrap (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_linewrap (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_LINE_WRAP);
text_editor_command (te, ANE_LINEWRAP, state, 0);
}
static void
-on_gconf_notify_view_indentation_guides (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_indentation_guides (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_INDENTATION_GUIDES);
text_editor_command (te, ANE_VIEWGUIDES, state, 0);
}
static void
-on_gconf_notify_view_folds (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_folds (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_FOLD_MARGIN);
text_editor_command (te, ANE_FOLDMARGIN, state, 0);
}
static void
-on_gconf_notify_view_markers (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_markers (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_MARKER_MARGIN);
text_editor_command (te, ANE_SELMARGIN, state, 0);
}
static void
-on_gconf_notify_view_linenums (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_linenums (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, VIEW_LINENUMBERS_MARGIN);
text_editor_command (te, ANE_LINENUMBERMARGIN, state, 0);
@@ -346,12 +350,14 @@
}
static void
-on_gconf_notify_fold_symbols (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_fold_symbols (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gchar *symbols;
-
+
te = TEXT_EDITOR (user_data);
symbols = set_n_get_prop_string (te, FOLD_SYMBOLS);
text_editor_command (te, ANE_SETFOLDSYMBOLS, (long)symbols, 0);
@@ -359,33 +365,37 @@
}
static void
-on_gconf_notify_fold_underline (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_fold_underline (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gboolean state;
-
+
te = TEXT_EDITOR (user_data);
state = set_n_get_prop_int (te, FOLD_UNDERLINE);
text_editor_command (te, ANE_SETFOLDUNDERLINE, state, 0);
}
static void
-on_gconf_notify_edge_column (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_edge_column (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint value,
+ gpointer user_data)
{
TextEditor *te;
gint size;
-
+
te = TEXT_EDITOR (user_data);
size = set_n_get_prop_int (te, EDGE_COLUMN);
text_editor_command (te, ANE_SETEDGECOLUMN, size, 0);
}
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (te->preferences, \
+#define REGISTER_NOTIFY(key, func, type) \
+ notify_id = anjuta_preferences_notify_add_##type (te->preferences, \
key, func, te, NULL); \
- te->gconf_notify_ids = g_list_prepend (te->gconf_notify_ids, \
+ te->notify_ids = g_list_prepend (te->notify_ids, \
GUINT_TO_POINTER (notify_id));
void
@@ -398,76 +408,68 @@
set_n_get_prop_int (te, TAB_SIZE);
set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
set_n_get_prop_int (te, INDENT_SIZE);
- set_n_get_prop_int (te, USE_TABS);
- set_n_get_prop_int (te, DISABLE_SYNTAX_HILIGHTING);
- /* set_n_get_prop_int (te, INDENT_AUTOMATIC); */
- set_n_get_prop_int (te, WRAP_BOOKMARKS);
- set_n_get_prop_int (te, BRACES_CHECK);
- /*
- set_n_get_prop_int (te, INDENT_OPENING);
- set_n_get_prop_int (te, INDENT_CLOSING);
- */
+ set_n_get_prop_bool (te, USE_TABS);
+ set_n_get_prop_bool (te, DISABLE_SYNTAX_HILIGHTING);
+ set_n_get_prop_bool (te, WRAP_BOOKMARKS);
+ set_n_get_prop_bool (te, BRACES_CHECK);
+
/* This one is special */
- val = set_n_get_prop_int (te, INDENT_MAINTAIN);
+ val = set_n_get_prop_bool (te, INDENT_MAINTAIN);
if (val)
sci_prop_set_int_with_key (te->props_base, INDENT_MAINTAIN".*", 1);
else
- sci_prop_set_with_key (te->props_base, INDENT_MAINTAIN".*", "");
+ sci_prop_set_int_with_key (te->props_base, INDENT_MAINTAIN".*", 0);
- set_n_get_prop_int (te, TAB_INDENTS);
- set_n_get_prop_int (te, BACKSPACE_UNINDENTS);
+ set_n_get_prop_bool (te, TAB_INDENTS);
+ set_n_get_prop_bool (te, BACKSPACE_UNINDENTS);
- set_n_get_prop_int (te, VIEW_EOL);
- set_n_get_prop_int (te, VIEW_LINE_WRAP);
- set_n_get_prop_int (te, VIEW_WHITE_SPACES);
- set_n_get_prop_int (te, VIEW_INDENTATION_GUIDES);
- set_n_get_prop_int (te, VIEW_FOLD_MARGIN);
- set_n_get_prop_int (te, VIEW_MARKER_MARGIN);
- set_n_get_prop_int (te, VIEW_LINENUMBERS_MARGIN);
+ set_n_get_prop_bool (te, VIEW_EOL);
+ set_n_get_prop_bool (te, VIEW_LINE_WRAP);
+ set_n_get_prop_bool (te, VIEW_WHITE_SPACES);
+ set_n_get_prop_bool (te, VIEW_INDENTATION_GUIDES);
+ set_n_get_prop_bool (te, VIEW_FOLD_MARGIN);
+ set_n_get_prop_bool (te, VIEW_MARKER_MARGIN);
+ set_n_get_prop_bool (te, VIEW_LINENUMBERS_MARGIN);
g_free (set_n_get_prop_string (te, FOLD_SYMBOLS));
- set_n_get_prop_int (te, FOLD_UNDERLINE);
+ set_n_get_prop_bool (te, FOLD_UNDERLINE);
set_n_get_prop_int (te, EDGE_COLUMN);
/* Register gconf notifications */
- REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
- REGISTER_NOTIFY (TEXT_ZOOM_FACTOR, on_gconf_notify_zoom_factor);
- REGISTER_NOTIFY (INDENT_SIZE, on_gconf_notify_indent_size);
- REGISTER_NOTIFY (USE_TABS, on_gconf_notify_use_tab_for_indentation);
- REGISTER_NOTIFY (DISABLE_SYNTAX_HILIGHTING, on_gconf_notify_disable_hilite);
- /* REGISTER_NOTIFY (INDENT_AUTOMATIC, on_gconf_notify_automatic_indentation); */
- REGISTER_NOTIFY (WRAP_BOOKMARKS, on_gconf_notify_wrap_bookmarks);
- REGISTER_NOTIFY (BRACES_CHECK, on_gconf_notify_braces_check);
- /*
- REGISTER_NOTIFY (INDENT_OPENING, on_gconf_notify_indent_opening);
- REGISTER_NOTIFY (INDENT_CLOSING, on_gconf_notify_indent_closing);
- */
- REGISTER_NOTIFY (INDENT_MAINTAIN, on_gconf_notify_indent_maintain);
- REGISTER_NOTIFY (TAB_INDENTS, on_gconf_notify_tab_indents);
- REGISTER_NOTIFY (BACKSPACE_UNINDENTS, on_gconf_notify_backspace_unindents);
- REGISTER_NOTIFY (VIEW_EOL, on_gconf_notify_view_eols);
- REGISTER_NOTIFY (VIEW_LINE_WRAP, on_gconf_notify_view_linewrap);
- REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_gconf_notify_view_whitespaces);
- REGISTER_NOTIFY (VIEW_INDENTATION_GUIDES, on_gconf_notify_view_indentation_guides);
- REGISTER_NOTIFY (VIEW_FOLD_MARGIN, on_gconf_notify_view_folds);
- REGISTER_NOTIFY (VIEW_MARKER_MARGIN, on_gconf_notify_view_markers);
- REGISTER_NOTIFY (VIEW_LINENUMBERS_MARGIN, on_gconf_notify_view_linenums);
- REGISTER_NOTIFY (FOLD_SYMBOLS, on_gconf_notify_fold_symbols);
- REGISTER_NOTIFY (FOLD_UNDERLINE, on_gconf_notify_fold_underline);
- REGISTER_NOTIFY (EDGE_COLUMN, on_gconf_notify_edge_column);
+ REGISTER_NOTIFY (TAB_SIZE, on_notify_tab_size, int);
+ REGISTER_NOTIFY (TEXT_ZOOM_FACTOR, on_notify_zoom_factor, int);
+ REGISTER_NOTIFY (INDENT_SIZE, on_notify_indent_size, int);
+ REGISTER_NOTIFY (USE_TABS, on_notify_use_tab_for_indentation, bool);
+ REGISTER_NOTIFY (DISABLE_SYNTAX_HILIGHTING, on_notify_disable_hilite, bool);
+ /* REGISTER_NOTIFY (INDENT_AUTOMATIC, on_notify_automatic_indentation); */
+ REGISTER_NOTIFY (WRAP_BOOKMARKS, on_notify_wrap_bookmarks, bool);
+ REGISTER_NOTIFY (BRACES_CHECK, on_notify_braces_check, bool);
+ REGISTER_NOTIFY (INDENT_MAINTAIN, on_notify_indent_maintain, bool);
+ REGISTER_NOTIFY (TAB_INDENTS, on_notify_tab_indents, bool);
+ REGISTER_NOTIFY (BACKSPACE_UNINDENTS, on_notify_backspace_unindents, bool);
+ REGISTER_NOTIFY (VIEW_EOL, on_notify_view_eols, bool);
+ REGISTER_NOTIFY (VIEW_LINE_WRAP, on_notify_view_linewrap, bool);
+ REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_notify_view_whitespaces, bool);
+ REGISTER_NOTIFY (VIEW_INDENTATION_GUIDES, on_notify_view_indentation_guides, bool);
+ REGISTER_NOTIFY (VIEW_FOLD_MARGIN, on_notify_view_folds, bool);
+ REGISTER_NOTIFY (VIEW_MARKER_MARGIN, on_notify_view_markers, bool);
+ REGISTER_NOTIFY (VIEW_LINENUMBERS_MARGIN, on_notify_view_linenums, bool);
+ REGISTER_NOTIFY (FOLD_SYMBOLS, on_notify_fold_symbols, bool);
+ REGISTER_NOTIFY (FOLD_UNDERLINE, on_notify_fold_underline, bool);
+ REGISTER_NOTIFY (EDGE_COLUMN, on_notify_edge_column, int);
}
void
text_editor_prefs_finalize (TextEditor *te)
{
GList *node;
- node = te->gconf_notify_ids;
+ node = te->notify_ids;
while (node)
{
anjuta_preferences_notify_remove (te->preferences,
GPOINTER_TO_UINT (node->data));
node = g_list_next (node);
}
- g_list_free (te->gconf_notify_ids);
- te->gconf_notify_ids = NULL;
+ g_list_free (te->notify_ids);
+ te->notify_ids = NULL;
}
Modified: branches/preferences_singleton/plugins/scratchbox/plugin.c
==============================================================================
--- branches/preferences_singleton/plugins/scratchbox/plugin.c (original)
+++ branches/preferences_singleton/plugins/scratchbox/plugin.c Thu Mar 19 13:31:18 2009
@@ -205,7 +205,7 @@
sbox_args = sbox2_commands_args[TARGET_LIST][1];
}
- g_string_append_printf(command, sbox_commands);
+ g_string_append (command, sbox_commands);
if (g_file_test (command->str, G_FILE_TEST_EXISTS) == FALSE)
{
@@ -305,14 +305,13 @@
return TRUE;
}
-void
+static void
sbox2_environment_override (IAnjutaEnvironment* environment, gchar **dir, gchar ***argvp, gchar ***envp, GError** err)
{
ScratchboxPlugin *plugin = ANJUTA_PLUGIN_SCRATCHBOX (environment);
AnjutaPreferences* prefs;
gchar **new_argv;
gchar* sb_dir;
- gsize len;
if (plugin->target == NULL || !strcmp(plugin->target, "host"))
return;
@@ -464,7 +463,7 @@
"changed", G_CALLBACK(on_change_target),
plugin);
- plugin->target = gtk_combo_box_get_active_text (combo_target_entry);
+ plugin->target = gtk_combo_box_get_active_text (combo_target_entry);
}
Modified: branches/preferences_singleton/plugins/sourceview/sourceview-prefs.c
==============================================================================
--- branches/preferences_singleton/plugins/sourceview/sourceview-prefs.c (original)
+++ branches/preferences_singleton/plugins/sourceview/sourceview-prefs.c Thu Mar 19 13:31:18 2009
@@ -20,13 +20,13 @@
#include <libanjuta/anjuta-debug.h>
-static AnjutaPreferences* prefs = NULL;
+#include <gconf/gconf-client.h>
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (sv->priv->prefs, \
- key, func, sv, NULL); \
- sv->priv->gconf_notify_ids = g_list_prepend (sv->priv->gconf_notify_ids, \
- GUINT_TO_POINTER(notify_id));
+#define REGISTER_NOTIFY(key, func, type) \
+ notify_id = anjuta_preferences_notify_add_##type (sv->priv->prefs, \
+ key, func, sv, NULL); \
+ sv->priv->notify_ids = g_list_prepend (sv->priv->notify_ids, \
+ GUINT_TO_POINTER(notify_id));
/* Editor preferences */
#define HIGHLIGHT_SYNTAX "sourceview.syntax.highlight"
#define HIGHLIGHT_CURRENT_LINE "sourceview.currentline.highlight"
@@ -49,37 +49,14 @@
#define FONT "sourceview.font"
#define DESKTOP_FIXED_FONT "/desktop/gnome/interface/monospace_font_name"
-static int
-get_int_default(GConfEntry* entry, gint default_value)
-{
- GConfValue* value = gconf_entry_get_value(entry);
- if (value)
- return gconf_value_get_int(value);
- else
- return default_value;
-}
-
-static gboolean
-get_bool(GConfEntry* entry)
-{
- GConfValue* value = gconf_entry_get_value(entry);
- /* The value might be deleted */
- if (!value)
- return FALSE;
- /* Usually we would use get_bool but anjuta_preferences saves bool as int
- #409408 */
- if (value->type == GCONF_VALUE_BOOL)
- return gconf_value_get_bool (value);
- else
- return gconf_value_get_int(value);
-}
static void
-on_gconf_notify_view_spaces (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_spaces (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean visible,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean visible = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
GtkSourceDrawSpacesFlags flags =
gtk_source_view_get_draw_spaces (GTK_SOURCE_VIEW (sv->priv->view));
@@ -94,11 +71,12 @@
}
static void
-on_gconf_notify_view_eols (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_eol (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean visible,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean visible = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
GtkSourceDrawSpacesFlags flags =
gtk_source_view_get_draw_spaces (GTK_SOURCE_VIEW (sv->priv->view));
@@ -113,11 +91,12 @@
}
static void
-on_gconf_notify_line_wrap (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_line_wrap (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean line_wrap,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean line_wrap = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (sv->priv->view),
@@ -125,87 +104,94 @@
}
static void
-on_gconf_notify_disable_hilite (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_disable_hilite (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean highlight,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean highlight = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
gtk_source_buffer_set_highlight_syntax(GTK_SOURCE_BUFFER(sv->priv->document),
- highlight);
-
+ highlight);
+
}
static void
-on_gconf_notify_highlight_current_line (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_highlight_current_line(AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean highlight_current_line,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean highlight_current_line = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
gtk_source_view_set_highlight_current_line(GTK_SOURCE_VIEW(sv->priv->view),
- highlight_current_line);
+ highlight_current_line);
}
static void
-on_gconf_notify_tab_size (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_tab_size (AnjutaPreferences* prefs,
+ const gchar* key,
+ gint tab_size,
+ gpointer user_data)
{
Sourceview *sv;
- gint tab_size = get_int_default(entry, 4);
-
+
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
g_return_if_fail(GTK_IS_SOURCE_VIEW(sv->priv->view));
-
+
gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(sv->priv->view), tab_size);
}
static void
-on_gconf_notify_use_tab_for_indentation (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_use_tab_for_indentation (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean use_tabs,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean use_tabs = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(sv->priv->view),
- !use_tabs);
+ !use_tabs);
}
static void
-on_gconf_notify_braces_check (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_braces_check (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean braces_check,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean braces_check = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
gtk_source_buffer_set_highlight_matching_brackets(GTK_SOURCE_BUFFER(sv->priv->document),
- braces_check);
+ braces_check);
}
static void
-on_gconf_notify_view_marks (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_marks (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean show_markers,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean show_markers = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
-
+
gtk_source_view_set_show_line_marks(GTK_SOURCE_VIEW(sv->priv->view),
- show_markers);
-
+ show_markers);
+
}
static void
-on_gconf_notify_view_linenums (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_linenums (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean show_lineno,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean show_lineno = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(sv->priv->view),
@@ -214,24 +200,25 @@
}
static void
-on_gconf_notify_view_right_margin (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_view_right_margin (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean show_margin,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean show_margin = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
gtk_source_view_set_show_right_margin(GTK_SOURCE_VIEW(sv->priv->view),
show_margin);
-
}
static void
-on_gconf_notify_right_margin_position (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_right_margin_position (AnjutaPreferences* prefs,
+ const gchar* key,
+ int pos,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean pos = get_int_default(entry, 80);
sv = ANJUTA_SOURCEVIEW(user_data);
gtk_source_view_set_right_margin_position(GTK_SOURCE_VIEW(sv->priv->view),
@@ -240,31 +227,30 @@
}
static void
-on_gconf_notify_font (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_font (AnjutaPreferences* prefs,
+ const gchar* key,
+ const gchar* font,
+ gpointer user_data)
{
Sourceview *sv;
- gchar* font;
- AnjutaPreferences* prefs = sourceview_get_prefs();
sv = ANJUTA_SOURCEVIEW(user_data);
-
- font = anjuta_preferences_get(prefs, FONT);
-
+
if (font != NULL)
anjuta_view_set_font(sv->priv->view, FALSE, font);
- g_free (font);
}
static void
-on_gconf_notify_font_theme (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_font_theme (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean use_theme,
+ gpointer user_data)
{
Sourceview *sv;
- gboolean use_theme = get_bool(entry);
sv = ANJUTA_SOURCEVIEW(user_data);
if (use_theme)
{
+ GConfClient *gclient = gconf_client_get_default ();
gchar *desktop_fixed_font;
desktop_fixed_font =
gconf_client_get_string (gclient, DESKTOP_FIXED_FONT, NULL);
@@ -275,7 +261,12 @@
g_free (desktop_fixed_font);
}
else
- on_gconf_notify_font(NULL, 0, NULL, sv);
+ {
+ gchar* font = anjuta_preferences_get (prefs, FONT);
+ if (font != NULL)
+ anjuta_view_set_font(sv->priv->view, FALSE, font);
+ g_free (font);
+ }
}
static void
@@ -283,11 +274,14 @@
{
gboolean font_theme;
- font_theme = anjuta_preferences_get_int(prefs, FONT_THEME);
+ font_theme = anjuta_preferences_get_bool (sv->priv->prefs, FONT_THEME);
if (!font_theme)
{
- on_gconf_notify_font(NULL, 0, NULL, sv);
+ gchar* font = anjuta_preferences_get (sv->priv->prefs, FONT);
+ if (font != NULL)
+ anjuta_view_set_font(sv->priv->view, FALSE, font);
+ g_free (font);
}
else
{
@@ -307,44 +301,48 @@
}
static int
-get_key(Sourceview* sv, const gchar* key, gint default_value)
+get_key_int(Sourceview* sv, const gchar* key, gint default_value)
{
return anjuta_preferences_get_int_with_default (sv->priv->prefs, key, default_value);
}
+static int
+get_key_bool(Sourceview* sv, const gchar* key, gboolean default_value)
+{
+ return anjuta_preferences_get_bool_with_default (sv->priv->prefs, key, default_value);
+}
+
void
sourceview_prefs_init(Sourceview* sv)
{
guint notify_id;
GtkSourceDrawSpacesFlags flags = 0;
- prefs = sv->priv->prefs;
-
/* Init */
- gtk_source_buffer_set_highlight_syntax(GTK_SOURCE_BUFFER(sv->priv->document), get_key(sv, HIGHLIGHT_SYNTAX, TRUE));
+ gtk_source_buffer_set_highlight_syntax(GTK_SOURCE_BUFFER(sv->priv->document), get_key_bool(sv, HIGHLIGHT_SYNTAX, TRUE));
gtk_source_view_set_highlight_current_line(GTK_SOURCE_VIEW(sv->priv->view),
- get_key(sv, HIGHLIGHT_CURRENT_LINE, FALSE));
- gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(sv->priv->view), get_key(sv, TAB_SIZE, 4));
+ get_key_bool(sv, HIGHLIGHT_CURRENT_LINE, FALSE));
+ gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(sv->priv->view), get_key_int(sv, TAB_SIZE, 4));
gtk_source_view_set_indent_width(GTK_SOURCE_VIEW(sv->priv->view), -1); /* Same as tab width */
gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(sv->priv->view),
- !get_key(sv, USE_TABS, FALSE));
+ !get_key_bool(sv, USE_TABS, FALSE));
gtk_source_buffer_set_highlight_matching_brackets(GTK_SOURCE_BUFFER(sv->priv->document),
- get_key(sv, HIGHLIGHT_BRACKETS, FALSE));
+ get_key_bool(sv, HIGHLIGHT_BRACKETS, FALSE));
gtk_source_view_set_show_line_marks(GTK_SOURCE_VIEW(sv->priv->view),
- get_key(sv, VIEW_MARKS, TRUE));
+ get_key_bool(sv, VIEW_MARKS, TRUE));
gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(sv->priv->view),
- get_key(sv, VIEW_LINENUMBERS, TRUE));
+ get_key_bool(sv, VIEW_LINENUMBERS, TRUE));
gtk_source_view_set_show_right_margin(GTK_SOURCE_VIEW(sv->priv->view),
- get_key(sv, VIEW_RIGHTMARGIN, TRUE));
+ get_key_bool(sv, VIEW_RIGHTMARGIN, TRUE));
gtk_source_view_set_right_margin_position(GTK_SOURCE_VIEW(sv->priv->view),
- get_key(sv, RIGHTMARGIN_POSITION, 80));
+ get_key_int(sv, RIGHTMARGIN_POSITION, 80));
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (sv->priv->view),
- get_key (sv, VIEW_EOL, FALSE) ? GTK_WRAP_WORD : GTK_WRAP_NONE);
+ get_key_bool (sv, VIEW_EOL, FALSE) ? GTK_WRAP_WORD : GTK_WRAP_NONE);
- if (get_key (sv, VIEW_WHITE_SPACES, FALSE))
+ if (get_key_bool (sv, VIEW_WHITE_SPACES, FALSE))
flags |= (GTK_SOURCE_DRAW_SPACES_SPACE | GTK_SOURCE_DRAW_SPACES_TAB);
- if (get_key (sv, VIEW_EOL, FALSE))
+ if (get_key_bool (sv, VIEW_EOL, FALSE))
flags |= GTK_SOURCE_DRAW_SPACES_NEWLINE;
gtk_source_view_set_draw_spaces (GTK_SOURCE_VIEW (sv->priv->view),
@@ -353,20 +351,20 @@
init_fonts(sv);
/* Register gconf notifications */
- REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
- REGISTER_NOTIFY (USE_TABS, on_gconf_notify_use_tab_for_indentation);
- REGISTER_NOTIFY (HIGHLIGHT_SYNTAX, on_gconf_notify_disable_hilite);
- REGISTER_NOTIFY (HIGHLIGHT_CURRENT_LINE, on_gconf_notify_highlight_current_line);
- REGISTER_NOTIFY (HIGHLIGHT_BRACKETS, on_gconf_notify_braces_check);
- REGISTER_NOTIFY (VIEW_MARKS, on_gconf_notify_view_marks);
- REGISTER_NOTIFY (VIEW_LINENUMBERS, on_gconf_notify_view_linenums);
- REGISTER_NOTIFY (VIEW_RIGHTMARGIN, on_gconf_notify_view_right_margin);
- REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_gconf_notify_view_spaces);
- REGISTER_NOTIFY (VIEW_EOL, on_gconf_notify_view_eols);
- REGISTER_NOTIFY (VIEW_LINE_WRAP, on_gconf_notify_line_wrap);
- REGISTER_NOTIFY (RIGHTMARGIN_POSITION, on_gconf_notify_right_margin_position);
- REGISTER_NOTIFY (FONT_THEME, on_gconf_notify_font_theme);
- REGISTER_NOTIFY (FONT, on_gconf_notify_font);
+ REGISTER_NOTIFY (TAB_SIZE, on_notify_tab_size, int);
+ REGISTER_NOTIFY (USE_TABS, on_notify_use_tab_for_indentation, bool);
+ REGISTER_NOTIFY (HIGHLIGHT_SYNTAX, on_notify_disable_hilite, bool);
+ REGISTER_NOTIFY (HIGHLIGHT_CURRENT_LINE, on_notify_highlight_current_line, bool);
+ REGISTER_NOTIFY (HIGHLIGHT_BRACKETS, on_notify_braces_check, bool);
+ REGISTER_NOTIFY (VIEW_MARKS, on_notify_view_marks, bool);
+ REGISTER_NOTIFY (VIEW_LINENUMBERS, on_notify_view_linenums, bool);
+ REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_notify_view_spaces, bool);
+ REGISTER_NOTIFY (VIEW_EOL, on_notify_view_eol, bool);
+ REGISTER_NOTIFY (VIEW_LINE_WRAP, on_notify_line_wrap, bool);
+ REGISTER_NOTIFY (VIEW_RIGHTMARGIN, on_notify_view_right_margin, bool);
+ REGISTER_NOTIFY (RIGHTMARGIN_POSITION, on_notify_right_margin_position, int);
+ REGISTER_NOTIFY (FONT_THEME, on_notify_font_theme, bool);
+ REGISTER_NOTIFY (FONT, on_notify_font, string);
}
void sourceview_prefs_destroy(Sourceview* sv)
@@ -374,16 +372,9 @@
AnjutaPreferences* prefs = sv->priv->prefs;
GList* id;
DEBUG_PRINT("%s", "Destroying preferences");
- for (id = sv->priv->gconf_notify_ids; id != NULL; id = id->next)
+ for (id = sv->priv->notify_ids; id != NULL; id = id->next)
{
anjuta_preferences_notify_remove(prefs,GPOINTER_TO_UINT(id->data));
}
- g_list_free(sv->priv->gconf_notify_ids);
-}
-
-
-AnjutaPreferences*
-sourceview_get_prefs()
-{
- return prefs;
+ g_list_free(sv->priv->notify_ids);
}
Modified: branches/preferences_singleton/plugins/sourceview/sourceview-private.h
==============================================================================
--- branches/preferences_singleton/plugins/sourceview/sourceview-private.h (original)
+++ branches/preferences_singleton/plugins/sourceview/sourceview-private.h Thu Mar 19 13:31:18 2009
@@ -45,7 +45,7 @@
/* Preferences */
AnjutaPreferences* prefs;
- GList* gconf_notify_ids;
+ GList* notify_ids;
/* Popup menu */
GtkWidget* menu;
Modified: branches/preferences_singleton/plugins/subversion/subversion-ui-utils.c
==============================================================================
--- branches/preferences_singleton/plugins/subversion/subversion-ui-utils.c (original)
+++ branches/preferences_singleton/plugins/subversion/subversion-ui-utils.c Thu Mar 19 13:31:18 2009
@@ -93,7 +93,7 @@
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- error_message);
+ "%s", error_message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
Modified: branches/preferences_singleton/plugins/symbol-db/symbol-db-prefs.c
==============================================================================
--- branches/preferences_singleton/plugins/symbol-db/symbol-db-prefs.c (original)
+++ branches/preferences_singleton/plugins/symbol-db/symbol-db-prefs.c Thu Mar 19 13:31:18 2009
@@ -119,10 +119,10 @@
}
static void
-on_gconf_notify_prefs (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_prefs (AnjutaPreferences* prefs, const gchar* key,
+ const gchar* value, gpointer user_data)
{
- DEBUG_PRINT ("%s", "on_gconf_notify_prefs ()");
+ DEBUG_PRINT ("%s", "on_notify_prefs ()");
}
static void
@@ -447,10 +447,10 @@
G_CALLBACK (on_prefs_executable_changed), sdbp);
- priv->prefs_notify_id = anjuta_preferences_notify_add (priv->prefs,
- CTAGS_PREFS_KEY,
- on_gconf_notify_prefs,
- priv->prefs, NULL);
+ priv->prefs_notify_id = anjuta_preferences_notify_add_string (priv->prefs,
+ CTAGS_PREFS_KEY,
+ on_notify_prefs,
+ priv->prefs, NULL);
check_button = glade_xml_get_widget (priv->prefs_gxml, PROJECT_AUTOSCAN);
Modified: branches/preferences_singleton/plugins/terminal/terminal.c
==============================================================================
--- branches/preferences_singleton/plugins/terminal/terminal.c (original)
+++ branches/preferences_singleton/plugins/terminal/terminal.c Thu Mar 19 13:31:18 2009
@@ -177,7 +177,8 @@
g_free (text);
setting = GET_PROFILE_BOOL (GCONF_CURSOR_BLINK);
- vte_terminal_set_cursor_blinks ((term), setting);
+ vte_terminal_set_cursor_blink_mode ((term),
+ setting ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF);
setting = GET_PROFILE_BOOL (GCONF_SILENT_BELL);
vte_terminal_set_audible_bell (term, !setting);
value = GET_PROFILE_INT (GCONF_SCROLLBACK_LINES);
@@ -256,15 +257,27 @@
}
static void
-on_gconf_notify_prefs (GConfClient *gclient, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
+on_notify_prefs_profile(AnjutaPreferences* prefs,
+ const gchar* key,
+ const gchar* value,
+ gpointer user_data)
{
TerminalPlugin *tp = ANJUTA_PLUGIN_TERMINAL (user_data);
preferences_changed (tp->prefs, tp);
}
-#define REGISTER_NOTIFY(key, func) \
- notify_id = anjuta_preferences_notify_add (tp->prefs, \
+static void
+on_notify_prefs_default (AnjutaPreferences* prefs,
+ const gchar* key,
+ gboolean value,
+ gpointer user_data)
+{
+ TerminalPlugin *tp = ANJUTA_PLUGIN_TERMINAL (user_data);
+ preferences_changed (tp->prefs, tp);
+}
+
+#define REGISTER_NOTIFY(key, func, type) \
+ notify_id = anjuta_preferences_notify_add_##type (tp->prefs, \
key, func, tp, NULL); \
tp->gconf_notify_ids = g_list_prepend (tp->gconf_notify_ids, \
GUINT_TO_POINTER (notify_id));
@@ -272,8 +285,8 @@
prefs_init (TerminalPlugin *tp)
{
guint notify_id;
- REGISTER_NOTIFY (PREFS_TERMINAL_PROFILE, on_gconf_notify_prefs);
- REGISTER_NOTIFY (PREFS_TERMINAL_PROFILE_USE_DEFAULT, on_gconf_notify_prefs);
+ REGISTER_NOTIFY (PREFS_TERMINAL_PROFILE, on_notify_prefs_profile, string);
+ REGISTER_NOTIFY (PREFS_TERMINAL_PROFILE_USE_DEFAULT, on_notify_prefs_default, bool);
}
static void
Modified: branches/preferences_singleton/plugins/tools/fileop.c
==============================================================================
--- branches/preferences_singleton/plugins/tools/fileop.c (original)
+++ branches/preferences_singleton/plugins/tools/fileop.c Thu Mar 19 13:31:18 2009
@@ -507,7 +507,7 @@
if (err != NULL)
{
/* Parsing error */
- g_warning (err->message);
+ g_warning ("%s", err->message);
g_error_free (err);
return FALSE;
Modified: branches/preferences_singleton/src/anjuta-app.c
==============================================================================
--- branches/preferences_singleton/src/anjuta-app.c (original)
+++ branches/preferences_singleton/src/anjuta-app.c Thu Mar 19 13:31:18 2009
@@ -60,13 +60,13 @@
static GtkToolbarStyle style = -1;
static void
-on_toolbar_style_changed (GConfClient* client, guint id, GConfEntry* entry,
- gpointer user_data)
+on_toolbar_style_changed (AnjutaPreferences* prefs,
+ const gchar* key,
+ const gchar* tb_style,
+ gpointer user_data)
{
AnjutaApp* app = ANJUTA_APP (user_data);
-
- char* tb_style = anjuta_preferences_get (app->preferences, "anjuta.toolbar.style");
-
+
if (tb_style)
{
if (strcasecmp (tb_style, "Default") == 0)
@@ -81,8 +81,6 @@
style = GTK_TOOLBAR_TEXT;
DEBUG_PRINT ("Toolbar style: %s", tb_style);
-
- g_free(tb_style);
}
if (style != -1)
@@ -96,14 +94,14 @@
}
static void
-on_gdl_style_changed (GConfClient* client, guint id, GConfEntry* entry,
- gpointer user_data)
+on_gdl_style_changed (AnjutaPreferences* prefs,
+ const gchar* key,
+ const gchar* pr_style,
+ gpointer user_data)
{
AnjutaApp* app = ANJUTA_APP (user_data);
GdlSwitcherStyle style = GDL_SWITCHER_STYLE_BOTH;
- gchar* pr_style = anjuta_preferences_get (app->preferences, "anjuta.gdl.style");
-
if (pr_style)
{
if (strcasecmp (pr_style, "Text") == 0)
@@ -118,8 +116,6 @@
style = GDL_SWITCHER_STYLE_TABS;
DEBUG_PRINT ("Switcher style: %s", pr_style);
-
- g_free (pr_style);
}
g_object_set (G_OBJECT(app->layout_manager->master), "switcher-style",
style, NULL);
@@ -350,6 +346,7 @@
GtkWidget *dockbar;
GtkAction* action;
GList *plugins_dirs = NULL;
+ gchar* style;
GdkGeometry size_hints = {
100, 100, 0, 0, 100, 100, 1, 1, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
};
@@ -413,10 +410,13 @@
g_object_add_weak_pointer (G_OBJECT (app->preferences),
(gpointer)&app->preferences);
- anjuta_preferences_notify_add (app->preferences, "anjuta.gdl.style",
- on_gdl_style_changed, app, NULL);
-
- on_gdl_style_changed (NULL, 0, NULL, app);
+ anjuta_preferences_notify_add_string (app->preferences, "anjuta.gdl.style",
+ on_gdl_style_changed, app, NULL);
+ style = anjuta_preferences_get (app->preferences, "anjuta.gdl.style");
+
+ on_gdl_style_changed (app->preferences, NULL,
+ style, app);
+ g_free (style);
/* Register actions */
anjuta_ui_add_action_group_entries (app->ui, "ActionGroupFile", _("File"),
@@ -464,9 +464,11 @@
anjuta_preferences_get_int_with_default (app->preferences,
"anjuta.toolbar.visible",
TRUE));
- anjuta_preferences_notify_add (app->preferences, "anjuta.toolbar.style",
+ anjuta_preferences_notify_add_string (app->preferences, "anjuta.toolbar.style",
on_toolbar_style_changed, app, NULL);
- on_toolbar_style_changed (NULL, 0, NULL, app);
+ style = anjuta_preferences_get (app->preferences, "anjuta.toolbar.style");
+ on_toolbar_style_changed (app->preferences, NULL, style, app);
+ g_free (style);
/* Create widgets menu */
view_menu =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]