diff options
author | Larry Ewing <lewing@src.gnome.org> | 2004-04-28 05:42:47 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2004-04-28 05:42:47 +0800 |
commit | bca17d1fdc0625e8fd739dcba9508c27eaae2a28 (patch) | |
tree | db0af54db1defb674a88365291c281c65c1e0c98 /calendar | |
parent | 4cbd8086782526f61d335c2b5ea767b5f997566e (diff) | |
download | gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar.gz gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar.bz2 gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar.lz gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar.xz gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.tar.zst gsoc2013-evolution-bca17d1fdc0625e8fd739dcba9508c27eaae2a28.zip |
i2004-04-27 Larry Ewing <lewing@ximian.com>
* gui/dialogs/calendar-setup.c (new_calendar_test_uri): add
handler for test button.
(calendar_setup_new_calendar): connect test button, fill in color
picker member.
(source_to_dialog): set the color picker color if the source has
one.
(dialog_to_source): set the source color.
svn path=/trunk/; revision=25643
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.c | 54 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.glade | 42 |
3 files changed, 86 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 11ee22d3eb..feaf052ef1 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2004-04-27 Larry Ewing <lewing@ximian.com> + + * gui/dialogs/calendar-setup.c (new_calendar_test_uri): add + handler for test button. + (calendar_setup_new_calendar): connect test button, fill in color + picker member. + (source_to_dialog): set the color picker color if the source has + one. + (dialog_to_source): set the source color. + 2004-04-27 Jeffrey Stedfast <fejj@ximian.com> * gui/migration.c (migrate_tasks): Fixed the version checks for diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index c5da074f4b..93270fea48 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -32,6 +32,7 @@ #include <gtk/gtkoptionmenu.h> #include <libgnomeui/gnome-druid.h> #include <libgnomeui/gnome-druid-page.h> +#include <libgnomeui/gnome-color-picker.h> #include <glade/glade.h> #include <libedataserver/e-source-list.h> #include <libecal/e-cal.h> @@ -61,6 +62,7 @@ typedef struct /* General page fields */ GtkWidget *name_entry; + GtkWidget *source_color; /* Location page fields */ GtkWidget *uri_entry; @@ -371,6 +373,29 @@ general_update_dialog (SourceDialog *source_dialog) } static void +colorpicker_set_color (GnomeColorPicker *color, guint32 rgb) +{ + gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); +} + +static guint32 +colorpicker_get_color (GnomeColorPicker *color) +{ + guint8 r, g, b, a; + guint32 rgb = 0; + + gnome_color_picker_get_i8 (color, &r, &g, &b, &a); + + rgb = r; + rgb <<= 8; + rgb |= g; + rgb <<= 8; + rgb |= b; + + return rgb; +} + +static void source_to_dialog (SourceDialog *source_dialog) { ESource *source = source_dialog->source; @@ -419,6 +444,16 @@ source_to_dialog (SourceDialog *source_dialog) if (source_dialog->refresh_spin) g_signal_handlers_unblock_matched (source_dialog->refresh_spin, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, source_dialog); + if (source_dialog->source_color) { + guint32 color = 0xff00ff00; + + if (source_dialog->source) + e_source_get_color (source_dialog->source, &color); + else + /* FIXME */; + + colorpicker_set_color (GNOME_COLOR_PICKER (source_dialog->source_color), color); + } } static void @@ -452,6 +487,10 @@ dialog_to_source (SourceDialog *source_dialog) e_source_set_property (source, "refresh", refresh_str); g_free (refresh_str); } + + if (source_dialog->source_color) + e_source_set_color (source, + colorpicker_get_color (GNOME_COLOR_PICKER (source_dialog->source_color))); } static gboolean @@ -513,6 +552,13 @@ source_group_changed_sensitive (SourceDialog *source_dialog) } static void +new_calendar_test_uri (SourceDialog *source_dialog) +{ + gnome_url_show (gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)), + NULL) +} + +static void new_calendar_cancel (SourceDialog *source_dialog) { gtk_widget_destroy (source_dialog->window); @@ -584,13 +630,19 @@ calendar_setup_new_calendar (GtkWindow *parent) source_dialog->add_button = glade_xml_get_widget (source_dialog->gui_xml, "add-button"); gtk_widget_set_sensitive (source_dialog->add_button, FALSE); - g_signal_connect_swapped (source_dialog->add_button, "clicked", G_CALLBACK (new_calendar_add), source_dialog); + + source_dialog->source_color = glade_xml_get_widget (source_dialog->gui_xml, "source-color"); + g_object_weak_ref (G_OBJECT (source_dialog->window), (GWeakNotify) source_dialog_destroy, source_dialog); source_to_dialog (source_dialog); + + g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "uri-button"), "clicked", + G_CALLBACK (new_calendar_test_uri), source_dialog); + gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE); diff --git a/calendar/gui/dialogs/calendar-setup.glade b/calendar/gui/dialogs/calendar-setup.glade index 0c5b0e1b05..bd67f362eb 100644 --- a/calendar/gui/dialogs/calendar-setup.glade +++ b/calendar/gui/dialogs/calendar-setup.glade @@ -36,7 +36,7 @@ <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> - <property name="text" translatable="yes">Chillonia</property> + <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char" translatable="yes">*</property> <property name="activates_default">True</property> @@ -209,6 +209,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="mnemonic_widget">source-color</property> </widget> <packing> <property name="left_attach">0</property> @@ -221,24 +222,6 @@ </child> <child> - <widget class="GnomeColorPicker" id="group-color"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="dither">True</property> - <property name="use_alpha">False</property> - <property name="title" translatable="yes">Pick a color</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> <widget class="GtkHBox" id="uri-hbox"> <property name="visible">True</property> <property name="homogeneous">False</property> @@ -331,6 +314,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="mnemonic_widget">group-optionmenu</property> </widget> <packing> <property name="left_attach">0</property> @@ -355,6 +339,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="mnemonic_widget">name-entry</property> </widget> <packing> <property name="left_attach">0</property> @@ -365,6 +350,24 @@ <property name="y_options"></property> </packing> </child> + + <child> + <widget class="GnomeColorPicker" id="source-color"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="dither">True</property> + <property name="use_alpha">False</property> + <property name="title" translatable="yes">Pick a color</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> @@ -1290,6 +1293,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="mnemonic_widget">group-color</property> </widget> <packing> <property name="left_attach">0</property> |