[almanah] App: Migrated from GtkToolbar to GtkHeaderBar



commit 61fd1cc9c228b502a401d4040680203e390cb57b
Author: Álvaro Peña <alvaropg gmail com>
Date:   Sun Mar 1 18:10:58 2015 +0100

    App: Migrated from GtkToolbar to GtkHeaderBar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742145

 src/Makefile.am               |    2 -
 src/css/almanah.css           |    6 +-
 src/gtk/menus.ui              |   32 ++++----
 src/main-window.c             |  109 +++++++++-------------------
 src/ui/almanah.ui             |   16 ++---
 src/widgets/calendar-button.c |   97 ++----------------------
 src/widgets/calendar-window.c |  165 -----------------------------------------
 src/widgets/calendar-window.h |   59 ---------------
 8 files changed, 63 insertions(+), 423 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b79204d..dd532d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,8 +43,6 @@ almanah_SOURCES = \
        widgets/calendar.h                      \
        widgets/calendar-button.h               \
        widgets/calendar-button.c               \
-       widgets/calendar-window.h               \
-       widgets/calendar-window.c               \
        widgets/eggwrapbox.h                    \
        widgets/eggwrapbox.c                    \
        widgets/eggwrapbox-enums.h              \
diff --git a/src/css/almanah.css b/src/css/almanah.css
index 106d28d..931a86b 100644
--- a/src/css/almanah.css
+++ b/src/css/almanah.css
@@ -1,7 +1,3 @@
-AlmanahMainWindow GtkToolbar {
-    border-width: 0px;
-}
-
 AlmanahCalendarButton:active {
     background-image: none;
     background-color: @menu_bg_color;
@@ -46,7 +42,7 @@ AlmanahTagEntry:backdrop {
     border-radius: 0px;
     border-width: 0px;
     border-bottom-width: 1px;
-    border-top-width: 1px;
+    border-top-width: 0px;
     background-color: #fff;
 }
 
diff --git a/src/gtk/menus.ui b/src/gtk/menus.ui
index b427400..acf38a8 100644
--- a/src/gtk/menus.ui
+++ b/src/gtk/menus.ui
@@ -36,7 +36,21 @@
                        </item>
                </section>
        </menu>
-       <menu id="gear-menu">
+       <menu id="main-window-menu">
+               <section>
+                       <item>
+                               <attribute name="label" translatable="yes">_Bold</attribute>
+                               <attribute name="action">win.bold</attribute>
+                       </item>
+                       <item>
+                               <attribute name="label" translatable="yes">_Italic</attribute>
+                               <attribute name="action">win.italic</attribute>
+                       </item>
+                       <item>
+                               <attribute name="label" translatable="yes">_Underline</attribute>
+                               <attribute name="action">win.underline</attribute>
+                       </item>
+               </section>
                <section>
                        <item>
                                <attribute name="label" translatable="yes">_Cut</attribute>
@@ -66,20 +80,4 @@
                        </item>
                </section>
        </menu>
-       <menu id="font-menu">
-               <section>
-                       <item>
-                               <attribute name="label" translatable="yes">_Bold</attribute>
-                               <attribute name="action">win.bold</attribute>
-                       </item>
-                       <item>
-                               <attribute name="label" translatable="yes">_Italic</attribute>
-                               <attribute name="action">win.italic</attribute>
-                       </item>
-                       <item>
-                               <attribute name="label" translatable="yes">_Underline</attribute>
-                               <attribute name="action">win.underline</attribute>
-                       </item>
-               </section>
-       </menu>
 </interface>
diff --git a/src/main-window.c b/src/main-window.c
index 6a427c9..aa1b644 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -62,8 +62,7 @@ static void mw_entry_buffer_has_selection_cb (GObject *object, GParamSpec *pspec
 
 static void mw_events_updated_cb (AlmanahEventManager *event_manager, AlmanahEventFactoryType type_id, 
AlmanahMainWindow *main_window);
 static gboolean save_entry_timeout_cb (AlmanahMainWindow *self);
-static gint get_icon_margin (void);
-static void mw_setup_toolbar (AlmanahMainWindow *main_window, AlmanahApplication *application, GtkBuilder 
*builder);
+static void mw_setup_headerbar (AlmanahMainWindow *main_window, AlmanahApplication *application);
 
 /* GActions callbacks */
 void mw_cut_activate_cb           (GSimpleAction *action, GVariant *parameter, gpointer user_data);
@@ -86,6 +85,7 @@ void mw_calendar_day_selected_cb (AlmanahCalendarButton *calendar, AlmanahMainWi
 void mw_calendar_select_date_clicked_cb (AlmanahCalendarButton *calendar, AlmanahMainWindow *main_window);
 
 struct _AlmanahMainWindowPrivate {
+       GtkWidget *header_bar;
        GtkTextView *entry_view;
        GtkTextBuffer *entry_buffer;
        AlmanahEntryTagsArea *entry_tags_area;
@@ -148,6 +148,10 @@ almanah_main_window_init (AlmanahMainWindow *self)
                                         win_entries,
                                         G_N_ELEMENTS (win_entries),
                                         self);
+
+       self->priv->header_bar = gtk_header_bar_new ();
+       gtk_window_set_titlebar (GTK_WINDOW (self), self->priv->header_bar);
+       gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->priv->header_bar), TRUE);
 }
 
 static void
@@ -278,7 +282,7 @@ almanah_main_window_new (AlmanahApplication *application)
        g_object_unref (event_manager);
 
        /* Set up the main toolbar */
-       mw_setup_toolbar (main_window, application, builder);
+       mw_setup_headerbar (main_window, application);
 
        /* Select the current day and month */
        almanah_calendar_button_select_today(main_window->priv->calendar_button);
@@ -1182,6 +1186,7 @@ mw_calendar_day_selected_cb (AlmanahCalendarButton *calendar_button, AlmanahMain
                NULL
        };
        guint i = 0;
+       gchar calendar_string[100];
 
        /* Set up */
        application = ALMANAH_APPLICATION (gtk_window_get_application (GTK_WINDOW (main_window)));
@@ -1191,6 +1196,9 @@ mw_calendar_day_selected_cb (AlmanahCalendarButton *calendar_button, AlmanahMain
 
        /* Update the date label */
        almanah_calendar_button_get_date (main_window->priv->calendar_button, &calendar_date);
+       /* Translators: This is a strftime()-format string for the date displayed at the top of the main 
window. */
+       g_date_strftime (calendar_string, sizeof (calendar_string), _("%A, %e %B %Y"), &calendar_date);
+       gtk_header_bar_set_title (GTK_HEADER_BAR (main_window->priv->header_bar), calendar_string);
 
        /* Update the entry */
        storage_manager = almanah_application_dup_storage_manager (application);
@@ -1283,95 +1291,46 @@ mw_events_tree_view_row_activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
        almanah_event_view (event, GTK_WINDOW (main_window));
 }
 
-static gint
-get_icon_margin (void)
-{
-  gint toolbar_size, menu_size;
-
-  gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &menu_size, NULL);
-  gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &toolbar_size, NULL);
-  return (gint) ((toolbar_size - menu_size) / 2);
-}
-
 static void
-mw_setup_toolbar (AlmanahMainWindow *main_window, AlmanahApplication *application, GtkBuilder *builder)
+mw_setup_headerbar (AlmanahMainWindow *main_window, AlmanahApplication *application)
 {
-       GtkToolbar *toolbar;
-       GtkToolItem *tool_item;
        GtkWidget *button, *button_image;
        GMenu *menu;
        AlmanahStorageManager *storage_manager;
 
-       toolbar = GTK_TOOLBAR (gtk_builder_get_object (builder, "almanah_mw_toolbar"));
-
-       /* Allow drag the window using the toolbar */
-       gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (toolbar)), 
GTK_STYLE_CLASS_MENUBAR);
-       gtk_toolbar_set_icon_size (toolbar, GTK_ICON_SIZE_MENU);
-
-       /* The text style button */
-       tool_item = gtk_tool_item_new ();
-       button = gtk_menu_button_new ();
-       menu = gtk_application_get_menu_by_id (gtk_window_get_application (GTK_WINDOW (main_window)), 
"font-menu");
-       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu));
-       button_image = gtk_image_new_from_icon_name ("gtk-select-font", GTK_ICON_SIZE_MENU);
-       g_object_set (button_image, "margin", get_icon_margin (), NULL);
-       gtk_button_set_image (GTK_BUTTON (button), button_image);
-       gtk_container_add (GTK_CONTAINER (tool_item), button);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-
-       /* Insert a dynamic space between the insert link and calendar & important.
-        * This can't be done using the <tool_item/> in the UI file at the moment
-        */
-       tool_item = gtk_separator_tool_item_new ();
-       gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item), FALSE);
-       gtk_tool_item_set_expand (tool_item, TRUE);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-
        /* Setup the calendar button */
        storage_manager = almanah_application_dup_storage_manager (application);
        main_window->priv->calendar_button = ALMANAH_CALENDAR_BUTTON (almanah_calendar_button_new 
(storage_manager));
        g_object_unref (storage_manager);
        g_signal_connect (main_window->priv->calendar_button, "day-selected", G_CALLBACK 
(mw_calendar_day_selected_cb), main_window);
        g_signal_connect (main_window->priv->calendar_button, "select-date-clicked", G_CALLBACK 
(mw_calendar_select_date_clicked_cb), main_window);
-       /* Insert the calendar button into the toolbar through a GtkToolItem but button style */
-       tool_item = gtk_tool_item_new ();
-       gtk_container_add (GTK_CONTAINER (tool_item), GTK_WIDGET (main_window->priv->calendar_button));
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+       gtk_style_context_add_class (gtk_widget_get_style_context (main_window->priv->header_bar), 
"image-button");
+       button_image = gtk_image_new_from_icon_name ("x-office-calendar-symbolic", GTK_ICON_SIZE_MENU);
+       gtk_button_set_image (GTK_BUTTON (main_window->priv->calendar_button), button_image);
+       gtk_header_bar_pack_start (GTK_HEADER_BAR (main_window->priv->header_bar), GTK_WIDGET 
(main_window->priv->calendar_button));
+
+       /* Hamburger menu  */
+       button = gtk_menu_button_new ();
+       menu = gtk_application_get_menu_by_id (gtk_window_get_application (GTK_WINDOW (main_window)), 
"main-window-menu");
+       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu));
+       button_image = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_MENU);
+       gtk_button_set_image (GTK_BUTTON (button), button_image);
+       gtk_header_bar_pack_end (GTK_HEADER_BAR (main_window->priv->header_bar), button);
 
        /* Important entry */
-       tool_item = gtk_separator_tool_item_new ();
-       gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item), FALSE);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-       tool_item = gtk_toggle_tool_button_new ();
-       gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (tool_item), "starred-symbolic");
-       gtk_actionable_set_action_name (GTK_ACTIONABLE (tool_item), "win.important");
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-
-       /* Another dynamic tool_item */
-       tool_item = gtk_separator_tool_item_new ();
-       gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item), FALSE);
-       gtk_tool_item_set_expand (tool_item, TRUE);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+       button = gtk_toggle_button_new ();
+       gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
+       button_image = gtk_image_new_from_icon_name ("starred-symbolic", GTK_ICON_SIZE_MENU);
+       gtk_button_set_image (GTK_BUTTON (button), button_image);
+       gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.important");
+       gtk_header_bar_pack_end (GTK_HEADER_BAR (main_window->priv->header_bar), button);
 
        /* Show/hide tags: future "side pane", for photos and other elements */
-       tool_item = gtk_toggle_tool_button_new ();
-       gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (tool_item), "almanah-tags-symbolic");
-       gtk_actionable_set_action_name (GTK_ACTIONABLE (tool_item), "win.show-tags");
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-
-       /* Gear menu  */
-       tool_item = gtk_separator_tool_item_new ();
-       gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item), FALSE);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
-       tool_item = gtk_tool_item_new ();
-       button = gtk_menu_button_new ();
-       menu = gtk_application_get_menu_by_id (gtk_window_get_application (GTK_WINDOW (main_window)), 
"gear-menu");
-       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu));
-       button_image = gtk_image_new_from_icon_name ("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
-       g_object_set (button_image, "margin", get_icon_margin (), NULL);
+       button = gtk_toggle_button_new ();
+       button_image = gtk_image_new_from_icon_name ("almanah-tags-symbolic", GTK_ICON_SIZE_MENU);
        gtk_button_set_image (GTK_BUTTON (button), button_image);
-       gtk_container_add (GTK_CONTAINER (tool_item), button);
-       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+       gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.show-tags");
+       gtk_header_bar_pack_end (GTK_HEADER_BAR (main_window->priv->header_bar), button);
 }
 
 #ifdef ENABLE_SPELL_CHECKING
diff --git a/src/ui/almanah.ui b/src/ui/almanah.ui
index cdd60a9..2b4c6cf 100644
--- a/src/ui/almanah.ui
+++ b/src/ui/almanah.ui
@@ -10,10 +10,8 @@
                </columns>
        </object>
 
-       <object class="AlmanahCalendarWindow" id="almanah_calendar_window">
+       <object class="GtkPopover" id="almanah_calendar_window">
                <property name="border-width">12</property>
-               <property name="can-focus">True</property>
-               <property name="type">GTK_WINDOW_POPUP</property>
                <child>
                        <object class="GtkBox" id="almanah_cw_vbox">
                                <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
@@ -38,6 +36,9 @@
                                        <object class="GtkButtonBox" id="almanah_cw_button_box">
                                                <property 
name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
                                                <property name="homogeneous">True</property>
+                                               <style>
+                                                       <class name="linked" />
+                                               </style>
                                                <child>
                                                        <object class="GtkButton" 
id="almanah_cw_today_button">
                                                                <property name="visible">True</property>
@@ -69,16 +70,11 @@
 
        <object class="AlmanahMainWindow" id="almanah_main_window">
                <property name="hide-titlebar-when-maximized">True</property>
+                <property name="default-width">640</property>
+                <property name="default-height">480</property>
                <child>
                        <object class="GtkVBox" id="vbox1">
                                <child>
-                                       <object class="GtkToolbar" id="almanah_mw_toolbar">
-                                       </object>
-                                       <packing>
-                                               <property name="expand">False</property>
-                                       </packing>
-                               </child>
-                               <child>
                                        <object class="GtkVBox" id="vbox3">
                                                <property name="spacing">6</property>
                                                <child>
diff --git a/src/widgets/calendar-button.c b/src/widgets/calendar-button.c
index 8888f2e..f45d488 100644
--- a/src/widgets/calendar-button.c
+++ b/src/widgets/calendar-button.c
@@ -22,7 +22,6 @@
 
 #include "calendar-button.h"
 #include "calendar.h"
-#include "calendar-window.h"
 #include "interface.h"
 
 /* This enum allows to know the reason why the calendar date has been changed */
@@ -47,7 +46,6 @@ enum {
 static guint calendar_button_signals[LAST_SIGNAL] = { 0 };
 
 struct _AlmanahCalendarButtonPrivate {
-       GtkWidget *label;
        GtkWidget *dock;
        guchar user_event;
        AlmanahCalendar *calendar;
@@ -60,7 +58,7 @@ static void almanah_calendar_button_get_property (GObject *object, guint propert
 static void almanah_calendar_button_set_property (GObject *object, guint property_id, const GValue *value, 
GParamSpec *pspec);
 static void almanah_calendar_button_finalize (GObject *object);
 
-static void almanah_calendar_button_dock_hiden (GtkWidget *dock, AlmanahCalendarButton *self);
+static void almanah_calendar_button_dock_closed (GtkWidget *dock, AlmanahCalendarButton *self);
 
 static void almanah_calendar_button_toggled (GtkToggleButton *togglebutton);
 static void almanah_calendar_button_day_selected_cb (GtkCalendar *calendar, AlmanahCalendarButton *self);
@@ -126,8 +124,6 @@ almanah_calendar_button_class_init (AlmanahCalendarButtonClass *klass)
 static void
 almanah_calendar_button_init (AlmanahCalendarButton *self)
 {
-       GtkWidget *arrow;
-       GtkBox *main_box;
        GtkBuilder *builder;
        GError *error = NULL;
        const gchar *object_names[] = {
@@ -140,16 +136,6 @@ almanah_calendar_button_init (AlmanahCalendarButton *self)
 
        gtk_button_set_focus_on_click (GTK_BUTTON (self), TRUE);
 
-       /* The button elements */
-       self->priv->label = gtk_label_new (NULL);
-
-       arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
-
-       main_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6));
-       gtk_box_pack_start (main_box, self->priv->label, TRUE, TRUE, 0);
-       gtk_box_pack_start (main_box, arrow, FALSE, TRUE, 0);
-       gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (main_box));
-
        /* Calendar dock window from the UI file */
        builder = gtk_builder_new ();
        if (gtk_builder_add_objects_from_resource (builder, "/org/gnome/Almanah/ui/almanah.ui", (gchar **) 
object_names, &error) == 0) {
@@ -168,9 +154,9 @@ almanah_calendar_button_init (AlmanahCalendarButton *self)
 
                return;
        }
-       gtk_window_set_type_hint (GTK_WINDOW (self->priv->dock), GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU);
+       gtk_popover_set_relative_to (GTK_POPOVER (self->priv->dock), GTK_WIDGET (self));
 
-       g_signal_connect (self->priv->dock, "hide", G_CALLBACK (almanah_calendar_button_dock_hiden), self);
+       g_signal_connect (self->priv->dock, "hide", G_CALLBACK (almanah_calendar_button_dock_closed), self);
 
        /* The calendar widget */
        self->priv->calendar = ALMANAH_CALENDAR (gtk_builder_get_object (builder, "almanah_cw_calendar"));
@@ -234,67 +220,8 @@ almanah_calendar_button_finalize (GObject *object)
        G_OBJECT_CLASS (almanah_calendar_button_parent_class)->finalize (object);
 }
 
-/**
- * Calculate the window position
- */
-static void
-dock_position_func (AlmanahCalendarButton *self, gint *x, gint *y)
-{
-       GdkScreen *screen;
-       GdkRectangle monitor;
-       GtkAllocation allocation;
-       GtkRequisition dock_req;
-       gint new_x, new_y, monitor_num;
-       AlmanahCalendarWindow *calendar_window = ALMANAH_CALENDAR_WINDOW (self->priv->dock);
-
-       /* Get the screen and monitor geometry */
-       screen = gtk_widget_get_screen (GTK_WIDGET (self));
-       monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (self)));
-       if (monitor_num < 0)
-               monitor_num = 0;
-       gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
-       /* Get the AlmanahCalendarButton position */
-       gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
-       gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (self)), &new_x, &new_y);
-       /* The dock window starting position is over the calendar button widget */
-       new_x += allocation.x;
-       new_y += allocation.y;
-
-       gtk_widget_get_preferred_size (GTK_WIDGET (calendar_window), &dock_req, NULL);
-       if (new_x + dock_req.width > monitor.x + monitor.width) {
-               /* Move the required pixels to the left if the dock don't showed complety
-                * in the screen
-                */
-               new_x -= (new_x + dock_req.width) - (monitor.x + monitor.width);
-       }
-
-       if ((new_y + allocation.height + dock_req.height) <= monitor.y + monitor.height) {
-               /*The dock window height isn't bigger than the monitor size */
-               new_y += allocation.height;
-       } else if (new_y - dock_req.height >= monitor.y) {
-               /* If the dock window height can't showed complety in the monitor,
-                * and the dock height isn't to bigg to show on top the calendar button
-                * move it on top of the calendar button
-                */
-               new_y -= dock_req.height;
-       } else if (monitor.y + monitor.height - (new_y + allocation.height) > new_y) {
-               /* in other case, we show under the calendar button if the space is enought */
-               new_y += allocation.height;
-       } else {
-               /* we need to put the dock in somewhere... even the monitor is to small */
-               new_y -= dock_req.height;
-       }
-
-       /* Put the dock window in the correct screen */
-       gtk_window_set_screen (GTK_WINDOW (calendar_window), screen);
-
-       *x = new_x;
-       *y = new_y;
-}
-
 static void
-almanah_calendar_button_dock_hiden (GtkWidget *dock, AlmanahCalendarButton *self)
+almanah_calendar_button_dock_closed (GtkWidget *dock, AlmanahCalendarButton *self)
 {
        /* Reset the calendar user event and toggle off the button */
        ALMANAH_CALENDAR_BUTTON (self)->priv->user_event = NONE_EVENT;
@@ -304,32 +231,22 @@ almanah_calendar_button_dock_hiden (GtkWidget *dock, AlmanahCalendarButton *self
 static void
 almanah_calendar_button_toggled (GtkToggleButton *togglebutton)
 {
-       gint x, y;
        AlmanahCalendarButton *self;
 
        self = ALMANAH_CALENDAR_BUTTON (togglebutton);
        if (gtk_toggle_button_get_active (togglebutton)) {
                /* Show the dock */
-               dock_position_func (self, &x, &y);
-               gtk_window_move (GTK_WINDOW (self->priv->dock), x, y);
-               almanah_calendar_window_popup (ALMANAH_CALENDAR_WINDOW (self->priv->dock));
+               gtk_widget_show_all (GTK_WIDGET (self->priv->dock));
        }
 }
 
 static void
 almanah_calendar_button_day_selected_cb (GtkCalendar *calendar, AlmanahCalendarButton *self)
 {
-       GDate calendar_date;
-       gchar calendar_string[100];
-
-       almanah_calendar_get_date (self->priv->calendar, &calendar_date);
-       /* Translators: This is a strftime()-format string for the date displayed at the top of the main 
window. */
-       g_date_strftime (calendar_string, sizeof (calendar_string), _("%A, %e %B %Y"), &calendar_date);
-       gtk_label_set_text (GTK_LABEL (self->priv->label), calendar_string);
        if (self->priv->user_event < DAY_EVENT) {
                /* Only hide the dock window when the user has clicked in a calendar day */
                self->priv->user_event = DAY_EVENT;
-               almanah_calendar_window_popdown (ALMANAH_CALENDAR_WINDOW (self->priv->dock));
+               gtk_widget_hide (GTK_WIDGET (self->priv->dock));
        }
 
        self->priv->user_event = NONE_EVENT;
@@ -426,7 +343,7 @@ almanah_calendar_button_popdown (AlmanahCalendarButton *self)
 {
        g_return_if_fail (ALMANAH_IS_CALENDAR_BUTTON (self));
 
-       almanah_calendar_window_popdown (ALMANAH_CALENDAR_WINDOW (self->priv->dock));
+       gtk_widget_hide (GTK_WIDGET (self->priv->dock));
 }
 
 void


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