[evolution/gtk-builder] Calendar custom widgets changes
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/gtk-builder] Calendar custom widgets changes
- Date: Mon, 2 Nov 2009 20:16:05 +0000 (UTC)
commit 43e3968220d869e9db1a750aed2cb41b1f2028b9
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 2 21:15:05 2009 +0100
Calendar custom widgets changes
addressbook/gui/contact-editor/e-contact-editor.c | 17 +-------
calendar/gui/dialogs/comp-editor-util.c | 21 +++++++--
calendar/gui/dialogs/comp-editor-util.h | 2 +
calendar/gui/dialogs/event-page.c | 47 ++-------------------
calendar/gui/dialogs/event-page.ui | 32 +++++---------
calendar/gui/dialogs/memo-page.c | 45 +------------------
calendar/gui/dialogs/memo-page.ui | 15 ++----
calendar/gui/dialogs/task-details-page.c | 20 +--------
calendar/gui/dialogs/task-details-page.ui | 15 ++----
calendar/gui/dialogs/task-page.c | 42 +-----------------
calendar/gui/dialogs/task-page.ui | 24 ++++-------
e-util/e-util.c | 24 +++++++++++
e-util/e-util.h | 3 +
13 files changed, 89 insertions(+), 218 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 96a8096..be86df1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -3370,21 +3370,6 @@ expand_phone_toggle (EContactEditor *ce)
}
static void
-setup_e_source_list (GtkWidget *widget)
-{
- ESourceList *source_list;
- GConfClient *gconf_client;
-
- g_return_if_fail (widget != NULL);
-
- gconf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources");
- g_object_set (G_OBJECT (widget), "source-list", source_list, NULL);
- g_object_unref (source_list);
- g_object_unref (gconf_client);
-}
-
-static void
e_contact_editor_init (EContactEditor *e_contact_editor)
{
GtkBuilder *builder;
@@ -3431,7 +3416,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
widget = e_builder_get_widget(e_contact_editor->builder, "button-categories");
g_signal_connect (widget, "clicked", G_CALLBACK (categories_clicked), e_contact_editor);
widget = e_builder_get_widget (e_contact_editor->builder, "source-combo-box-source");
- setup_e_source_list (widget);
+ e_util_set_source_combo_box_list (widget, "/apps/evolution/addressbook/sources");
g_signal_connect (widget, "changed", G_CALLBACK (source_changed), e_contact_editor);
label = e_builder_get_widget (e_contact_editor->builder, "where-label");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 07b7769..271ac5a 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -36,6 +36,7 @@
#include "widgets/misc/e-dateedit.h"
#include "../calendar-config.h"
#include "../itip-utils.h"
+#include <shell/e-shell.h>
#include "comp-editor-util.h"
@@ -239,15 +240,27 @@ comp_editor_new_date_edit (EShellSettings *shell_settings,
e_date_edit_set_make_time_insensitive (dedit, FALSE);
#endif
+ comp_editor_bind_date_edit_settings (GTK_WIDGET (dedit), shell_settings);
+
+ return GTK_WIDGET (dedit);
+}
+
+void
+comp_editor_bind_date_edit_settings (GtkWidget *dateedit, EShellSettings *shell_settings)
+{
+ g_return_if_fail (dateedit != NULL);
+ g_return_if_fail (E_IS_DATE_EDIT (dateedit));
+
+ if (!shell_settings)
+ shell_settings = e_shell_get_shell_settings (e_shell_get_default ());
+
e_binding_new (
shell_settings, "cal-show-week-numbers",
- dedit, "show-week-numbers");
+ dateedit, "show-week-numbers");
e_binding_new (
shell_settings, "cal-week-start-day",
- dedit, "week-start-day");
-
- return GTK_WIDGET (dedit);
+ dateedit, "week-start-day");
}
/* Returns the current time, for EDateEdit widgets and ECalendar items in the
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index ec481fa..78a8bab 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -40,6 +40,8 @@ GtkWidget * comp_editor_new_date_edit (EShellSettings *shell_settings,
gboolean show_time,
gboolean make_time_insensitive);
+void comp_editor_bind_date_edit_settings (GtkWidget *dateedit, EShellSettings *shell_settings);
+
struct tm comp_editor_get_current_time (GtkObject *object, gpointer data);
gchar *comp_editor_strip_categories (const gchar *categories);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 29f76f1..9add825 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2194,6 +2194,7 @@ get_widgets (EventPage *epage)
/* Glade's visibility flag doesn't seem to work for custom widgets */
priv->start_time = GW ("start-time");
+ comp_editor_bind_date_edit_settings (priv->start_time, NULL);
gtk_widget_show (priv->start_time);
priv->time_hour = GW ("time-hour");
@@ -2202,6 +2203,7 @@ get_widgets (EventPage *epage)
priv->end_time_combo = GW ("end-time-combobox");
priv->end_time = GW ("end-time");
+ comp_editor_bind_date_edit_settings (priv->end_time, NULL);
gtk_widget_show_all (priv->time_hour);
gtk_widget_hide (priv->end_time);
@@ -2211,6 +2213,8 @@ get_widgets (EventPage *epage)
#undef GW
+ e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/calendar/sources");
+
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
g_object_unref (completion);
@@ -3124,49 +3128,6 @@ event_page_new (EMeetingStore *model, CompEditor *editor)
return epage;
}
-GtkWidget *make_date_edit (void);
-
-GtkWidget *
-make_date_edit (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE);
-}
-
-GtkWidget *event_page_create_source_combo_box (void);
-
-GtkWidget *
-event_page_create_source_combo_box (void)
-{
- GtkWidget *combo_box;
- GConfClient *gconf_client;
- ESourceList *source_list;
-
- gconf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (
- gconf_client, "/apps/evolution/calendar/sources");
-
- combo_box = e_source_combo_box_new (source_list);
- g_object_unref (source_list);
- g_object_unref (gconf_client);
-
- gtk_widget_show (combo_box);
- return combo_box;
-}
-
-GtkWidget *make_status_icons (void);
-
-GtkWidget *
-make_status_icons (void)
-{
- return gtk_hbox_new (FALSE, 2);
-}
-
static void
set_attendees (ECalComponent *comp, const GPtrArray *attendees)
{
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index 4ef469a..656959b 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -405,12 +405,11 @@
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <object class="Custom" id="start-time">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="start-time">
<property name="visible">True</property>
- <property name="creation_function">make_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Sun, 09 Oct 2005 05:53:12 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">True</property>
+ <property name="allow-no-date-set">False</property>
</object>
<packing>
<property name="padding">2</property>
@@ -545,12 +544,11 @@
</packing>
</child>
<child>
- <object class="Custom" id="end-time">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="end-time">
<property name="visible">True</property>
- <property name="creation_function">make_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Sun, 09 Oct 2005 06:12:10 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">True</property>
+ <property name="allow-no-date-set">False</property>
</object>
<packing>
<property name="padding">0</property>
@@ -566,12 +564,10 @@
</packing>
</child>
<child>
- <object class="Custom" id="status-icons">
+ <object class="GtkHBox" id="status-icons">
<property name="visible">True</property>
- <property name="creation_function">make_status_icons</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 24 Nov 2005 07:10:06 GMT</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
</object>
<packing>
<property name="padding">4</property>
@@ -806,12 +802,8 @@
</packing>
</child>
<child>
- <object class="Custom" id="source">
+ <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
<property name="visible">True</property>
- <property name="creation_function">event_page_create_source_combo_box</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Wed, 17 Dec 2003 18:20:26 GMT</property>
</object>
<packing>
<property name="padding">0</property>
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 0954ee0..69c5363 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -811,9 +811,11 @@ get_widgets (MemoPage *mpage)
priv->categories = GW ("categories");
priv->source_selector = GW ("source");
-
#undef GW
+ e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/memos/sources");
+ comp_editor_bind_date_edit_settings (priv->start_date, NULL);
+
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
g_object_unref (completion);
@@ -1209,44 +1211,3 @@ memo_page_new (CompEditor *editor)
return mpage;
}
-
-GtkWidget *memo_page_create_date_edit (void);
-
-GtkWidget *
-memo_page_create_date_edit (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GtkWidget *widget;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- widget = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE);
- e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE);
- gtk_widget_show (widget);
-
- return widget;
-}
-
-GtkWidget *memo_page_create_source_combo_box (void);
-
-GtkWidget *
-memo_page_create_source_combo_box (void)
-{
- GtkWidget *widget;
- GConfClient *client;
- ESourceList *source_list;
-
- client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (
- client, "/apps/evolution/memos/sources");
-
- widget = e_source_combo_box_new (source_list);
- gtk_widget_show (widget);
-
- g_object_unref (source_list);
- g_object_unref (client);
-
- return widget;
-}
diff --git a/calendar/gui/dialogs/memo-page.ui b/calendar/gui/dialogs/memo-page.ui
index c059e3b..b92fce1 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -192,12 +192,8 @@
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <object class="Custom" id="source">
+ <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
<property name="visible">True</property>
- <property name="creation_function">memo_page_create_source_combo_box</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 13 Jan 2004 22:00:00 GMT</property>
</object>
<packing>
<property name="padding">0</property>
@@ -346,12 +342,11 @@
</packing>
</child>
<child>
- <object class="Custom" id="start-date">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="start-date">
<property name="visible">True</property>
- <property name="creation_function">memo_page_create_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Mon, 17 Jul 2006 21:24:48 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">False</property>
+ <property name="allow-no-date-set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index 09cef42..96c2bad 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -474,6 +474,7 @@ get_widgets (TaskDetailsPage *tdpage)
priv->date_completed_label = GW ("date_completed_label");
priv->completed_date = GW ("completed-date");
+ comp_editor_bind_date_edit_settings (priv->completed_date, NULL);
gtk_widget_show (priv->completed_date);
priv->url_label = GW ("url_label");
@@ -762,22 +763,3 @@ task_details_page_new (CompEditor *editor)
return tdpage;
}
-
-GtkWidget *task_details_page_create_date_edit (void);
-
-GtkWidget *
-task_details_page_create_date_edit (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GtkWidget *dedit;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE);
- e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
-
- return dedit;
-}
-
diff --git a/calendar/gui/dialogs/task-details-page.ui b/calendar/gui/dialogs/task-details-page.ui
index 884afb9..cd82f1d 100644
--- a/calendar/gui/dialogs/task-details-page.ui
+++ b/calendar/gui/dialogs/task-details-page.ui
@@ -259,12 +259,11 @@
</packing>
</child>
<child>
- <object class="Custom" id="completed-date">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="completed-date">
<property name="visible">True</property>
- <property name="creation_function">task_details_page_create_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">True</property>
+ <property name="allow-no-date-set">True</property>
<accessibility>
<relation target="date_completed_label" type="labelled-by"/>
</accessibility>
@@ -426,12 +425,8 @@
</packing>
</child>
<child>
- <object class="Custom" id="url_entry">
+ <object class="EUrlEntry" type-func="e_url_entry_get_type" id="url_entry">
<property name="visible">True</property>
- <property name="creation_function">e_url_entry_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 08 Feb 2002 21:02:37 GMT</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 2b3de6a..cb74234 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -1335,8 +1335,10 @@ get_widgets (TaskPage *tpage)
/* Glade's visibility flag doesn't seem to work for custom widgets */
priv->due_date = e_builder_get_widget (priv->builder, "due-date");
+ comp_editor_bind_date_edit_settings (priv->due_date, NULL);
gtk_widget_show (priv->due_date);
priv->start_date = e_builder_get_widget (priv->builder, "start-date");
+ comp_editor_bind_date_edit_settings (priv->start_date, NULL);
gtk_widget_show (priv->start_date);
priv->timezone = e_builder_get_widget (priv->builder, "timezone");
@@ -1372,6 +1374,7 @@ get_widgets (TaskPage *tpage)
gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0);
priv->source_selector = e_builder_get_widget (priv->builder, "source");
+ e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/tasks/sources");
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_selector);
@@ -2060,45 +2063,6 @@ task_page_get_cancel_comp (TaskPage *page)
return e_cal_component_clone (priv->comp);
}
-GtkWidget *task_page_create_date_edit (void);
-
-GtkWidget *
-task_page_create_date_edit (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GtkWidget *dedit;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE);
- e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
-
- return dedit;
-}
-
-GtkWidget *task_page_create_source_combo_box (void);
-
-GtkWidget *
-task_page_create_source_combo_box (void)
-{
- GtkWidget *combo_box;
- GConfClient *gconf_client;
- ESourceList *source_list;
-
- gconf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (
- gconf_client, "/apps/evolution/tasks/sources");
-
- combo_box = e_source_combo_box_new (source_list);
- g_object_unref (source_list);
- g_object_unref (gconf_client);
-
- gtk_widget_show (combo_box);
- return combo_box;
-}
-
/**
* task_page_add_attendee
* Add attendee to meeting store and name selector.
diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui
index 03ab395..24015f9 100644
--- a/calendar/gui/dialogs/task-page.ui
+++ b/calendar/gui/dialogs/task-page.ui
@@ -296,12 +296,11 @@
</packing>
</child>
<child>
- <object class="Custom" id="start-date">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="start-date">
<property name="visible">True</property>
- <property name="creation_function">task_page_create_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Mon, 14 Jun 2004 18:16:13 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">True</property>
+ <property name="allow-no-date-set">True</property>
<accessibility>
<relation target="start-date-label" type="labelled-by"/>
</accessibility>
@@ -317,12 +316,11 @@
</packing>
</child>
<child>
- <object class="Custom" id="due-date">
+ <object class="EDateEdit" type-func="e_date_edit_get_type" id="due-date">
<property name="visible">True</property>
- <property name="creation_function">task_page_create_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Mon, 14 Jun 2004 18:16:07 GMT</property>
+ <property name="show-date">True</property>
+ <property name="show-time">True</property>
+ <property name="allow-no-date-set">True</property>
<accessibility>
<relation target="due-date-label" type="labelled-by"/>
</accessibility>
@@ -619,13 +617,9 @@
</packing>
</child>
<child>
- <object class="Custom" id="source">
+ <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
<property name="height_request">24</property>
<property name="visible">True</property>
- <property name="creation_function">task_page_create_source_combo_box</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 18 Dec 2003 01:58:48 GMT</property>
</object>
<packing>
<property name="padding">0</property>
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 5164791..a87ec61 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -47,6 +47,7 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-categories.h>
+#include <libedataserver/e-source-list.h>
#include "filter/e-filter-option.h"
@@ -1692,6 +1693,29 @@ e_util_get_category_filter_options (void)
return g_slist_reverse (res);
}
+/**
+ * e_util_set_source_combo_box_list:
+ * @source_combo_box: an #ESourceComboBox
+ * @source_gconf_path: GConf path with sources to use in an #ESourceList
+ *
+ * Sets an #ESourceList of a given GConf path to an #ESourceComboBox.
+ **/
+void
+e_util_set_source_combo_box_list (GtkWidget *source_combo_box, const gchar *source_gconf_path)
+{
+ ESourceList *source_list;
+ GConfClient *gconf_client;
+
+ g_return_if_fail (source_combo_box != NULL);
+ g_return_if_fail (source_gconf_path != NULL);
+
+ gconf_client = gconf_client_get_default ();
+ source_list = e_source_list_new_for_gconf (gconf_client, source_gconf_path);
+ g_object_set (G_OBJECT (source_combo_box), "source-list", source_list, NULL);
+ g_object_unref (source_list);
+ g_object_unref (gconf_client);
+}
+
static gpointer
e_camel_object_copy (gpointer camel_object)
{
diff --git a/e-util/e-util.h b/e-util/e-util.h
index f9a5168..c18c438 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -159,6 +159,9 @@ gboolean e_util_read_file (const gchar *filename,
GSList * e_util_get_category_filter_options
(void);
+void e_util_set_source_combo_box_list(GtkWidget *source_combo_box,
+ const gchar *source_gconf_path);
+
/* Camel uses its own object system, so we have to box
* CamelObjects to safely use them as GObject properties. */
#define E_TYPE_CAMEL_OBJECT (e_camel_object_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]