From 1db4cae4fed89733f824801a67847da277a5c255 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 11 Jun 2009 16:40:11 +0530 Subject: Added couple of APIS for EAttachmentPaned to hide combo and get the widget's container. --- widgets/misc/e-attachment-paned.c | 15 +++++++++++++++ widgets/misc/e-attachment-paned.h | 4 ++++ 2 files changed, 19 insertions(+) (limited to 'widgets') diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c index a88f9fa8b2..a65d1c6ea4 100644 --- a/widgets/misc/e-attachment-paned.c +++ b/widgets/misc/e-attachment-paned.c @@ -45,6 +45,7 @@ struct _EAttachmentPanedPrivate { GtkWidget *expander; GtkWidget *notebook; GtkWidget *combo_box; + GtkWidget *controls_container; GtkWidget *icon_view; GtkWidget *tree_view; GtkWidget *show_hide_label; @@ -574,6 +575,7 @@ attachment_paned_init (EAttachmentPaned *paned) widget = gtk_hbox_new (FALSE, 6); gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0); + paned->priv->controls_container = widget; gtk_widget_show (widget); container = widget; @@ -775,3 +777,16 @@ e_attachment_paned_drag_data_received (EAttachmentPaned *paned, paned->priv->icon_view, "drag-data-received", context, x, y, selection, info, time); } + +GtkWidget * +e_attachment_paned_get_controls_container (EAttachmentPaned *paned) +{ + return paned->priv->controls_container; +} + +GtkWidget * +e_attachment_paned_get_view_combo (EAttachmentPaned *paned) +{ + return paned->priv->combo_box; +} + diff --git a/widgets/misc/e-attachment-paned.h b/widgets/misc/e-attachment-paned.h index 401ec581cb..c0fd7b5c54 100644 --- a/widgets/misc/e-attachment-paned.h +++ b/widgets/misc/e-attachment-paned.h @@ -78,6 +78,10 @@ void e_attachment_paned_drag_data_received GtkSelectionData *selection, guint info, guint time); +GtkWidget * e_attachment_paned_get_controls_container + (EAttachmentPaned *paned); +GtkWidget * e_attachment_paned_get_view_combo + (EAttachmentPaned *paned); G_END_DECLS -- cgit From 09d01be0aae3b356c892d56d2c5f8eb5ae27a8d2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 12 Jun 2009 21:45:52 -0400 Subject: Bug 585554 – Opening PDF attachment crashes in e_attachment_open_handle_error() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widgets/misc/e-attachment.c | 47 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index ba2811d5d9..7735be8872 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -1957,7 +1957,6 @@ attachment_open_file (GFile *file, { GdkAppLaunchContext *context; GSimpleAsyncResult *simple; - GList *file_list; gboolean success; GError *error = NULL; @@ -1965,41 +1964,29 @@ attachment_open_file (GFile *file, simple = open_context->simple; open_context->simple = NULL; - /* Find a default app based on content type. */ - if (open_context->app_info == NULL) { - EAttachment *attachment; - GFileInfo *file_info; - const gchar *content_type; - - attachment = open_context->attachment; - file_info = e_attachment_get_file_info (attachment); - if (file_info == NULL) - goto exit; - - content_type = g_file_info_get_content_type (file_info); - if (content_type == NULL) - goto exit; + context = gdk_app_launch_context_new (); - open_context->app_info = g_app_info_get_default_for_type ( - content_type, FALSE); + if (open_context->app_info != NULL) { + GList *file_list; + + file_list = g_list_prepend (NULL, file); + success = g_app_info_launch ( + open_context->app_info, file_list, + G_APP_LAUNCH_CONTEXT (context), &error); + g_list_free (file_list); + } else { + gchar *uri; + + uri = g_file_get_uri (file); + success = g_app_info_launch_default_for_uri ( + uri, G_APP_LAUNCH_CONTEXT (context), &error); + g_free (uri); } - if (open_context->app_info == NULL) - goto exit; - - context = gdk_app_launch_context_new (); - file_list = g_list_prepend (NULL, file); - - success = g_app_info_launch ( - open_context->app_info, file_list, - G_APP_LAUNCH_CONTEXT (context), &error); + g_object_unref (context); g_simple_async_result_set_op_res_gboolean (simple, success); - g_list_free (file_list); - g_object_unref (context); - -exit: if (error != NULL) { g_simple_async_result_set_from_error (simple, error); g_error_free (error); -- cgit From 6b12be62e100934ccae65f197c8c7eef2c8ae3a4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 13 Jun 2009 22:51:11 -0400 Subject: Fix coding style. --- widgets/misc/e-attachment-paned.h | 4 ++-- widgets/misc/e-search-bar.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/e-attachment-paned.h b/widgets/misc/e-attachment-paned.h index c0fd7b5c54..825de3a16b 100644 --- a/widgets/misc/e-attachment-paned.h +++ b/widgets/misc/e-attachment-paned.h @@ -78,9 +78,9 @@ void e_attachment_paned_drag_data_received GtkSelectionData *selection, guint info, guint time); -GtkWidget * e_attachment_paned_get_controls_container +GtkWidget * e_attachment_paned_get_controls_container (EAttachmentPaned *paned); -GtkWidget * e_attachment_paned_get_view_combo +GtkWidget * e_attachment_paned_get_view_combo (EAttachmentPaned *paned); G_END_DECLS diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index acd52ece6f..b2f1a314e2 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -1451,7 +1451,7 @@ e_search_bar_set_search_scope (ESearchBar *search_bar, gint id) gint row; g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); - + if (!search_bar->scopeoption_menu) return; row = find_id (search_bar->scopeoption_menu, id, "EsbItemId", NULL); -- cgit From 1276d2a9b42398e7ec978efc24e99aa6cd31e631 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 14 Jun 2009 15:30:14 -0400 Subject: Bug 584902 – Disabled default account hides "From" in composer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widgets/misc/e-account-combo-box.c | 47 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c index 7663f0faee..a0d02bcd80 100644 --- a/widgets/misc/e-account-combo-box.c +++ b/widgets/misc/e-account-combo-box.c @@ -64,6 +64,44 @@ account_combo_box_has_dupes (GList *list, return (count > 1); } +static EAccount * +account_combo_box_choose_account (EAccountComboBox *combo_box) +{ + EAccountList *account_list; + EAccount *account; + GtkTreeModel *model; + GtkTreeIter iter; + + account_list = e_account_combo_box_get_account_list (combo_box); + g_return_val_if_fail (account_list != NULL, NULL); + + /* First try the default account. */ + + /* XXX EAccountList misuses const. */ + account = (EAccount *) + e_account_list_get_default (account_list); + + /* If there is no default account, give up. */ + if (account == NULL) + return NULL; + + /* Make sure the default account appears in the combo box. */ + if (g_hash_table_lookup (combo_box->priv->index, account) != NULL) + return account; + + /* Default account is disabled or otherwise unusable, + * so fall back to the first account in the combo box. */ + + model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)); + + if (!gtk_tree_model_get_iter_first (model, &iter)) + return NULL; + + gtk_tree_model_get (model, &iter, COLUMN_ACCOUNT, &account, -1); + + return account; +} + static gboolean account_combo_box_test_account (EAccount *account) { @@ -416,11 +454,12 @@ e_account_combo_box_set_active (EAccountComboBox *combo_box, account_list = combo_box->priv->account_list; g_return_val_if_fail (account_list != NULL, FALSE); - /* NULL means select the default account. */ - /* XXX EAccountList misuses const. */ + /* NULL means choose an account ourselves. */ if (account == NULL) - account = (EAccount *) - e_account_list_get_default (account_list); + account = account_combo_box_choose_account (combo_box); + + if (account == NULL) + return FALSE; /* Lookup the tree row reference for the account. */ reference = g_hash_table_lookup (combo_box->priv->index, account); -- cgit