diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-01 10:53:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-02-20 23:04:25 +0800 |
commit | 23f5773903d64a554d977ae7d0ebbaca73528f1f (patch) | |
tree | 104e1a59da8bf96b004bce204b79f47bbe0a6d13 /e-util | |
parent | 49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff) | |
download | gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-alert-dialog.c | 9 | ||||
-rw-r--r-- | e-util/e-alert.c | 19 | ||||
-rw-r--r-- | e-util/e-bit-array.c | 4 | ||||
-rw-r--r-- | e-util/e-config.c | 11 | ||||
-rw-r--r-- | e-util/e-datetime-format.c | 4 | ||||
-rw-r--r-- | e-util/e-dialog-widgets.c | 1 | ||||
-rw-r--r-- | e-util/e-event.c | 7 | ||||
-rw-r--r-- | e-util/e-plugin-ui.c | 11 | ||||
-rw-r--r-- | e-util/e-sorter-array.c | 6 | ||||
-rw-r--r-- | e-util/e-sorter.c | 12 | ||||
-rw-r--r-- | e-util/e-text-event-processor-emacs-like.c | 100 | ||||
-rw-r--r-- | e-util/e-text-event-processor.c | 8 | ||||
-rw-r--r-- | e-util/e-ui-manager.c | 7 | ||||
-rw-r--r-- | e-util/e-util.c | 28 |
14 files changed, 150 insertions, 77 deletions
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c index 2f27a4fbcd..5f426aacd0 100644 --- a/e-util/e-alert-dialog.c +++ b/e-util/e-alert-dialog.c @@ -31,6 +31,10 @@ #include "e-util.h" +#define E_ALERT_DIALOG_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_ALERT_DIALOG, EAlertDialogPrivate)) + struct _EAlertDialogPrivate { GtkWidget *content_area; /* not referenced */ EAlert *alert; @@ -95,7 +99,7 @@ alert_dialog_dispose (GObject *object) { EAlertDialogPrivate *priv; - priv = E_ALERT_DIALOG (object)->priv; + priv = E_ALERT_DIALOG_GET_PRIVATE (object); if (priv->alert) { g_signal_handlers_disconnect_matched ( @@ -292,8 +296,7 @@ e_alert_dialog_class_init (EAlertDialogClass *class) static void e_alert_dialog_init (EAlertDialog *dialog) { - dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - dialog, E_TYPE_ALERT_DIALOG, EAlertDialogPrivate); + dialog->priv = E_ALERT_DIALOG_GET_PRIVATE (dialog); } GtkWidget * diff --git a/e-util/e-alert.c b/e-util/e-alert.c index d4a7a9ea13..9ee7e05581 100644 --- a/e-util/e-alert.c +++ b/e-util/e-alert.c @@ -44,6 +44,10 @@ #define d(x) +#define E_ALERT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_ALERT, EAlertPrivate)) + typedef struct _EAlertButton EAlertButton; struct _e_alert { @@ -196,19 +200,23 @@ e_alert_load (const gchar *path) table->alerts = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (alert_table, (gpointer) table->domain, table); - tmp2 = (gchar *)xmlGetProp(root, (const guchar *)"translation-domain"); + tmp2 = (gchar *) xmlGetProp ( + root, (const guchar *) "translation-domain"); if (tmp2) { table->translation_domain = g_strdup (tmp2); xmlFree (tmp2); - tmp2 = (gchar *)xmlGetProp(root, (const guchar *)"translation-localedir"); + tmp2 = (gchar *) xmlGetProp ( + root, (const guchar *) "translation-localedir"); if (tmp2) { bindtextdomain (table->translation_domain, tmp2); xmlFree (tmp2); } } } else - g_warning("Error file '%s', domain '%s' already used, merging", path, tmp); + g_warning ( + "Error file '%s', domain '%s' " + "already used, merging", path, tmp); xmlFree (tmp); for (error = root->children; error; error = error->next) { @@ -537,7 +545,7 @@ alert_finalize (GObject *object) { EAlertPrivate *priv; - priv = E_ALERT (object)->priv; + priv = E_ALERT_GET_PRIVATE (object); g_free (priv->tag); g_free (priv->primary_text); @@ -683,8 +691,7 @@ e_alert_class_init (EAlertClass *class) static void e_alert_init (EAlert *alert) { - alert->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - alert, E_TYPE_ALERT, EAlertPrivate); + alert->priv = E_ALERT_GET_PRIVATE (alert); g_queue_init (&alert->priv->actions); } diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c index 62156e9063..456a4d495d 100644 --- a/e-util/e-bit-array.c +++ b/e-util/e-bit-array.c @@ -401,11 +401,11 @@ e_bit_array_init (EBitArray *eba) } static void -e_bit_array_class_init (EBitArrayClass *klass) +e_bit_array_class_init (EBitArrayClass *class) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS (klass); + object_class = G_OBJECT_CLASS (class); object_class->dispose = eba_dispose; } diff --git a/e-util/e-config.c b/e-util/e-config.c index 7257f5a024..c4a6b7c419 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -34,6 +34,10 @@ #include <glib/gi18n.h> +#define E_CONFIG_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CONFIG, EConfigPrivate)) + #define d(x) typedef GtkWidget * @@ -226,8 +230,7 @@ e_config_class_init (EConfigClass *class) static void e_config_init (EConfig *config) { - config->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - config, E_TYPE_CONFIG, EConfigPrivate); + config->priv = E_CONFIG_GET_PRIVATE (config); } /** @@ -1167,7 +1170,9 @@ e_config_create_widget (EConfig *emp) ec_rebuild (emp); /* auto-unref it */ - g_signal_connect (emp->widget, "destroy", G_CALLBACK(ec_widget_destroy), emp); + g_signal_connect ( + emp->widget, "destroy", + G_CALLBACK (ec_widget_destroy), emp); /* FIXME: for some reason ec_rebuild puts the widget on page 1, this is just to override that */ if (emp->type == E_CONFIG_BOOK) diff --git a/e-util/e-datetime-format.c b/e-util/e-datetime-format.c index a1fb490fdd..1aa7afc78a 100644 --- a/e-util/e-datetime-format.c +++ b/e-util/e-datetime-format.c @@ -613,7 +613,9 @@ e_datetime_format_add_setup_widget (GtkWidget *table, g_object_set_data (G_OBJECT (combo), "format-kind", GINT_TO_POINTER (kind)); g_object_set_data_full (G_OBJECT (combo), "format-key", key, g_free); g_object_set_data_full (G_OBJECT (combo), "setup-key-file", setup_keyfile, unref_setup_keyfile); - g_signal_connect (combo, "changed", G_CALLBACK (format_combo_changed_cb), NULL); + g_signal_connect ( + combo, "changed", + G_CALLBACK (format_combo_changed_cb), NULL); update_preview_widget (combo); diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c index 2793141da0..78b21a4146 100644 --- a/e-util/e-dialog-widgets.c +++ b/e-util/e-dialog-widgets.c @@ -133,4 +133,3 @@ e_dialog_combo_box_get (GtkWidget *widget, return i; } - diff --git a/e-util/e-event.c b/e-util/e-event.c index ca978820e9..409c23c9a9 100644 --- a/e-util/e-event.c +++ b/e-util/e-event.c @@ -33,6 +33,10 @@ #include <glib/gi18n.h> +#define E_EVENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_EVENT, EEventPrivate)) + #define d(x) struct _event_node { @@ -109,8 +113,7 @@ e_event_class_init (EEventClass *class) static void e_event_init (EEvent *event) { - event->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - event, E_TYPE_EVENT, EEventPrivate); + event->priv = E_EVENT_GET_PRIVATE (event); g_queue_init (&event->priv->events); } diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c index 3ac9eb92db..1e66716183 100644 --- a/e-util/e-plugin-ui.c +++ b/e-util/e-plugin-ui.c @@ -26,6 +26,10 @@ #include <string.h> +#define E_PLUGIN_UI_HOOK_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_PLUGIN_UI_HOOK, EPluginUIHookPrivate)) + #define E_PLUGIN_UI_DEFAULT_FUNC "e_plugin_ui_init" #define E_PLUGIN_UI_HOOK_CLASS_ID "org.gnome.evolution.ui:1.0" @@ -399,7 +403,7 @@ plugin_ui_hook_finalize (GObject *object) GHashTableIter iter; gpointer ui_manager; - priv = E_PLUGIN_UI_HOOK (object)->priv; + priv = E_PLUGIN_UI_HOOK_GET_PRIVATE (object); /* Remove weak reference callbacks to GtkUIManagers. */ g_hash_table_iter_init (&iter, priv->registry); @@ -423,7 +427,7 @@ plugin_ui_hook_construct (EPluginHook *hook, { EPluginUIHookPrivate *priv; - priv = E_PLUGIN_UI_HOOK (hook)->priv; + priv = E_PLUGIN_UI_HOOK_GET_PRIVATE (hook); /* XXX The EPlugin should be a property of EPluginHookClass. * Then it could be passed directly to g_object_new() and @@ -525,8 +529,7 @@ e_plugin_ui_hook_init (EPluginUIHook *hook) registry = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_hash_table_destroy); - hook->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - hook, E_TYPE_PLUGIN_UI_HOOK, EPluginUIHookPrivate); + hook->priv = E_PLUGIN_UI_HOOK_GET_PRIVATE (hook); hook->priv->ui_definitions = ui_definitions; hook->priv->callbacks = callbacks; hook->priv->registry = registry; diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c index 106a2d66ca..4caa092704 100644 --- a/e-util/e-sorter-array.c +++ b/e-util/e-sorter-array.c @@ -283,10 +283,10 @@ e_sorter_array_new (ECreateCmpCacheFunc create_cmp_cache, } static void -e_sorter_array_class_init (ESorterArrayClass *klass) +e_sorter_array_class_init (ESorterArrayClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ESorterClass *sorter_class = E_SORTER_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ESorterClass *sorter_class = E_SORTER_CLASS (class); object_class->finalize = esa_finalize; diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c index de10916634..b55d985daa 100644 --- a/e-util/e-sorter.c +++ b/e-util/e-sorter.c @@ -46,13 +46,13 @@ static void es_get_sorted_to_model_array (ESorter *es, gint **array, gint *count static gboolean es_needs_sorting (ESorter *es); static void -e_sorter_class_init (ESorterClass *klass) +e_sorter_class_init (ESorterClass *class) { - klass->model_to_sorted = es_model_to_sorted; - klass->sorted_to_model = es_sorted_to_model; - klass->get_model_to_sorted_array = es_get_model_to_sorted_array; - klass->get_sorted_to_model_array = es_get_sorted_to_model_array; - klass->needs_sorting = es_needs_sorting; + class->model_to_sorted = es_model_to_sorted; + class->sorted_to_model = es_sorted_to_model; + class->get_model_to_sorted_array = es_get_model_to_sorted_array; + class->get_sorted_to_model_array = es_get_sorted_to_model_array; + class->needs_sorting = es_needs_sorting; } static void diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index d5267d5b30..fa724a2c77 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/e-text-event-processor-emacs-like.c @@ -32,21 +32,15 @@ #include "e-util.h" static gint e_text_event_processor_emacs_like_event - (ETextEventProcessor *tep, - ETextEventProcessorEvent *event); + (ETextEventProcessor *tep, + ETextEventProcessorEvent *event); G_DEFINE_TYPE ( ETextEventProcessorEmacsLike, e_text_event_processor_emacs_like, E_TEXT_EVENT_PROCESSOR_TYPE) -/* The arguments we take */ -enum { - ARG_0 -}; - -static const ETextEventProcessorCommand control_keys[26] = -{ +static const ETextEventProcessorCommand control_keys[26] = { { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */ { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */ { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */ @@ -75,8 +69,7 @@ static const ETextEventProcessorCommand control_keys[26] = { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ }; -static const ETextEventProcessorCommand alt_keys[26] = -{ +static const ETextEventProcessorCommand alt_keys[26] = { { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */ { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */ { E_TEP_SELECTION, E_TEP_CAPS, E_TEP_CAPS_TITLE, "" },/* c */ @@ -107,11 +100,11 @@ static const ETextEventProcessorCommand alt_keys[26] = }; static void -e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) +e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *class) { ETextEventProcessorClass *processor_class; - processor_class = (ETextEventProcessorClass *) klass; + processor_class = (ETextEventProcessorClass *) class; processor_class->event = e_text_event_processor_emacs_like_event; } @@ -128,12 +121,13 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorCommand command; ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE (tep); command.action = E_TEP_NOP; + /* Warning from the Intel compiler here: * e-text-event-processor-emacs-like.c(136): warning #589: * transfer of control bypasses initialization of: - * * variable "key" (declared at line 194) - * * switch (event->type) { - * * ^ + * variable "key" (declared at line 194) + * switch (event->type) { + * ^ */ switch (event->type) { case GDK_BUTTON_PRESS: @@ -151,6 +145,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, tep_el->mouse_down = event->button.button == 1; } break; + case GDK_2BUTTON_PRESS: if (event->button.button == 1) { command.action = E_TEP_SELECT; @@ -158,6 +153,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.time = event->button.time; } break; + case GDK_3BUTTON_PRESS: if (event->button.button == 1) { command.action = E_TEP_SELECT; @@ -165,6 +161,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.time = event->button.time; } break; + case GDK_BUTTON_RELEASE: if (event->button.button == 1) { command.action = E_TEP_UNGRAB; @@ -183,6 +180,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.time = event->button.time; } break; + case GDK_MOTION_NOTIFY: if (tep_el->mouse_down) { command.action = E_TEP_SELECT; @@ -191,16 +189,20 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.value = event->motion.position; } break; + case GDK_KEY_PRESS: { ETextEventProcessorEventKey key = event->key; + command.time = event->key.time; + if (key.state & GDK_SHIFT_MASK) command.action = E_TEP_SELECT; else if (key.state & GDK_MOD1_MASK) command.action = E_TEP_NOP; else command.action = E_TEP_MOVE; + switch (key.keyval) { case GDK_KEY_Home: case GDK_KEY_KP_Home: @@ -209,6 +211,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, else command.position = E_TEP_START_OF_LINE; break; + case GDK_KEY_End: case GDK_KEY_KP_End: if (key.state & GDK_CONTROL_MASK) @@ -216,17 +219,27 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, else command.position = E_TEP_END_OF_LINE; break; + case GDK_KEY_Page_Up: - case GDK_KEY_KP_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break; + case GDK_KEY_KP_Page_Up: + command.position = E_TEP_BACKWARD_PAGE; + break; case GDK_KEY_Page_Down: - case GDK_KEY_KP_Page_Down: command.position = E_TEP_FORWARD_PAGE; break; - /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ + case GDK_KEY_KP_Page_Down: + command.position = E_TEP_FORWARD_PAGE; + break; + + /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ case GDK_KEY_Up: - case GDK_KEY_KP_Up: command.position = E_TEP_BACKWARD_LINE; break; + case GDK_KEY_KP_Up: + command.position = E_TEP_BACKWARD_LINE; + break; case GDK_KEY_Down: - case GDK_KEY_KP_Down: command.position = E_TEP_FORWARD_LINE; break; + case GDK_KEY_KP_Down: + command.position = E_TEP_FORWARD_LINE; + break; case GDK_KEY_Left: case GDK_KEY_KP_Left: @@ -235,6 +248,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, else command.position = E_TEP_BACKWARD_CHARACTER; break; + case GDK_KEY_Right: case GDK_KEY_KP_Right: if (key.state & GDK_CONTROL_MASK) @@ -250,10 +264,12 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, else command.position = E_TEP_BACKWARD_CHARACTER; break; + case GDK_KEY_Clear: command.action = E_TEP_DELETE; command.position = E_TEP_END_OF_LINE; break; + case GDK_KEY_Insert: case GDK_KEY_KP_Insert: if (key.state & GDK_SHIFT_MASK) { @@ -266,22 +282,27 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, /* gtk_toggle_insert(text) -- IMPLEMENT -- FIXME */ } break; + case GDK_KEY_F16: command.action = E_TEP_COPY; command.position = E_TEP_SELECTION; break; + case GDK_KEY_F18: command.action = E_TEP_PASTE; command.position = E_TEP_SELECTION; break; + case GDK_KEY_F20: command.action = E_TEP_COPY; command.position = E_TEP_SELECTION; - g_signal_emit_by_name (tep, "command", &command); + g_signal_emit_by_name ( + tep, "command", &command); command.action = E_TEP_DELETE; command.position = E_TEP_SELECTION; break; + case GDK_KEY_Delete: case GDK_KEY_KP_Delete: if (key.state & GDK_CONTROL_MASK) { @@ -290,7 +311,8 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, } else if (key.state & GDK_SHIFT_MASK) { command.action = E_TEP_COPY; command.position = E_TEP_SELECTION; - g_signal_emit_by_name (tep, "command", &command); + g_signal_emit_by_name ( + tep, "command", &command); command.action = E_TEP_DELETE; command.position = E_TEP_SELECTION; @@ -299,6 +321,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.position = E_TEP_FORWARD_CHARACTER; } break; + case GDK_KEY_Tab: case GDK_KEY_KP_Tab: case GDK_KEY_ISO_Left_Tab: @@ -307,6 +330,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.action = E_TEP_NOP; command.position = E_TEP_SELECTION; break; + case GDK_KEY_Return: case GDK_KEY_KP_Enter: if (tep->allow_newlines) { @@ -329,6 +353,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, } } break; + case GDK_KEY_Escape: /* Don't insert literally */ command.action = E_TEP_NOP; @@ -341,96 +366,112 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, command.value = 1; command.string = " "; break; + case GDK_KEY_KP_Equal: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "="; break; + case GDK_KEY_KP_Multiply: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "*"; break; + case GDK_KEY_KP_Add: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "+"; break; + case GDK_KEY_KP_Subtract: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "-"; break; + case GDK_KEY_KP_Decimal: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "."; break; + case GDK_KEY_KP_Divide: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "/"; break; + case GDK_KEY_KP_0: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "0"; break; + case GDK_KEY_KP_1: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "1"; break; + case GDK_KEY_KP_2: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "2"; break; + case GDK_KEY_KP_3: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "3"; break; + case GDK_KEY_KP_4: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "4"; break; + case GDK_KEY_KP_5: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "5"; break; + case GDK_KEY_KP_6: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "6"; break; + case GDK_KEY_KP_7: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "7"; break; + case GDK_KEY_KP_8: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.value = 1; command.string = "8"; break; + case GDK_KEY_KP_9: command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; @@ -439,7 +480,8 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, break; default: - if ((key.state & GDK_CONTROL_MASK) && !(key.state & GDK_MOD1_MASK)) { + if ((key.state & GDK_CONTROL_MASK) && + !(key.state & GDK_MOD1_MASK)) { if ((key.keyval >= 'A') && (key.keyval <= 'Z')) key.keyval -= 'A' - 'a'; @@ -465,6 +507,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, } break; + } else if ((key.state & GDK_MOD1_MASK) && !(key.state & GDK_CONTROL_MASK)) { if ((key.keyval >= 'A') && (key.keyval <= 'Z')) @@ -480,7 +523,8 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, } else if (!(key.state & GDK_MOD1_MASK) && !(key.state & GDK_CONTROL_MASK) && key.length > 0) { - if (key.keyval >= GDK_KEY_KP_0 && key.keyval <= GDK_KEY_KP_9) { + if (key.keyval >= GDK_KEY_KP_0 && + key.keyval <= GDK_KEY_KP_9) { key.keyval = '0'; key.string = "0"; } @@ -494,20 +538,22 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, } } break; + case GDK_KEY_RELEASE: command.time = event->key.time; command.action = E_TEP_NOP; break; + default: command.action = E_TEP_NOP; break; } } + if (command.action != E_TEP_NOP) { g_signal_emit_by_name (tep, "command", &command); return 1; - } - else + } else return 0; } diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c index e8594620c2..049a0142df 100644 --- a/e-util/e-text-event-processor.c +++ b/e-util/e-text-event-processor.c @@ -57,11 +57,11 @@ G_DEFINE_TYPE ( G_TYPE_OBJECT) static void -e_text_event_processor_class_init (ETextEventProcessorClass *klass) +e_text_event_processor_class_init (ETextEventProcessorClass *class) { GObjectClass *object_class; - object_class = (GObjectClass *) klass; + object_class = (GObjectClass *) class; object_class->set_property = e_text_event_processor_set_property; object_class->get_property = e_text_event_processor_get_property; @@ -83,8 +83,8 @@ e_text_event_processor_class_init (ETextEventProcessorClass *klass) FALSE, G_PARAM_READWRITE)); - klass->event = NULL; - klass->command = NULL; + class->event = NULL; + class->command = NULL; } diff --git a/e-util/e-ui-manager.c b/e-util/e-ui-manager.c index 35e14a3ae6..98fab98ce5 100644 --- a/e-util/e-ui-manager.c +++ b/e-util/e-ui-manager.c @@ -34,6 +34,10 @@ #include <string.h> +#define E_UI_MANAGER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_UI_MANAGER, EUIManagerPrivate)) + /* * --- NOTE TO SELF --- * @@ -163,8 +167,7 @@ e_ui_manager_class_init (EUIManagerClass *class) static void e_ui_manager_init (EUIManager *ui_manager) { - ui_manager->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - ui_manager, E_TYPE_UI_MANAGER, EUIManagerPrivate); + ui_manager->priv = E_UI_MANAGER_GET_PRIVATE (ui_manager); } /** diff --git a/e-util/e-util.c b/e-util/e-util.c index 80a61f73dc..839e2df496 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -662,10 +662,9 @@ e_action_group_add_actions_localized (GtkActionGroup *action_group, guint n_entries, gpointer user_data) { - gint ii; - GtkAction *action; - GList *actions, *iter; GtkActionGroup *tmp_group; + GList *list, *iter; + gint ii; g_return_if_fail (action_group != NULL); g_return_if_fail (entries != NULL); @@ -677,19 +676,22 @@ e_action_group_add_actions_localized (GtkActionGroup *action_group, gtk_action_group_set_translation_domain (tmp_group, translation_domain); gtk_action_group_add_actions (tmp_group, entries, n_entries, user_data); - actions = gtk_action_group_list_actions (tmp_group); - for (iter = actions; iter != NULL; iter = iter->next) { - action = iter->data; - - if (!action) - continue; + list = gtk_action_group_list_actions (tmp_group); + for (iter = list; iter != NULL; iter = iter->next) { + GtkAction *action = GTK_ACTION (iter->data); + const gchar *action_name; g_object_ref (action); + action_name = gtk_action_get_name (action); + for (ii = 0; ii < n_entries; ii++) { - if (g_strcmp0 (entries[ii].name, gtk_action_get_name (action)) == 0) { - gtk_action_group_remove_action (tmp_group, action); - gtk_action_group_add_action_with_accel (action_group, action, entries[ii].accelerator); + if (g_strcmp0 (entries[ii].name, action_name) == 0) { + gtk_action_group_remove_action ( + tmp_group, action); + gtk_action_group_add_action_with_accel ( + action_group, action, + entries[ii].accelerator); break; } } @@ -697,7 +699,7 @@ e_action_group_add_actions_localized (GtkActionGroup *action_group, g_object_unref (action); } - g_list_free (actions); + g_list_free (list); g_object_unref (tmp_group); } |