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:
+4
-18
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.1 -->
|
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.14"/>
|
<requires lib="gtk+" version="3.14"/>
|
||||||
<template class="GcalWindow" parent="GtkApplicationWindow">
|
<template class="GcalWindow" parent="GtkApplicationWindow">
|
||||||
@@ -15,21 +14,18 @@
|
|||||||
<object class="GtkOverlay" id="views_overlay">
|
<object class="GtkOverlay" id="views_overlay">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="main_box">
|
<object class="GtkBox" id="main_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="vexpand">True</property>
|
<property name="vexpand">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchBar" id="search_bar">
|
<object class="GtkSearchBar" id="search_bar">
|
||||||
<property name="app_paintable">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="no_show_all">True</property>
|
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="show_close_button">True</property>
|
<property name="show_close_button">True</property>
|
||||||
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
|
<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"/>
|
<signal name="notify::search-mode-enabled" handler="search_toggled" object="GcalWindow" swapped="no"/>
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="search_entry_box">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="search_entry">
|
<object class="GtkSearchEntry" id="search_entry">
|
||||||
<property name="width_request">500</property>
|
<property name="width_request">500</property>
|
||||||
@@ -45,12 +41,6 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="views_stack">
|
<object class="GtkStack" id="views_stack">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -90,10 +80,6 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -295,7 +281,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</template>
|
</template>
|
||||||
<object class="GcalSearchView" id="search_view">
|
<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="relative_to">search_entry</property>
|
||||||
<property name="position">bottom</property>
|
<property name="position">bottom</property>
|
||||||
<signal name="event-activated" handler="search_event_selected" object="GcalWindow" swapped="no"/>
|
<signal name="event-activated" handler="search_event_selected" object="GcalWindow" swapped="no"/>
|
||||||
|
|||||||
+1
-40
@@ -103,7 +103,6 @@ typedef struct
|
|||||||
/* states */
|
/* states */
|
||||||
gboolean new_event_mode;
|
gboolean new_event_mode;
|
||||||
gboolean search_mode;
|
gboolean search_mode;
|
||||||
gboolean leaving_search_mode;
|
|
||||||
|
|
||||||
NewEventData *event_creation_data;
|
NewEventData *event_creation_data;
|
||||||
|
|
||||||
@@ -261,10 +260,6 @@ static void search_toggled (GObject *o
|
|||||||
static void search_changed (GtkEditable *editable,
|
static void search_changed (GtkEditable *editable,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static void search_bar_revealer_toggled (GObject *object,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
static void remove_event (GtkWidget *notification,
|
static void remove_event (GtkWidget *notification,
|
||||||
GParamSpec *spec,
|
GParamSpec *spec,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@@ -1281,22 +1276,10 @@ search_toggled (GObject *object,
|
|||||||
|
|
||||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||||
|
|
||||||
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 */
|
/* update header_bar widget */
|
||||||
|
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (priv->search_bar)))
|
||||||
gcal_search_view_search (GCAL_SEARCH_VIEW (priv->search_view), NULL, NULL);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
search_changed (GtkEditable *editable,
|
search_changed (GtkEditable *editable,
|
||||||
@@ -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
|
static void
|
||||||
remove_event (GtkWidget *notification,
|
remove_event (GtkWidget *notification,
|
||||||
GParamSpec *spec,
|
GParamSpec *spec,
|
||||||
@@ -1582,13 +1550,6 @@ gcal_window_constructed (GObject *object)
|
|||||||
|
|
||||||
g_signal_connect (priv->edit_dialog, "response", G_CALLBACK (edit_dialog_closed), 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*/
|
/* 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 ();
|
//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);
|
//gcal_week_view_set_manager (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), priv->manager);
|
||||||
|
|||||||
Reference in New Issue
Block a user