From 26afa6081c3d9826dbae78236dd712fad8b7c340 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Nov 2010 14:44:23 -0400 Subject: Utilize the new ESourceSelector:primary-selection property. --- e-util/e-util.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 4 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index f27b3f3660..abc6ccc377 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1507,7 +1507,7 @@ e_util_set_source_combo_box_list (GtkWidget *source_combo_box, * @binding: a #GBinding * @source_value: a #GValue of type #GDK_TYPE_COLOR * @target_value: a #GValue of type #G_TYPE_STRING - * @user_data: not used + * @not_used: not used * * Transforms a #GdkColor value to a color string specification. * @@ -1517,7 +1517,7 @@ gboolean e_binding_transform_color_to_string (GBinding *binding, const GValue *source_value, GValue *target_value, - gpointer user_data) + gpointer not_used) { const GdkColor *color; gchar *string; @@ -1537,7 +1537,7 @@ e_binding_transform_color_to_string (GBinding *binding, * @binding: a #GBinding * @source_value: a #GValue of type #G_TYPE_STRING * @target_value: a #GValue of type #GDK_TYPE_COLOR - * @user_data: not used + * @not_used: not used * * Transforms a color string specification to a #GdkColor. * @@ -1547,7 +1547,7 @@ gboolean e_binding_transform_string_to_color (GBinding *binding, const GValue *source_value, GValue *target_value, - gpointer user_data) + gpointer not_used) { GdkColor color; const gchar *string; @@ -1563,3 +1563,76 @@ e_binding_transform_string_to_color (GBinding *binding, return success; } + +/** + * e_binding_transform_source_to_uid: + * @binding: a #GBinding + * @source_value: a #GValue of type #E_TYPE_SOURCE + * @target_value: a #GValue of type #G_TYPE_STRING + * @source_list: an #ESourceList + * + * Transforms an #ESource object to its UID string. + * + * Returns: %TRUE if @source_value was an #ESource object + **/ +gboolean +e_binding_transform_source_to_uid (GBinding *binding, + const GValue *source_value, + GValue *target_value, + ESourceList *source_list) +{ + ESource *source; + const gchar *string; + gboolean success = FALSE; + + g_return_val_if_fail (G_IS_BINDING (binding), FALSE); + g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE); + + source = g_value_get_object (source_value); + if (E_IS_SOURCE (source)) { + string = e_source_peek_uid (source); + g_value_set_string (target_value, string); + success = TRUE; + } + + return success; +} + +/** + * e_binding_transform_uid_to_source: + * @binding: a #GBinding + * @source_value: a #GValue of type #G_TYPE_STRING + * @target_value: a #GValue of type #E_TYPE_SOURCe + * @source_list: an #ESourceList + * + * Transforms an #ESource UID string to the corresponding #ESource object + * in @source_list. + * + * Returns: %TRUE if @source_list had an #ESource object with a matching + * UID string + **/ +gboolean +e_binding_transform_uid_to_source (GBinding *binding, + const GValue *source_value, + GValue *target_value, + ESourceList *source_list) +{ + ESource *source; + const gchar *string; + gboolean success = FALSE; + + g_return_val_if_fail (G_IS_BINDING (binding), FALSE); + g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE); + + string = g_value_get_string (source_value); + if (string == NULL || *string == '\0') + return FALSE; + + source = e_source_list_peek_source_by_uid (source_list, string); + if (source != NULL) { + g_value_set_object (target_value, source); + success = TRUE; + } + + return success; +} -- cgit v1.2.3 From e3a09eb67c1f9b2a3762626eafbd9dec94bc63bf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Nov 2010 17:17:42 -0400 Subject: Add GBinding transform funcs for enum types. We'll want to store enum settings by their nicknames. --- e-util/e-util.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index abc6ccc377..4c2764de4b 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1564,6 +1564,80 @@ e_binding_transform_string_to_color (GBinding *binding, return success; } +/** + * e_binding_transform_enum_value_to_nick: + * @binding: a #GBinding + * @source_value: a #GValue whose type is derived from #G_TYPE_ENUM + * @target_value: a #GValue of type #G_TYPE_STRING + * @not_used: not used + * + * Transforms an enumeration value to its corresponding nickname. + * + * Returns: %TRUE if the enum value has a corresponding nickname + **/ +gboolean +e_binding_transform_enum_value_to_nick (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer not_used) +{ + GEnumClass *enum_class; + GEnumValue *enum_value; + gint value; + gboolean success = FALSE; + + g_return_val_if_fail (G_IS_BINDING (binding), FALSE); + + enum_class = g_type_class_peek (G_VALUE_TYPE (source_value)); + g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE); + + value = g_value_get_enum (source_value); + enum_value = g_enum_get_value (enum_class, value); + if (enum_value != NULL) { + g_value_set_string (target_value, enum_value->value_nick); + success = TRUE; + } + + return success; +} + +/** + * e_binding_transform_enum_nick_to_value: + * @binding: a #GBinding + * @source_value: a #GValue of type #G_TYPE_STRING + * @target_value: a #GValue whose type is derived from #G_TYPE_ENUM + * @not_used: not_used + * + * Transforms an enumeration nickname to its corresponding value. + * + * Returns: %TRUE if the enum nickname has a corresponding value + **/ +gboolean +e_binding_transform_enum_nick_to_value (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer not_used) +{ + GEnumClass *enum_class; + GEnumValue *enum_value; + const gchar *string; + gboolean success = FALSE; + + g_return_val_if_fail (G_IS_BINDING (binding), FALSE); + + enum_class = g_type_class_peek (G_VALUE_TYPE (target_value)); + g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE); + + string = g_value_get_string (source_value); + enum_value = g_enum_get_value_by_nick (enum_class, string); + if (enum_value != NULL) { + g_value_set_enum (target_value, enum_value->value); + success = TRUE; + } + + return success; +} + /** * e_binding_transform_source_to_uid: * @binding: a #GBinding -- cgit v1.2.3 From a3ba231fcc2746e664a67c85d88eb49a64813989 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 9 Nov 2010 08:48:33 -0500 Subject: Drop backward-compatibility cruft. --- e-util/e-util.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 4c2764de4b..88fcfaebfb 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -57,14 +57,6 @@ #include "e-util.h" #include "e-util-private.h" -#include "gtk-compat.h" - -#if !GTK_CHECK_VERSION (2,23,0) - #undef GtkComboBoxText - ENSURE_GTK_COMBO_BOX_TEXT_TYPE -#else - ENSURE_GTK_COMBO_BOX_ENTRY_TYPE -#endif /** * e_get_gnome2_user_dir: -- cgit v1.2.3 From 333ccc8abf033453996e4a7e16712f2fc3b9e05a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Feb 2011 15:13:06 +0100 Subject: Bug #639483 - Category list includes weather information --- e-util/e-util.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 88fcfaebfb..8f91558823 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1457,7 +1457,12 @@ e_util_get_category_filter_options (void) clist = e_categories_get_list (); for (l = clist; l; l = l->next) { const gchar *cname = l->data; - struct _filter_option *fo = g_new0 (struct _filter_option, 1); + struct _filter_option *fo; + + if (!e_categories_is_searchable (cname)) + continue; + + fo = g_new0 (struct _filter_option, 1); fo->title = g_strdup (cname); fo->value = g_strdup (cname); @@ -1469,6 +1474,33 @@ e_util_get_category_filter_options (void) return g_slist_reverse (res); } +/** + * e_util_get_searchable_categories: + * + * Returns list of searchable categories only. The list should + * be freed with g_list_free() when done with it, but the items + * are internal strings, names of categories, which should not + * be touched in other than read-only way, in other words the same + * restrictions as for e_categories_get_list() applies here too. + **/ +GList * +e_util_get_searchable_categories (void) +{ + GList *res = NULL, *all_categories, *l; + + all_categories = e_categories_get_list (); + for (l = all_categories; l; l = l->next) { + const gchar *cname = l->data; + + if (e_categories_is_searchable (cname)) + res = g_list_prepend (res, (gpointer) cname); + } + + g_list_free (all_categories); + + return g_list_reverse (res); +} + /** * e_util_set_source_combo_box_list: * @source_combo_box: an #ESourceComboBox -- cgit v1.2.3 From 7aacf983b32ecac26bc9707697da622b3ef164a3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- e-util/e-util.c | 63 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 21 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 8f91558823..5fdfed901b 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -712,9 +712,11 @@ e_format_number (gint number) case 0: divider = epow10 (last_count); if (number >= divider) { - group = g_strdup_printf("%0*d", last_count, number % divider); + group = g_strdup_printf ( + "%0*d", last_count, number % divider); } else { - group = g_strdup_printf("%d", number % divider); + group = g_strdup_printf ( + "%d", number % divider); } number /= divider; break; @@ -1132,9 +1134,11 @@ e_flexible_strtod (const gchar *nptr, gchar **endptr) if (fail_pos) { if (fail_pos > decimal_point_pos) - fail_pos = (gchar *)nptr + (fail_pos - copy) - (decimal_point_len - 1); + fail_pos = + (gchar *) nptr + (fail_pos - copy) - + (decimal_point_len - 1); else - fail_pos = (gchar *)nptr + (fail_pos - copy); + fail_pos = (gchar *) nptr + (fail_pos - copy); } g_free (copy); @@ -1296,41 +1300,58 @@ get_font_options (void) /* Antialiasing */ if (fo_antialiasing == NULL) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_DEFAULT); + cairo_font_options_set_antialias ( + font_options, CAIRO_ANTIALIAS_DEFAULT); else if (strcmp (fo_antialiasing, "grayscale") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); + cairo_font_options_set_antialias ( + font_options, CAIRO_ANTIALIAS_GRAY); else if (strcmp (fo_antialiasing, "rgba") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL); + cairo_font_options_set_antialias ( + font_options, CAIRO_ANTIALIAS_SUBPIXEL); else if (strcmp (fo_antialiasing, "none") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_NONE); + cairo_font_options_set_antialias ( + font_options, CAIRO_ANTIALIAS_NONE); else - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_DEFAULT); + cairo_font_options_set_antialias ( + font_options, CAIRO_ANTIALIAS_DEFAULT); if (fo_hinting == NULL) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_DEFAULT); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_DEFAULT); else if (strcmp (fo_hinting, "full") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_FULL); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_FULL); else if (strcmp (fo_hinting, "medium") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_MEDIUM); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_MEDIUM); else if (strcmp (fo_hinting, "slight") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_SLIGHT); else if (strcmp (fo_hinting, "none") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_NONE); else - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_DEFAULT); + cairo_font_options_set_hint_style ( + font_options, CAIRO_HINT_STYLE_DEFAULT); if (fo_subpixel_order == NULL) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); else if (strcmp (fo_subpixel_order, "rgb") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_RGB); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_RGB); else if (strcmp (fo_subpixel_order, "bgr") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_BGR); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_BGR); else if (strcmp (fo_subpixel_order, "vrgb") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_VRGB); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_VRGB); else if (strcmp (fo_subpixel_order, "vbgr") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_VBGR); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_VBGR); else - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); + cairo_font_options_set_subpixel_order ( + font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); g_static_mutex_unlock (&fo_lock); -- cgit v1.2.3 From 566bb2aedfe66a2f9204dbdc1083361692f4a097 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 25 Mar 2011 11:41:55 -0400 Subject: Change the accelerator map file location. From: $HOME/.gnome2/accels/evolution To: $XDG_CONFIG_HOME/evolution/accels Custom keyboard accelerator maps is a well-hidden feature these days, especially in GNOME 3. Not worth migrating the old file. --- e-util/e-util.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 5fdfed901b..7c203ec7b3 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -97,15 +97,10 @@ e_get_accels_filename (void) { static gchar *filename = NULL; - /* XXX The directory corresponds to gnome_user_accels_dir_get() - * from libgnome. Continue using this location until GNOME - * decides on an XDG-compliant location. Perhaps something - * like $(XDG_CONFIG_DIR)/accels. */ - - if (G_UNLIKELY (filename == NULL)) - filename = g_build_filename ( - e_get_gnome2_user_dir (), - "accels", PACKAGE, NULL); + if (G_UNLIKELY (filename == NULL)) { + const gchar *config_dir = e_get_user_config_dir (); + filename = g_build_filename (config_dir, "accels", NULL); + } return filename; } -- cgit v1.2.3 From f96a45d4bfe30e7b40c6ff75a7879e32dbe52e5f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 16 May 2011 10:03:20 -0400 Subject: Remove unused e_get_gnome2_user_dir(). --- e-util/e-util.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 7c203ec7b3..427f479e01 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -58,32 +58,6 @@ #include "e-util.h" #include "e-util-private.h" -/** - * e_get_gnome2_user_dir: - * - * Returns the base directory for user data, according to libgnome. - * The directory can be overridden by setting the GNOME22_USER_DIR - * environment variable. The string is owned by Evolution and must - * not be modified or freed. - * - * Returns: base directory for GNOME user data - **/ -const gchar * -e_get_gnome2_user_dir (void) -{ - static gchar *dirname = NULL; - -#ifndef G_OS_WIN32 - if (G_UNLIKELY (dirname == NULL)) - dirname = g_strdup (g_getenv ("GNOME22_USER_DIR")); -#endif - if (dirname == NULL) - dirname = g_build_filename ( - g_get_home_dir (), ".gnome2", NULL); - - return dirname; -} - /** * e_get_accels_filename: * -- cgit v1.2.3 From 76ca1494485a0919c8ed02db636bd3f1bc647e39 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 16 May 2011 13:08:04 -0400 Subject: Bug 649990 - Remove get_font_options() from e-util.c. Not only is get_font_options() no longer needed, it's actually doing the wrong thing by reading settings through GConfClient instead of GSettings. But it turns out, thanks to the tighter Cairo integration in GTK3, the widgets that call get_font_options() can be made to work correctly by simply removing this hack. Love it when that happens. --- e-util/e-util.c | 123 -------------------------------------------------------- 1 file changed, 123 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 427f479e01..b7dd93aa15 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1204,129 +1204,6 @@ e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d) return buffer; } -/* font options cache */ -static gchar *fo_antialiasing = NULL; -static gchar *fo_hinting = NULL; -static gchar *fo_subpixel_order = NULL; -static GStaticMutex fo_lock = G_STATIC_MUTEX_INIT; - -static void -fo_option_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer user_data) -{ - const gchar *key; - - g_static_mutex_lock (&fo_lock); - - g_free (fo_antialiasing); - key = "/desktop/gnome/font_rendering/antialiasing"; - fo_antialiasing = gconf_client_get_string (client, key, NULL); - - g_free (fo_hinting); - key = "/desktop/gnome/font_rendering/hinting"; - fo_hinting = gconf_client_get_string (client, key, NULL); - - g_free (fo_subpixel_order); - key = "/desktop/gnome/font_rendering/rgba_order"; - fo_subpixel_order = gconf_client_get_string (client, key, NULL); - - g_static_mutex_unlock (&fo_lock); -} - -cairo_font_options_t * -get_font_options (void) -{ - static GConfClient *fo_gconf = NULL; - cairo_font_options_t *font_options = cairo_font_options_create (); - - if (fo_gconf == NULL) { - const gchar *key; - - fo_gconf = gconf_client_get_default (); - - key = "/desktop/gnome/font_rendering"; - gconf_client_add_dir ( - fo_gconf, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - - key = "/desktop/gnome/font_rendering/antialiasing"; - gconf_client_notify_add ( - fo_gconf, key, fo_option_changed, NULL, NULL, NULL); - - key = "/desktop/gnome/font_rendering/hinting"; - gconf_client_notify_add ( - fo_gconf, key, fo_option_changed, NULL, NULL, NULL); - - key = "/desktop/gnome/font_rendering/rgba_order"; - gconf_client_notify_add ( - fo_gconf, key, fo_option_changed, NULL, NULL, NULL); - - fo_option_changed (fo_gconf, 0, NULL, NULL); - } - - g_static_mutex_lock (&fo_lock); - - /* Antialiasing */ - if (fo_antialiasing == NULL) - cairo_font_options_set_antialias ( - font_options, CAIRO_ANTIALIAS_DEFAULT); - else if (strcmp (fo_antialiasing, "grayscale") == 0) - cairo_font_options_set_antialias ( - font_options, CAIRO_ANTIALIAS_GRAY); - else if (strcmp (fo_antialiasing, "rgba") == 0) - cairo_font_options_set_antialias ( - font_options, CAIRO_ANTIALIAS_SUBPIXEL); - else if (strcmp (fo_antialiasing, "none") == 0) - cairo_font_options_set_antialias ( - font_options, CAIRO_ANTIALIAS_NONE); - else - cairo_font_options_set_antialias ( - font_options, CAIRO_ANTIALIAS_DEFAULT); - - if (fo_hinting == NULL) - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_DEFAULT); - else if (strcmp (fo_hinting, "full") == 0) - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_FULL); - else if (strcmp (fo_hinting, "medium") == 0) - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_MEDIUM); - else if (strcmp (fo_hinting, "slight") == 0) - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_SLIGHT); - else if (strcmp (fo_hinting, "none") == 0) - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_NONE); - else - cairo_font_options_set_hint_style ( - font_options, CAIRO_HINT_STYLE_DEFAULT); - - if (fo_subpixel_order == NULL) - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); - else if (strcmp (fo_subpixel_order, "rgb") == 0) - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_RGB); - else if (strcmp (fo_subpixel_order, "bgr") == 0) - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_BGR); - else if (strcmp (fo_subpixel_order, "vrgb") == 0) - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_VRGB); - else if (strcmp (fo_subpixel_order, "vbgr") == 0) - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_VBGR); - else - cairo_font_options_set_subpixel_order ( - font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); - - g_static_mutex_unlock (&fo_lock); - - return font_options; -} - /* Evolution Locks for crash recovery */ static const gchar * -- cgit v1.2.3 From c24038c4f62f37b89d1bda9542ca5ccc843d4ea0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- e-util/e-util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index b7dd93aa15..4b47f64918 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -25,7 +25,9 @@ * @include: e-util/e-util.h **/ +#ifdef HAVE_CONFIG_H #include +#endif #include #include -- cgit v1.2.3 From 777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- e-util/e-util.c | 63 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 25 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 4b47f64918..8ededeeb9d 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -566,7 +566,8 @@ e_str_without_underscores (const gchar *string) } gint -e_str_compare (gconstpointer x, gconstpointer y) +e_str_compare (gconstpointer x, + gconstpointer y) { if (x == NULL || y == NULL) { if (x == y) @@ -579,7 +580,8 @@ e_str_compare (gconstpointer x, gconstpointer y) } gint -e_str_case_compare (gconstpointer x, gconstpointer y) +e_str_case_compare (gconstpointer x, + gconstpointer y) { gchar *cx, *cy; gint res; @@ -603,7 +605,8 @@ e_str_case_compare (gconstpointer x, gconstpointer y) } gint -e_collate_compare (gconstpointer x, gconstpointer y) +e_collate_compare (gconstpointer x, + gconstpointer y) { if (x == NULL || y == NULL) { if (x == y) @@ -616,7 +619,8 @@ e_collate_compare (gconstpointer x, gconstpointer y) } gint -e_int_compare (gconstpointer x, gconstpointer y) +e_int_compare (gconstpointer x, + gconstpointer y) { gint nx = GPOINTER_TO_INT (x); gint ny = GPOINTER_TO_INT (y); @@ -727,13 +731,13 @@ e_format_number (gint number) } /* Perform a binary search for key in base which has nmemb elements - of size bytes each. The comparisons are done by (*compare)(). */ + * of size bytes each. The comparisons are done by (*compare)(). */ void e_bsearch (gconstpointer key, gconstpointer base, gsize nmemb, gsize size, - ESortCompareFunc compare, + ESortCompareFunc compare, gpointer closure, gsize *start, gsize *end) @@ -813,7 +817,9 @@ e_bsearch (gconstpointer key, */ gsize -e_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, +e_strftime_fix_am_pm (gchar *str, + gsize max, + const gchar *fmt, const struct tm *tm) { gchar buf[10]; @@ -823,7 +829,7 @@ e_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, if (strstr(fmt, "%p")==NULL && strstr(fmt, "%P")==NULL) { /* No AM/PM involved - can use the fmt string directly */ - ret=e_strftime (str, max, fmt, tm); + ret = e_strftime (str, max, fmt, tm); } else { /* Get the AM/PM symbol from the locale */ e_strftime (buf, 10, "%p", tm); @@ -831,11 +837,11 @@ e_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, if (buf[0]) { /* AM/PM have been defined in the locale * so we can use the fmt string directly. */ - ret=e_strftime (str, max, fmt, tm); + ret = e_strftime (str, max, fmt, tm); } else { /* No AM/PM defined by locale * must change to 24 hour clock. */ - ffmt=g_strdup (fmt); + ffmt = g_strdup (fmt); for (sp=ffmt; (sp=strstr(sp, "%l")); sp++) { /* Maybe this should be 'k', but I have never * seen a 24 clock actually use that format. */ @@ -844,7 +850,7 @@ e_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, for (sp=ffmt; (sp=strstr(sp, "%I")); sp++) { sp[1]='H'; } - ret=e_strftime (str, max, ffmt, tm); + ret = e_strftime (str, max, ffmt, tm); g_free (ffmt); } } @@ -853,7 +859,9 @@ e_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, } gsize -e_utf8_strftime_fix_am_pm (gchar *str, gsize max, const gchar *fmt, +e_utf8_strftime_fix_am_pm (gchar *str, + gsize max, + const gchar *fmt, const struct tm *tm) { gsize sz, ret; @@ -1004,7 +1012,8 @@ e_get_weekday_name (GDateWeekday weekday, * Returns: the gdouble value **/ gdouble -e_flexible_strtod (const gchar *nptr, gchar **endptr) +e_flexible_strtod (const gchar *nptr, + gchar **endptr) { gchar *fail_pos; gdouble val; @@ -1032,7 +1041,7 @@ e_flexible_strtod (const gchar *nptr, gchar **endptr) p = nptr; /* Skip leading space */ - while (isspace ((guchar)*p)) + while (isspace ((guchar) * p)) p++; /* Skip leading optional sign */ @@ -1044,40 +1053,40 @@ e_flexible_strtod (const gchar *nptr, gchar **endptr) p += 2; /* HEX - find the (optional) decimal point */ - while (isxdigit ((guchar)*p)) + while (isxdigit ((guchar) * p)) p++; if (*p == '.') { decimal_point_pos = p++; - while (isxdigit ((guchar)*p)) + while (isxdigit ((guchar) * p)) p++; if (*p == 'p' || *p == 'P') p++; if (*p == '+' || *p == '-') p++; - while (isdigit ((guchar)*p)) + while (isdigit ((guchar) * p)) p++; end = p; } else if (strncmp (p, decimal_point, decimal_point_len) == 0) { return strtod (nptr, endptr); } } else { - while (isdigit ((guchar)*p)) + while (isdigit ((guchar) * p)) p++; if (*p == '.') { decimal_point_pos = p++; - while (isdigit ((guchar)*p)) + while (isdigit ((guchar) * p)) p++; if (*p == 'e' || *p == 'E') p++; if (*p == '+' || *p == '-') p++; - while (isdigit ((guchar)*p)) + while (isdigit ((guchar) * p)) p++; end = p; } else if (strncmp (p, decimal_point, decimal_point_len) == 0) { @@ -1143,7 +1152,10 @@ e_flexible_strtod (const gchar *nptr, gchar **endptr) * Returns: the pointer to the buffer with the converted string **/ gchar * -e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d) +e_ascii_dtostr (gchar *buffer, + gint buf_len, + const gchar *format, + gdouble d) { struct lconv *locale_data; const gchar *decimal_point; @@ -1188,15 +1200,15 @@ e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d) if (*p == '+' || *p == '-') p++; - while (isdigit ((guchar)*p)) + while (isdigit ((guchar) * p)) p++; if (strncmp (p, decimal_point, decimal_point_len) == 0) { *p = '.'; p++; if (decimal_point_len > 1) { - rest_len = strlen (p + (decimal_point_len-1)); - memmove (p, p + (decimal_point_len-1), + rest_len = strlen (p + (decimal_point_len - 1)); + memmove (p, p + (decimal_point_len - 1), rest_len); p[rest_len] = 0; } @@ -1274,7 +1286,8 @@ e_file_lock_exists (void) * not be determined **/ gchar * -e_util_guess_mime_type (const gchar *filename, gboolean localfile) +e_util_guess_mime_type (const gchar *filename, + gboolean localfile) { gchar *mime_type = NULL; -- cgit v1.2.3 From e64d6fe05c30c2cc1d7625a202afba3ba2da07cd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 22 Nov 2011 18:22:14 -0500 Subject: Miscellaneous cleanups. --- e-util/e-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index d41f43630e..0db804a618 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1394,7 +1394,7 @@ e_binding_transform_color_to_string (GBinding *binding, g_value_set_string (target_value, ""); } else { /* encode color manually, because css styles expect colors in #rrggbb, - not in #rrrrggggbbbb, which is a result of gdk_color_to_string() + * not in #rrrrggggbbbb, which is a result of gdk_color_to_string() */ string = g_strdup_printf ("#%02x%02x%02x", (gint) color->red * 256 / 65536, -- cgit v1.2.3