diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-28 10:31:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-28 23:24:49 +0800 |
commit | 2c4510e858fcf96e8f3d02f3f92564460752e983 (patch) | |
tree | 777c673d5fdaf649fb1c9eabd9357eac622b15f6 /widgets | |
parent | 3fe8269156da1b57b0fc7391f5cf07cab6f61606 (diff) | |
parent | 067ef5580fc287809958d4503691bfcba2b29ee5 (diff) | |
download | gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.gz gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.zst gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.zip |
Merge commit 'EVOLUTION_2_27_5' into kill-bonobo
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/e-timezone-dialog/e-timezone-dialog.c | 9 | ||||
-rw-r--r-- | widgets/misc/e-account-manager.c | 11 | ||||
-rw-r--r-- | widgets/misc/e-attachment-icon-view.c | 9 | ||||
-rw-r--r-- | widgets/misc/e-attachment-icon-view.h | 3 | ||||
-rw-r--r-- | widgets/misc/e-attachment-paned.c | 10 | ||||
-rw-r--r-- | widgets/misc/e-attachment-paned.h | 2 | ||||
-rw-r--r-- | widgets/misc/e-gui-utils.c | 183 | ||||
-rw-r--r-- | widgets/misc/e-gui-utils.h | 26 | ||||
-rw-r--r-- | widgets/misc/e-image-chooser.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table.c | 2 |
10 files changed, 39 insertions, 219 deletions
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c index 4625a63e1c..8f22695916 100644 --- a/widgets/e-timezone-dialog/e-timezone-dialog.c +++ b/widgets/e-timezone-dialog/e-timezone-dialog.c @@ -30,6 +30,7 @@ #include <glade/glade.h> #include <misc/e-map.h> #include <libecal/e-cal-time-util.h> +#include <libecal/e-cal-system-timezone.h> #include "e-util/e-util-private.h" @@ -342,9 +343,15 @@ static icaltimezone* get_local_timezone(void) { icaltimezone *zone; + gchar *location; tzset(); - zone = icaltimezone_get_builtin_timezone_from_offset (-timezone, tzname[0]); + location = e_cal_system_timezone_get_location (); + + if (location) + zone = icaltimezone_get_builtin_timezone (location); + + g_free (location); return zone; } diff --git a/widgets/misc/e-account-manager.c b/widgets/misc/e-account-manager.c index 24b579dee9..8d3d2d211b 100644 --- a/widgets/misc/e-account-manager.c +++ b/widgets/misc/e-account-manager.c @@ -97,8 +97,6 @@ account_manager_selection_changed_cb (EAccountManager *manager, GtkWidget *edit_button; GtkWidget *delete_button; GtkWidget *default_button; - const gchar *url = NULL; - gboolean has_proxies; gboolean sensitive; add_button = manager->priv->add_button; @@ -110,19 +108,14 @@ account_manager_selection_changed_cb (EAccountManager *manager, account = e_account_tree_view_get_selected (tree_view); account_list = e_account_tree_view_get_account_list (tree_view); - if (account != NULL) - url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL); - else + if (account == NULL) gtk_widget_grab_focus (add_button); - has_proxies = (url != NULL) && - e_account_list_account_has_proxies (account_list, account); - /* XXX EAccountList misuses const */ default_account = (EAccount *) e_account_list_get_default (account_list); - sensitive = (account != NULL) && !has_proxies; + sensitive = (account != NULL); gtk_widget_set_sensitive (edit_button, sensitive); sensitive = (account != NULL); diff --git a/widgets/misc/e-attachment-icon-view.c b/widgets/misc/e-attachment-icon-view.c index a7d8ad271c..edfecb57d8 100644 --- a/widgets/misc/e-attachment-icon-view.c +++ b/widgets/misc/e-attachment-icon-view.c @@ -40,8 +40,15 @@ enum { PROP_EDITABLE }; +static gint icon_size = GTK_ICON_SIZE_DIALOG; static gpointer parent_class; +void +e_attachment_icon_view_set_default_icon_size (gint size) +{ + icon_size = size; +} + static void attachment_icon_view_set_property (GObject *object, guint property_id, @@ -451,7 +458,7 @@ attachment_icon_view_init (EAttachmentIconView *icon_view) GTK_ICON_VIEW (icon_view), GTK_SELECTION_MULTIPLE); renderer = gtk_cell_renderer_pixbuf_new (); - g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL); + g_object_set (renderer, "stock-size", icon_size, NULL); gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); gtk_cell_layout_add_attribute ( diff --git a/widgets/misc/e-attachment-icon-view.h b/widgets/misc/e-attachment-icon-view.h index 4aabf6c429..e89992fb76 100644 --- a/widgets/misc/e-attachment-icon-view.h +++ b/widgets/misc/e-attachment-icon-view.h @@ -60,7 +60,8 @@ struct _EAttachmentIconViewClass { GType e_attachment_icon_view_get_type (void); GtkWidget * e_attachment_icon_view_new (void); - +void e_attachment_icon_view_set_default_icon_size + (gint size); G_END_DECLS #endif /* E_ATTACHMENT_ICON_VIEW_H */ diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c index a65d1c6ea4..8e25098767 100644 --- a/widgets/misc/e-attachment-paned.c +++ b/widgets/misc/e-attachment-paned.c @@ -38,7 +38,7 @@ #define NUM_VIEWS 2 /* Initial height of the lower pane. */ -#define INITIAL_HEIGHT 150 +static gint initial_height = 150; struct _EAttachmentPanedPrivate { GtkTreeModel *model; @@ -66,6 +66,12 @@ enum { static gpointer parent_class; +void +e_attachment_paned_set_default_height (gint height) +{ + initial_height = height; +} + static void attachment_paned_notify_cb (EAttachmentPaned *paned, GParamSpec *pspec, @@ -515,7 +521,7 @@ attachment_paned_init (EAttachmentPaned *paned) container = GTK_WIDGET (paned); widget = gtk_notebook_new (); - gtk_widget_set_size_request (widget, -1, INITIAL_HEIGHT); + gtk_widget_set_size_request (widget, -1, initial_height); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE); gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); diff --git a/widgets/misc/e-attachment-paned.h b/widgets/misc/e-attachment-paned.h index 825de3a16b..a9022a7bc6 100644 --- a/widgets/misc/e-attachment-paned.h +++ b/widgets/misc/e-attachment-paned.h @@ -82,6 +82,8 @@ GtkWidget * e_attachment_paned_get_controls_container (EAttachmentPaned *paned); GtkWidget * e_attachment_paned_get_view_combo (EAttachmentPaned *paned); +void e_attachment_paned_set_default_height + (gint height); G_END_DECLS diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c index d33e3c1139..0974081f78 100644 --- a/widgets/misc/e-gui-utils.c +++ b/widgets/misc/e-gui-utils.c @@ -29,19 +29,13 @@ #include "e-gui-utils.h" void -e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu) -{ - g_return_if_fail (GTK_IS_MENU (menu)); - - g_signal_connect (menu, "selection_done", G_CALLBACK (gtk_widget_destroy), menu); -} - -void e_popup_menu (GtkMenu *menu, GdkEvent *event) { g_return_if_fail (GTK_IS_MENU (menu)); - e_auto_kill_popup_menu_on_selection_done (menu); + g_signal_connect ( + menu, "selection-done", + G_CALLBACK (gtk_widget_destroy), NULL); if (event) { if (event->type == GDK_KEY_PRESS) @@ -59,174 +53,3 @@ e_popup_menu (GtkMenu *menu, GdkEvent *event) gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); } - -typedef struct { - GtkCallback callback; - gpointer closure; -} CallbackClosure; - -static void -e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure) -{ - if (GTK_IS_CONTAINER(widget)) { - e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure); - } else { - (*callback_closure->callback) (widget, callback_closure->closure); - } -} - -void -e_container_foreach_leaf(GtkContainer *container, - GtkCallback callback, - gpointer closure) -{ - CallbackClosure callback_closure; - callback_closure.callback = callback; - callback_closure.closure = closure; - gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure); -} - -static void -e_container_change_tab_order_destroy_notify(gpointer data) -{ - GList *list = data; - g_list_foreach(list, (GFunc) g_object_unref, NULL); - g_list_free(list); -} - -static gint -e_container_change_tab_order_callback(GtkContainer *container, - GtkDirectionType direction, - GList *children) -{ - GtkWidget *focus_child; - GtkWidget *child; - - if (direction != GTK_DIR_TAB_FORWARD && - direction != GTK_DIR_TAB_BACKWARD) - return FALSE; - - focus_child = container->focus_child; - - if (focus_child == NULL) - return FALSE; - - if (direction == GTK_DIR_TAB_BACKWARD) { - children = g_list_last(children); - } - - while (children) { - child = children->data; - if (direction == GTK_DIR_TAB_FORWARD) - children = children->next; - else - children = children->prev; - - if (!child) - continue; - - if (focus_child) { - if (focus_child == child) { - focus_child = NULL; - - if (GTK_WIDGET_DRAWABLE (child) && - GTK_IS_CONTAINER (child) && - !GTK_WIDGET_HAS_FOCUS (child)) - if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - } - else if (GTK_WIDGET_DRAWABLE (child)) { - if (GTK_IS_CONTAINER (child)) { - if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - else if (GTK_WIDGET_CAN_FOCUS (child)) { - gtk_widget_grab_focus (child); - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - } - - return FALSE; -} - -gint -e_container_change_tab_order(GtkContainer *container, GList *widgets) -{ - GList *list; - list = g_list_copy(widgets); - g_list_foreach(list, (GFunc) g_object_ref, NULL); - return g_signal_connect_data (container, "focus", - G_CALLBACK(e_container_change_tab_order_callback), - list, - (GClosureNotify) e_container_change_tab_order_destroy_notify, - 0); -} - -struct widgetandint { - GtkWidget *widget; - gint count; -}; - -static void -nth_entry_callback(GtkWidget *widget, struct widgetandint *data) -{ - if (GTK_IS_ENTRY(widget)) { - if (data->count > 1) { - data->count --; - data->widget = widget; - } else if (data->count == 1) { - data->count --; - data->widget = NULL; - gtk_widget_grab_focus(widget); - } - } -} - -void -e_container_focus_nth_entry(GtkContainer *container, gint n) -{ - struct widgetandint data; - data.widget = NULL; - data.count = n; - e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data); - if (data.widget) - gtk_widget_grab_focus(data.widget); -} - -gboolean -e_glade_xml_connect_widget (GladeXML *gui, gchar *name, gchar *signal, GCallback cb, gpointer closure) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget (gui, name); - - if (widget) { - g_signal_connect (widget, signal, - cb, closure); - return TRUE; - } - - return FALSE; -} - -gboolean -e_glade_xml_set_sensitive (GladeXML *gui, gchar *name, gboolean sensitive) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget (gui, name); - - if (widget) { - gtk_widget_set_sensitive (widget, sensitive); - return TRUE; - } - - return FALSE; -} diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h index b66160c2d1..ff05d57725 100644 --- a/widgets/misc/e-gui-utils.h +++ b/widgets/misc/e-gui-utils.h @@ -20,36 +20,16 @@ * */ -#ifndef GAL_GUI_UTILS_H -#define GAL_GUI_UTILS_H +#ifndef E_GUI_UTILS_H +#define E_GUI_UTILS_H #include <gtk/gtk.h> -#include <glade/glade-xml.h> G_BEGIN_DECLS void e_popup_menu (GtkMenu *menu, GdkEvent *event); -void e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu); - -void e_container_foreach_leaf (GtkContainer *container, - GtkCallback callback, - gpointer closure); -void e_container_focus_nth_entry (GtkContainer *container, - gint n); -gint e_container_change_tab_order (GtkContainer *container, - GList *widgets); - -/* Returns TRUE on success. */ -gboolean e_glade_xml_connect_widget (GladeXML *gui, - gchar *name, - gchar *signal, - GCallback cb, - gpointer closure); -gboolean e_glade_xml_set_sensitive (GladeXML *gui, - gchar *name, - gboolean sensitive); G_END_DECLS -#endif /* GAL_GUI_UTILS_H */ +#endif /* E_GUI_UTILS_H */ diff --git a/widgets/misc/e-image-chooser.c b/widgets/misc/e-image-chooser.c index 2f451543e3..32a3f2a899 100644 --- a/widgets/misc/e-image-chooser.c +++ b/widgets/misc/e-image-chooser.c @@ -255,7 +255,8 @@ image_drag_data_received_cb (GtkWidget *widget, if (e_util_read_file (uris[0], TRUE, &buf, &read, &error) && read > 0 && buf) handled = set_image_from_data (chooser, buf, read); - g_free (buf); + if (!handled) + g_free (buf); g_strfreev (uris); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index eacbfbbc74..96e5e57d7b 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1128,7 +1128,7 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d focus_first_etable_item (etable->group); } - return TRUE; + return FALSE; } static gboolean |