[gnome-calendar] edit-dialog: fixed wrong menu fill
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] edit-dialog: fixed wrong menu fill
- Date: Mon, 8 Dec 2014 17:34:20 +0000 (UTC)
commit f8c269ac745cf8464512bb32da1ca8317ee381dd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Dec 8 14:45:32 2014 -0200
edit-dialog: fixed wrong menu fill
Menu is created each time the dialog is shown, now. This avoids the syncronization between sources
loading time.
Also, icon color is now 16px.
src/gcal-edit-dialog.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index a2ad7ff..e8da6db 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -56,6 +56,7 @@ typedef struct
GtkWidget *notes_text;
/* actions */
+ GMenu *sources_menu;
GSimpleAction *action;
GSimpleActionGroup *action_group;
@@ -114,7 +115,6 @@ fill_sources_menu (GcalEditDialog *dialog)
GcalEditDialogPrivate *priv;
GList *list;
GList *aux;
- GMenu *menu;
priv = gcal_edit_dialog_get_instance_private (dialog);
@@ -122,7 +122,7 @@ fill_sources_menu (GcalEditDialog *dialog)
return;
list = gcal_manager_get_sources (priv->manager);
- menu = g_menu_new ();
+ priv->sources_menu = g_menu_new ();
for (aux = list; aux != NULL; aux = aux->next)
{
@@ -139,11 +139,10 @@ fill_sources_menu (GcalEditDialog *dialog)
/* menu item */
item = g_menu_item_new (e_source_get_display_name (source), "edit.select_calendar");
- g_menu_item_set_icon (item, G_ICON (gcal_get_pixbuf_from_color (&color, 12)));
+ g_menu_item_set_icon (item, G_ICON (gcal_get_pixbuf_from_color (&color, 16)));
/* set insensitive for read-only calendars */
- if (! e_source_get_enabled (source)||
- gcal_manager_is_client_writable (priv->manager, source))
+ if (gcal_manager_is_client_writable (priv->manager, source))
{
g_menu_item_set_action_and_target_value (item, "edit.select_calendar", NULL);
}
@@ -153,10 +152,10 @@ fill_sources_menu (GcalEditDialog *dialog)
g_variant_new_string (e_source_dup_uid (source)));
}
- g_menu_append_item (menu, item);
+ g_menu_append_item (priv->sources_menu, item);
}
- gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->sources_button), G_MENU_MODEL (menu));
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->sources_button), G_MENU_MODEL (priv->sources_menu));
g_list_free (list);
}
@@ -835,6 +834,12 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
/* Clear event data */
gcal_edit_dialog_clear_data (dialog);
+ /* update sources list */
+ if (priv->sources_menu != NULL)
+ g_menu_remove_all (priv->sources_menu);
+
+ fill_sources_menu (dialog);
+
/* Load new event data */
/* summary */
e_cal_component_get_summary (priv->component, &e_summary);
@@ -931,9 +936,6 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
priv = gcal_edit_dialog_get_instance_private (dialog);
priv->manager = manager;
-
- /* sources menu */
- fill_sources_menu (dialog);
}
ECalComponent*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]