diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:37:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:40:49 +0800 |
commit | cfb9c32b6657165e4d5e11aa7b47804f679a61f8 (patch) | |
tree | 1f9c8954df7a357b5dc20a13ac82bf31c1112083 /e-util/e-util.c | |
parent | fefeb30f58447f2fa7bcbee16dbe68a9333ce89d (diff) | |
parent | 0f7f4cfe38b3c4cd83efbe9922ae15c5aee00317 (diff) | |
download | gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.gz gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.bz2 gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.lz gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.xz gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.zst gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.zip |
Merge commit 'origin/kill-bonobo'
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r-- | e-util/e-util.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c index ebd4251b00..57ec251c55 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -372,6 +372,41 @@ e_action_group_remove_all_actions (GtkActionGroup *action_group) } /** + * e_radio_action_get_current_action: + * @radio_action: a #GtkRadioAction + * + * Returns the currently active member of the group to which @radio_action + * belongs. + * + * Returns: the currently active group member + **/ +GtkRadioAction * +e_radio_action_get_current_action (GtkRadioAction *radio_action) +{ + GSList *group; + gint current_value; + + g_return_val_if_fail (GTK_IS_RADIO_ACTION (radio_action), NULL); + + group = gtk_radio_action_get_group (radio_action); + current_value = gtk_radio_action_get_current_value (radio_action); + + while (group != NULL) { + gint value; + + radio_action = GTK_RADIO_ACTION (group->data); + g_object_get (radio_action, "value", &value, NULL); + + if (value == current_value) + return radio_action; + + group = g_slist_next (group); + } + + return NULL; +} + +/** * e_str_without_underscores: * @s: the string to strip underscores from. * @@ -521,6 +556,30 @@ e_write_file_uri (const gchar *filename, const gchar *data) return res; } +/** + * e_color_to_value: + * color: a #GdkColor + * + * Converts a #GdkColor to a 24-bit RGB color value. + * + * Returns: a 24-bit color value + **/ +guint32 +e_color_to_value (GdkColor *color) +{ + guint16 red; + guint16 green; + guint16 blue; + + g_return_val_if_fail (color != NULL, 0); + + red = color->red >> 8; + green = color->green >> 8; + blue = color->blue >> 8; + + return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff); +} + static gint epow10 (gint number) { |