window: code cleanup
Remove the unneeded code to manage search bar visibility, since it is correctly hidden now. Also, clean up some UI code.
This commit is contained in:
+13
-27
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<template class="GcalWindow" parent="GtkApplicationWindow">
|
||||
@@ -15,41 +14,32 @@
|
||||
<object class="GtkOverlay" id="views_overlay">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main_box">
|
||||
<object class="GtkBox" id="main_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="search_bar">
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
|
||||
<signal name="notify::search-mode-enabled" handler="search_toggled" object="GcalWindow" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="search_entry_box">
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="width_request">500</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="width_request">500</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<signal name="search-changed" handler="search_changed" object="GcalWindow" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<signal name="search-changed" handler="search_changed" object="GcalWindow" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="views_stack">
|
||||
@@ -90,10 +80,6 @@
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -295,7 +281,7 @@
|
||||
</style>
|
||||
</template>
|
||||
<object class="GcalSearchView" id="search_view">
|
||||
<property name="visible">False</property>
|
||||
<property name="visible" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="default | sync-create" />
|
||||
<property name="relative_to">search_entry</property>
|
||||
<property name="position">bottom</property>
|
||||
<signal name="event-activated" handler="search_event_selected" object="GcalWindow" swapped="no"/>
|
||||
|
||||
+2
-41
@@ -103,7 +103,6 @@ typedef struct
|
||||
/* states */
|
||||
gboolean new_event_mode;
|
||||
gboolean search_mode;
|
||||
gboolean leaving_search_mode;
|
||||
|
||||
NewEventData *event_creation_data;
|
||||
|
||||
@@ -261,10 +260,6 @@ static void search_toggled (GObject *o
|
||||
static void search_changed (GtkEditable *editable,
|
||||
gpointer user_data);
|
||||
|
||||
static void search_bar_revealer_toggled (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data);
|
||||
|
||||
static void remove_event (GtkWidget *notification,
|
||||
GParamSpec *spec,
|
||||
gpointer user_data);
|
||||
@@ -1281,21 +1276,9 @@ search_toggled (GObject *object,
|
||||
|
||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||
|
||||
/* update header_bar widget */
|
||||
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (priv->search_bar)))
|
||||
{
|
||||
g_debug ("Entering search mode");
|
||||
gtk_widget_show (priv->search_bar);
|
||||
|
||||
/* update header_bar widget */
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (priv->search_view), NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_debug ("Leaving search mode");
|
||||
/* update header_bar */
|
||||
priv->leaving_search_mode = TRUE;
|
||||
gtk_widget_hide (priv->search_view);
|
||||
}
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (priv->search_view), NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1314,21 +1297,6 @@ search_changed (GtkEditable *editable,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
search_bar_revealer_toggled (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalWindowPrivate *priv;
|
||||
|
||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||
|
||||
if (!gtk_revealer_get_child_revealed (GTK_REVEALER (object)))
|
||||
gtk_widget_hide (priv->search_bar);
|
||||
else
|
||||
gtk_widget_show (priv->search_view);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_event (GtkWidget *notification,
|
||||
GParamSpec *spec,
|
||||
@@ -1582,13 +1550,6 @@ gcal_window_constructed (GObject *object)
|
||||
|
||||
g_signal_connect (priv->edit_dialog, "response", G_CALLBACK (edit_dialog_closed), object);
|
||||
|
||||
/* search bar */
|
||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (priv->search_bar),
|
||||
GTK_ENTRY (priv->search_entry));
|
||||
|
||||
g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->search_bar)), "notify::child-revealed",
|
||||
G_CALLBACK (search_bar_revealer_toggled), object);
|
||||
|
||||
/* XXX: Week view disabled until after the release when we restart the work on it*/
|
||||
//priv->views[GCAL_WINDOW_VIEW_WEEK] = gcal_week_view_new ();
|
||||
//gcal_week_view_set_manager (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), priv->manager);
|
||||
|
||||
Reference in New Issue
Block a user