[gnome-calendar/gbsneto/gtk4: 46/46] event-editor/dialog: Improve calendar selection menu




commit 69d320f49c64746a9f3b3006c05d0b4e0c38d05c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Feb 12 13:24:57 2022 -0300

    event-editor/dialog: Improve calendar selection menu

 src/gui/event-editor/gcal-event-editor-dialog.c | 18 ++++++++----------
 src/utils/gcal-utils.c                          |  1 +
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/event-editor/gcal-event-editor-dialog.c b/src/gui/event-editor/gcal-event-editor-dialog.c
index e4a91c51..0118e756 100644
--- a/src/gui/event-editor/gcal-event-editor-dialog.c
+++ b/src/gui/event-editor/gcal-event-editor-dialog.c
@@ -153,6 +153,7 @@ fill_sources_menu (GcalEventEditorDialog *self)
       g_autoptr (GdkPaintable) paintable = NULL;
       g_autoptr (GMenuItem) item = NULL;
       g_autoptr (GdkPixbuf) pix = NULL;
+      g_autoptr (GVariant) target = NULL;
       GcalCalendar *calendar;
       const GdkRGBA *color;
 
@@ -168,15 +169,12 @@ fill_sources_menu (GcalEventEditorDialog *self)
       g_menu_item_set_icon (item, G_ICON (pix));
 
       /* set insensitive for read-only calendars */
-      if (gcal_calendar_is_read_only (calendar))
-        {
-          g_menu_item_set_action_and_target_value (item, "select-calendar", NULL);
-        }
-      else
-        {
-          const gchar *id = gcal_calendar_get_id (calendar);
-          g_menu_item_set_action_and_target_value (item, "select-calendar", g_variant_new_string (id));
-        }
+      if (!gcal_calendar_is_read_only (calendar))
+        target = g_variant_new_string (gcal_calendar_get_id (calendar));
+
+      g_menu_item_set_action_and_target_value (item,
+                                               "event-editor-dialog.select-calendar",
+                                               g_steal_pointer (&target));
 
       g_menu_append_item (self->sources_menu, item);
     }
@@ -433,7 +431,7 @@ gcal_event_editor_dialog_constructed (GObject* object)
                                    self);
 
   gtk_widget_insert_action_group (GTK_WIDGET (self),
-                                  "edit",
+                                  "event-editor-dialog",
                                   G_ACTION_GROUP (self->action_group));
 
   /* Watch the main window and adapt the maximum size */
diff --git a/src/utils/gcal-utils.c b/src/utils/gcal-utils.c
index 0fd61262..1b253dcf 100644
--- a/src/utils/gcal-utils.c
+++ b/src/utils/gcal-utils.c
@@ -752,6 +752,7 @@ fix_popover_menu_icons (GtkPopover *popover)
           if (GTK_IS_IMAGE (child2))
             {
               gtk_widget_add_css_class (child2, "calendar-color-image");
+              gtk_widget_set_margin_end (child2, 12);
               gtk_widget_show (child2);
               break;
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]