Commit 0c83b9b2 authored by Matthew Barnes's avatar Matthew Barnes

Miscellaneous cleanups.

parent c75f58d0
......@@ -473,6 +473,7 @@ build_quick_add_dialog (QuickAdd *qa)
gconf_client, "/apps/evolution/addressbook/sources");
source = e_source_list_peek_default_source (qa->source_list);
g_object_unref (gconf_client);
qa->combo_box = e_source_combo_box_new (qa->source_list);
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (qa->combo_box), source);
......
......@@ -833,6 +833,7 @@ eab_contact_locate_match_full (EBookClient *book_client,
return;
source = e_source_list_peek_default_source (info->source_list);
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
e_client_utils_authenticate_handler, NULL,
......
......@@ -37,7 +37,9 @@
#include "alarm-queue.h"
#include "config-data.h"
#define APPLICATION_ID "org.gnome.EvolutionAlarmNotify"
#define ALARM_NOTIFY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), TYPE_ALARM_NOTIFY, AlarmNotifyPrivate))
#define APPLICATION_ID "org.gnome.EvolutionAlarmNotify"
......@@ -239,7 +241,7 @@ alarm_notify_finalize (GObject *object)
AlarmNotifyPrivate *priv;
gint ii;
priv = ALARM_NOTIFY (object)->priv;
priv = ALARM_NOTIFY_GET_PRIVATE (object);
if (priv->offline_timeout_id)
g_source_remove (priv->offline_timeout_id);
......@@ -334,8 +336,7 @@ alarm_notify_init (AlarmNotify *an)
{
gint ii;
an->priv = G_TYPE_INSTANCE_GET_PRIVATE (
an, TYPE_ALARM_NOTIFY, AlarmNotifyPrivate);
an->priv = ALARM_NOTIFY_GET_PRIVATE (an);
an->priv->mutex = g_mutex_new ();
an->priv->selected_calendars = config_data_get_calendars (
"/apps/evolution/calendar/sources");
......
......@@ -5034,7 +5034,7 @@ e_load_spell_languages (void)
GSettings *settings;
GList *spell_languages = NULL;
gchar **strv;
gint i;
gint ii;
/* Ask GSettings for a list of spell check language codes. */
settings = g_settings_new ("org.gnome.evolution.mail");
......@@ -5042,8 +5042,8 @@ e_load_spell_languages (void)
g_object_unref (settings);
/* Convert the codes to spell language structs. */
for (i = 0; strv[i] != NULL; i++) {
gchar *language_code = strv[i];
for (ii = 0; strv[ii] != NULL; ii++) {
gchar *language_code = strv[ii];
const GtkhtmlSpellLanguage *language;
language = gtkhtml_spell_language_lookup (language_code);
......@@ -5094,7 +5094,7 @@ e_save_spell_languages (GList *spell_languages)
/* Save the language codes to GSettings. */
settings = g_settings_new ("org.gnome.evolution.mail");
g_settings_set_strv (settings, "composer-spell-languages", (const char * const *) lang_array->pdata);
g_settings_set_strv (settings, "composer-spell-languages", (const gchar * const *) lang_array->pdata);
g_object_unref (settings);
g_ptr_array_free (lang_array, TRUE);
......
......@@ -107,7 +107,7 @@ ep_set_enabled (const gchar *id,
gint state)
{
GSettings *settings;
GSList *l;
GSList *link;
GPtrArray *array;
/* Bail out if no change to state, when expressed as a boolean: */
......@@ -128,8 +128,8 @@ ep_set_enabled (const gchar *id,
settings = g_settings_new ("org.gnome.evolution");
array = g_ptr_array_new ();
for (l = ep_disabled; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
for (link = ep_disabled; link != NULL; link = link->next)
g_ptr_array_add (array, link->data);
g_ptr_array_add (array, NULL);
g_settings_set_strv (
settings, "disabled-eplugins",
......
......@@ -280,9 +280,13 @@ ESignatureList *
e_signature_list_new (void)
{
ESignatureList *signature_list;
GConfClient *client;
signature_list = g_object_new (E_TYPE_SIGNATURE_LIST, NULL);
e_signature_list_construct (signature_list, gconf_client_get_default ());
client = gconf_client_get_default ();
e_signature_list_construct (signature_list, client);
g_object_unref (client);
return signature_list;
}
......
......@@ -38,9 +38,8 @@ static ESignatureList *global_signature_list;
ESignatureList *
e_get_signature_list (void)
{
if (G_UNLIKELY (global_signature_list == NULL)) {
if (G_UNLIKELY (global_signature_list == NULL))
global_signature_list = e_signature_list_new ();
}
g_return_val_if_fail (global_signature_list != NULL, NULL);
......
......@@ -160,6 +160,7 @@ mail_label_list_store_finalize (GObject *object)
priv = E_MAIL_LABEL_LIST_STORE (object)->priv;
g_hash_table_destroy (priv->tag_index);
if (priv->mail_settings != NULL) {
g_object_unref (priv->mail_settings);
priv->mail_settings = NULL;
......@@ -250,19 +251,24 @@ mail_label_list_store_constructed (GObject *object)
/* Connect to GSettings' change notifications */
store->priv->mail_settings = g_settings_new ("org.gnome.evolution.mail");
g_signal_connect (store->priv->mail_settings, "changed::labels",
G_CALLBACK (labels_settings_changed_cb), store);
g_signal_connect (
store->priv->mail_settings, "changed::labels",
G_CALLBACK (labels_settings_changed_cb), store);
labels_settings_changed_cb (store->priv->mail_settings, "labels", store);
/* Connect to ListStore change notifications */
g_signal_connect (store, "row-inserted",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (store, "row-changed",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (store, "row-deleted",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (store, "rows-reordered",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (
store, "row-inserted",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (
store, "row-changed",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (
store, "row-deleted",
G_CALLBACK (labels_model_changed_cb), store);
g_signal_connect (
store, "rows-reordered",
G_CALLBACK (labels_model_changed_cb), store);
mail_label_list_store_ensure_defaults (store);
......
......@@ -1321,7 +1321,9 @@ e_mail_session_init (EMailSession *session)
camel_session_set_check_junk (
CAMEL_SESSION (session), g_settings_get_boolean (
settings, "junk-check-incoming"));
g_signal_connect (settings, "changed", G_CALLBACK (mail_session_check_junk_notify), session);
g_signal_connect (
settings, "changed",
G_CALLBACK (mail_session_check_junk_notify), session);
mail_config_reload_junk_headers (session);
......
......@@ -165,9 +165,10 @@ em_utils_prompt_user (GtkWindow *parent,
button = gtk_dialog_run (GTK_DIALOG (dialog));
if (promptkey)
g_settings_set_boolean (settings, promptkey,
!gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (check)));
g_settings_set_boolean (
settings, promptkey,
!gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (check)));
gtk_widget_destroy (dialog);
......
......@@ -253,34 +253,41 @@ mail_config_init (EMailSession *session)
/* Composer Configuration */
settings_outlook_filenames_changed (mail_settings, NULL, NULL);
g_signal_connect (mail_settings, "changed::composer-outlook-filenames",
G_CALLBACK (settings_outlook_filenames_changed), NULL);
g_signal_connect (
mail_settings, "changed::composer-outlook-filenames",
G_CALLBACK (settings_outlook_filenames_changed), NULL);
/* Display Configuration */
g_signal_connect (mail_settings, "changed::address-compress",
G_CALLBACK (settings_bool_value_changed), &config->address_compress);
g_signal_connect (
mail_settings, "changed::address-compress",
G_CALLBACK (settings_bool_value_changed), &config->address_compress);
config->address_compress = g_settings_get_boolean (mail_settings, "address-compress");
g_signal_connect (mail_settings, "changed::address-count",
G_CALLBACK (settings_int_value_changed), &config->address_count);
g_signal_connect (
mail_settings, "changed::address-count",
G_CALLBACK (settings_int_value_changed), &config->address_count);
config->address_count = g_settings_get_int (mail_settings, "address-count");
/* Junk Configuration */
g_signal_connect (mail_settings, "changed::junk-check-custom-header",
G_CALLBACK (settings_jh_check_changed), session);
g_signal_connect (
mail_settings, "changed::junk-check-custom-header",
G_CALLBACK (settings_jh_check_changed), session);
config->jh_check = g_settings_get_boolean (mail_settings, "junk-check-custom-header");
g_signal_connect (mail_settings, "changed::junk-custom-header",
G_CALLBACK (settings_jh_headers_changed), session);
g_signal_connect (
mail_settings, "changed::junk-custom-header",
G_CALLBACK (settings_jh_headers_changed), session);
g_signal_connect (mail_settings, "changed::junk-lookup-addressbook",
G_CALLBACK (settings_bool_value_changed), &config->book_lookup);
g_signal_connect (
mail_settings, "changed::junk-lookup-addressbook",
G_CALLBACK (settings_bool_value_changed), &config->book_lookup);
config->book_lookup = g_settings_get_boolean (mail_settings, "junk-lookup-addressbook");
g_signal_connect (mail_settings, "changed::junk-lookup-addressbook-local-only",
G_CALLBACK (settings_bool_value_changed), &config->book_lookup_local_only);
g_signal_connect (
mail_settings, "changed::junk-lookup-addressbook-local-only",
G_CALLBACK (settings_bool_value_changed), &config->book_lookup_local_only);
config->book_lookup_local_only = g_settings_get_boolean (mail_settings, "junk-lookup-addressbook-local-only");
settings_jh_check_changed (mail_settings, NULL, session);
......
......@@ -507,7 +507,10 @@ e_bogofilter_init (EBogofilter *extension)
GSettings *settings;
settings = g_settings_new ("org.gnome.evolution.eplugin.bogo-junk");
g_settings_bind (settings, "utf8-for-spam-filter", G_OBJECT (extension), "convert-to-unicode", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "utf8-for-spam-filter",
G_OBJECT (extension), "convert-to-unicode",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings);
}
......
......@@ -902,9 +902,9 @@ GSList *
e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend)
{
GSettings *settings;
char **strv;
gint i;
GSList *selected_calendars = NULL;
char **strv;
gint ii;
g_return_val_if_fail (
E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
......@@ -914,8 +914,8 @@ e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend)
g_object_unref (settings);
if (strv != NULL) {
for (i = 0; strv[i] != NULL; i++)
selected_calendars = g_slist_append (selected_calendars, g_strdup (strv[i]));
for (ii = 0; strv[ii] != NULL; ii++)
selected_calendars = g_slist_append (selected_calendars, g_strdup (strv[ii]));
g_strfreev (strv);
}
......@@ -928,13 +928,13 @@ e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend,
GSList *selected_calendars)
{
GSettings *settings;
GSList *l;
GSList *link;
GPtrArray *array = g_ptr_array_new ();
g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend));
for (l = selected_calendars; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
for (link = selected_calendars; link != NULL; link = link->next)
g_ptr_array_add (array, link->data);
g_ptr_array_add (array, NULL);
settings = g_settings_new ("org.gnome.evolution.calendar");
......
......@@ -646,9 +646,9 @@ GSList *
e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_backend)
{
GSettings *settings;
char **strv;
gint i;
GSList *selected_memo_lists = NULL;
char **strv;
gint ii;
g_return_val_if_fail (
E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
......@@ -659,8 +659,8 @@ e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_back
if (strv != NULL) {
for (i = 0; strv[i] != NULL; i++)
selected_memo_lists = g_slist_append (selected_memo_lists, g_strdup (strv[i]));
for (ii = 0; strv[ii] != NULL; ii++)
selected_memo_lists = g_slist_append (selected_memo_lists, g_strdup (strv[ii]));
g_strfreev (strv);
}
......@@ -673,13 +673,13 @@ e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_back
GSList *selected_memo_lists)
{
GSettings *settings;
GSList *l;
GSList *link;
GPtrArray *array = g_ptr_array_new ();
g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend));
for (l = selected_memo_lists; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
for (link = selected_memo_lists; link != NULL; link = link->next)
g_ptr_array_add (array, link->data);
g_ptr_array_add (array, NULL);
settings = g_settings_new ("org.gnome.evolution.calendar");
......
......@@ -651,9 +651,9 @@ GSList *
e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_backend)
{
GSettings *settings;
char **strv;
gint i;
GSList *selected_task_lists = NULL;
char **strv;
gint ii;
g_return_val_if_fail (
E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
......@@ -663,8 +663,8 @@ e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_back
g_object_unref (G_OBJECT (settings));
if (strv != NULL) {
for (i = 0; strv[i] != NULL; i++)
selected_task_lists = g_slist_append (selected_task_lists, g_strdup (strv[i]));
for (ii = 0; strv[ii] != NULL; ii++)
selected_task_lists = g_slist_append (selected_task_lists, g_strdup (strv[ii]));
g_strfreev (strv);
}
......@@ -677,13 +677,13 @@ e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_back
GSList *selected_task_lists)
{
GSettings *settings;
GSList *l;
GSList *link;
GPtrArray *array = g_ptr_array_new ();
g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend));
for (l = selected_task_lists; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
for (link = selected_task_lists; link != NULL; link = link->next)
g_ptr_array_add (array, link->data);
g_ptr_array_add (array, NULL);
settings = g_settings_new ("org.gnome.evolution.calendar");
......
......@@ -135,15 +135,15 @@ jh_tree_refill (EMMailerPrefs *prefs)
{
GtkListStore *store = prefs->junk_header_list_store;
gchar **strv;
gint i;
gint ii;
strv = g_settings_get_strv (prefs->settings, "junk-custom-header");
gtk_list_store_clear (store);
for (i = 0; strv[i] != NULL; i++) {
for (ii = 0; strv[ii] != NULL; ii++) {
GtkTreeIter iter;
gchar **tokens = g_strsplit (strv[i], "=", 2);
gchar **tokens = g_strsplit (strv[ii], "=", 2);
gtk_list_store_append (store, &iter);
gtk_list_store_set (
......@@ -200,15 +200,15 @@ jh_add_cb (GtkWidget *widget,
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
gchar **strv;
GPtrArray *array;
gint i;
gint ii;
name = gtk_entry_get_text (GTK_ENTRY (e_builder_get_widget (builder, "junk-header-name")));
value = gtk_entry_get_text (GTK_ENTRY (e_builder_get_widget (builder, "junk-header-content")));
strv = g_settings_get_strv (prefs->settings, "junk-custom-header");
array = g_ptr_array_new ();
for (i = 0; strv[i] != NULL; i++)
g_ptr_array_add (array, strv[i]);
for (ii = 0; strv[ii] != NULL; ii++)
g_ptr_array_add (array, strv[ii]);
tok = g_strdup_printf ("%s=%s", name, value);
g_ptr_array_add (array, tok);
g_ptr_array_add (array, NULL);
......@@ -237,17 +237,17 @@ jh_remove_cb (GtkWidget *widget,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->junk_header_tree));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
GPtrArray *array = g_ptr_array_new ();
gchar *name = NULL, *value = NULL;
gchar **strv;
GPtrArray *array = g_ptr_array_new ();
gint i;
gint ii;
strv = g_settings_get_strv (prefs->settings, "junk-custom-header");
gtk_tree_model_get (model, &iter, JH_LIST_COLUMN_NAME, &name, JH_LIST_COLUMN_VALUE, &value, -1);
for (i = 0; strv[i] != NULL; i++) {
for (ii = 0; strv[ii] != NULL; ii++) {
gchar *test;
gint len = strlen (name);
test = strncmp (strv[i], name, len) == 0 ? (gchar *) strv[i] + len : NULL;
test = strncmp (strv[ii], name, len) == 0 ? (gchar *) strv[ii] + len : NULL;
if (test) {
test++;
......@@ -255,7 +255,7 @@ jh_remove_cb (GtkWidget *widget,
continue;
}
g_ptr_array_add (array, strv[i]);
g_ptr_array_add (array, strv[ii]);
}
g_ptr_array_add (array, NULL);
......
......@@ -365,7 +365,9 @@ e_shell_settings_install_property_for_key (const gchar *property_name,
shell_settings = E_SHELL_SETTINGS (iter->data);
g_settings_bind (settings, key, G_OBJECT (shell_settings), property_name, G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, key, G_OBJECT (shell_settings),
property_name, G_SETTINGS_BIND_DEFAULT);
}
for (iter = instances; iter != NULL; iter = next) {
......
......@@ -46,6 +46,10 @@
#include "e-shell-window.h"
#include "e-shell-utils.h"
#define E_SHELL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL, EShellPrivate))
struct _EShellPrivate {
GQueue alerts;
EShellSettings *settings;
......@@ -693,7 +697,7 @@ shell_dispose (GObject *object)
EShellPrivate *priv;
EAlert *alert;
priv = E_SHELL (object)->priv;
priv = E_SHELL_GET_PRIVATE (object);
while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) {
g_signal_handlers_disconnect_by_func (
......@@ -747,7 +751,7 @@ shell_finalize (GObject *object)
{
EShellPrivate *priv;
priv = E_SHELL (object)->priv;
priv = E_SHELL_GET_PRIVATE (object);
g_hash_table_destroy (priv->backends_by_name);
g_hash_table_destroy (priv->backends_by_scheme);
......@@ -1162,8 +1166,7 @@ e_shell_init (EShell *shell)
GtkIconTheme *icon_theme;
EggSMClient *sm_client;
shell->priv = G_TYPE_INSTANCE_GET_PRIVATE (
shell, E_TYPE_SHELL, EShellPrivate);
shell->priv = E_SHELL_GET_PRIVATE (shell);
backends_by_name = g_hash_table_new (g_str_hash, g_str_equal);
backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment