Fix code style issues

This commit is contained in:
Rui Matos 2013-02-17 00:41:08 +01:00
parent 8ed05f6315
commit 12ce8a7fd9
4 changed files with 27 additions and 30 deletions

View file

@ -96,12 +96,10 @@ sort_languages (gconstpointer a,
const gchar *la; const gchar *la;
const gchar *lb; const gchar *lb;
if (g_object_get_data (G_OBJECT (a), "locale-id") == NULL) { if (g_object_get_data (G_OBJECT (a), "locale-id") == NULL)
return 1; return 1;
} if (g_object_get_data (G_OBJECT (b), "locale-id") == NULL)
if (g_object_get_data (G_OBJECT (b), "locale-id") == NULL) {
return -1; return -1;
}
la = g_object_get_data (G_OBJECT (a), "locale-name"); la = g_object_get_data (G_OBJECT (a), "locale-name");
lb = g_object_get_data (G_OBJECT (b), "locale-name"); lb = g_object_get_data (G_OBJECT (b), "locale-name");
@ -145,9 +143,8 @@ language_widget_new (const gchar *locale_id,
check = gtk_image_new (); check = gtk_image_new ();
g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL); g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL);
gtk_box_pack_start (GTK_BOX (widget), check, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (widget), check, FALSE, FALSE, 0);
if (g_strcmp0 (locale_id, current_locale_id) == 0) { if (g_strcmp0 (locale_id, current_locale_id) == 0)
gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU); gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
}
g_object_set_data (G_OBJECT (widget), "check", check); g_object_set_data (G_OBJECT (widget), "check", check);
g_object_set_data_full (G_OBJECT (widget), "locale-id", g_strdup (locale_id), g_free); g_object_set_data_full (G_OBJECT (widget), "locale-id", g_strdup (locale_id), g_free);
@ -346,15 +343,17 @@ child_activated (EggListBox *box,
if (child == NULL) if (child == NULL)
return; return;
else if (child == priv->no_results)
if (child == priv->no_results)
return; return;
else if (child == priv->more_item)
if (child == priv->more_item) {
show_more (chooser); show_more (chooser);
else { return;
}
new_locale_id = g_object_get_data (G_OBJECT (child), "locale-id"); new_locale_id = g_object_get_data (G_OBJECT (child), "locale-id");
set_locale_id (chooser, new_locale_id); set_locale_id (chooser, new_locale_id);
} }
}
typedef struct { typedef struct {
gint count; gint count;

View file

@ -106,9 +106,8 @@ update_format_examples (GtkDialog *chooser)
setlocale (LC_MONETARY, priv->region); setlocale (LC_MONETARY, priv->region);
num_info = localeconv (); num_info = localeconv ();
if (num_info != NULL) { if (num_info != NULL)
gtk_label_set_text (GTK_LABEL (priv->currency), num_info->currency_symbol); gtk_label_set_text (GTK_LABEL (priv->currency), num_info->currency_symbol);
}
setlocale (LC_MONETARY, locale); setlocale (LC_MONETARY, locale);
g_free (locale); g_free (locale);
@ -191,12 +190,10 @@ sort_regions (gconstpointer a,
const gchar *la; const gchar *la;
const gchar *lb; const gchar *lb;
if (g_object_get_data (G_OBJECT (a), "locale-id") == NULL) { if (g_object_get_data (G_OBJECT (a), "locale-id") == NULL)
return 1; return 1;
} if (g_object_get_data (G_OBJECT (b), "locale-id") == NULL)
if (g_object_get_data (G_OBJECT (b), "locale-id") == NULL) {
return -1; return -1;
}
la = g_object_get_data (G_OBJECT (a), "locale-name"); la = g_object_get_data (G_OBJECT (a), "locale-name");
lb = g_object_get_data (G_OBJECT (b), "locale-name"); lb = g_object_get_data (G_OBJECT (b), "locale-name");
@ -437,15 +434,17 @@ child_activated (EggListBox *box,
if (child == NULL) if (child == NULL)
return; return;
else if (child == priv->no_results)
if (child == priv->no_results)
return; return;
else if (child == priv->more_item)
if (child == priv->more_item) {
show_more (chooser); show_more (chooser);
else { return;
}
new_locale_id = g_object_get_data (G_OBJECT (child), "locale-id"); new_locale_id = g_object_get_data (G_OBJECT (child), "locale-id");
set_locale_id (chooser, new_locale_id); set_locale_id (chooser, new_locale_id);
} }
}
typedef struct { typedef struct {
gint count; gint count;

View file

@ -33,7 +33,7 @@
#ifdef HAVE_IBUS #ifdef HAVE_IBUS
#include <ibus.h> #include <ibus.h>
#include "cc-ibus-utils.h" #include "cc-ibus-utils.h"
#endif #endif /* HAVE_IBUS */
#define INPUT_SOURCE_TYPE_XKB "xkb" #define INPUT_SOURCE_TYPE_XKB "xkb"
#define INPUT_SOURCE_TYPE_IBUS "ibus" #define INPUT_SOURCE_TYPE_IBUS "ibus"
@ -241,7 +241,7 @@ input_source_widget_new (GtkWidget *chooser,
cc_util_normalize_casefold_and_unaccent (display_name), g_free); cc_util_normalize_casefold_and_unaccent (display_name), g_free);
#else #else
widget = NULL; widget = NULL;
#endif #endif /* HAVE_IBUS */
} }
if (widget) if (widget)
@ -573,7 +573,7 @@ strvs_differ (gchar **av,
if (!g_str_equal (*a, *b)) if (!g_str_equal (*a, *b))
return TRUE; return TRUE;
if (!*a && !*b) if (*a == NULL && *b == NULL)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -883,7 +883,7 @@ get_ibus_locale_infos (GtkWidget *chooser)
g_free (lang_code); g_free (lang_code);
} }
} }
#endif #endif /* HAVE_IBUS */
static void static void
add_locale_to_table (GHashTable *table, add_locale_to_table (GHashTable *table,
@ -1080,7 +1080,7 @@ cc_input_chooser_new (GtkWindow *main_window,
get_locale_infos (chooser); get_locale_infos (chooser);
#ifdef HAVE_IBUS #ifdef HAVE_IBUS
get_ibus_locale_infos (chooser); get_ibus_locale_infos (chooser);
#endif #endif /* HAVE_IBUS */
show_locale_widgets (chooser); show_locale_widgets (chooser);
/* Try to come up with a sensible width */ /* Try to come up with a sensible width */
@ -1107,7 +1107,7 @@ cc_input_chooser_set_ibus_engines (GtkWidget *chooser,
priv->ibus_engines = ibus_engines; priv->ibus_engines = ibus_engines;
get_ibus_locale_infos (chooser); get_ibus_locale_infos (chooser);
show_locale_widgets (chooser); show_locale_widgets (chooser);
#endif #endif /* HAVE_IBUS */
} }
gboolean gboolean

View file

@ -121,9 +121,8 @@ update_shortcuts (GtkWidget *options)
next = g_settings_get_strv (settings, "switch-input-source"); next = g_settings_get_strv (settings, "switch-input-source");
previous_shortcut = g_strdup (previous[0]); previous_shortcut = g_strdup (previous[0]);
if (!previous_shortcut && next[0]) { if (!previous_shortcut && next[0])
previous_shortcut = g_strconcat ("<Shift>", next[0], NULL); previous_shortcut = g_strconcat ("<Shift>", next[0], NULL);
}
update_shortcut_label (priv->previous_source, previous_shortcut); update_shortcut_label (priv->previous_source, previous_shortcut);
update_shortcut_label (priv->next_source, next[0]); update_shortcut_label (priv->next_source, next[0]);