Replaced demo-code for GcalSearchbar in GcalWindow.
This commit is contained in:
+7
-34
@@ -22,6 +22,7 @@
|
|||||||
#include "gcal-manager.h"
|
#include "gcal-manager.h"
|
||||||
#include "gcal-floating-container.h"
|
#include "gcal-floating-container.h"
|
||||||
#include "gcal-toolbar.h"
|
#include "gcal-toolbar.h"
|
||||||
|
#include "gcal-searchbar.h"
|
||||||
#include "gcal-year-view.h"
|
#include "gcal-year-view.h"
|
||||||
#include "gcal-month-view.h"
|
#include "gcal-month-view.h"
|
||||||
#include "gcal-week-view.h"
|
#include "gcal-week-view.h"
|
||||||
@@ -244,8 +245,6 @@ gcal_window_constructed (GObject *object)
|
|||||||
GtkWidget *embed;
|
GtkWidget *embed;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
GtkWidget *holder;
|
GtkWidget *holder;
|
||||||
GtkWidget *button;
|
|
||||||
GtkWidget *entry;
|
|
||||||
|
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
@@ -276,34 +275,7 @@ gcal_window_constructed (GObject *object)
|
|||||||
0.0));
|
0.0));
|
||||||
|
|
||||||
/* searchbar_actor */
|
/* searchbar_actor */
|
||||||
/* FIXME: demo code */
|
priv->searchbar_actor = gcal_searchbar_new ();
|
||||||
holder = gtk_grid_new ();
|
|
||||||
button = gtk_button_new_with_label (_("Done"));
|
|
||||||
gtk_widget_set_size_request (button, 100, -1);
|
|
||||||
gtk_widget_set_hexpand (button, FALSE);
|
|
||||||
gtk_widget_set_halign (button, GTK_ALIGN_START);
|
|
||||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
|
||||||
gtk_style_context_add_class (
|
|
||||||
gtk_widget_get_style_context (button),
|
|
||||||
"suggested-action");
|
|
||||||
gtk_style_context_add_class (
|
|
||||||
gtk_widget_get_style_context (button),
|
|
||||||
"toolbar-button");
|
|
||||||
|
|
||||||
entry = gtk_search_entry_new ();
|
|
||||||
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), _("Search..."));
|
|
||||||
gtk_widget_set_hexpand (entry, TRUE);
|
|
||||||
gtk_widget_set_vexpand (entry, TRUE);
|
|
||||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
|
||||||
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
|
|
||||||
gtk_widget_set_size_request (entry, 450, -1);
|
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (holder), 12);
|
|
||||||
gtk_container_add (GTK_CONTAINER (holder), button);
|
|
||||||
gtk_container_add (GTK_CONTAINER (holder), entry);
|
|
||||||
gtk_widget_show_all (holder);
|
|
||||||
|
|
||||||
priv->searchbar_actor = gtk_clutter_actor_new_with_contents (holder);
|
|
||||||
clutter_actor_add_child (stage, priv->searchbar_actor);
|
clutter_actor_add_child (stage, priv->searchbar_actor);
|
||||||
clutter_actor_set_x (priv->searchbar_actor, 0);
|
clutter_actor_set_x (priv->searchbar_actor, 0);
|
||||||
clutter_actor_add_constraint_with_name (
|
clutter_actor_add_constraint_with_name (
|
||||||
@@ -448,10 +420,6 @@ gcal_window_constructed (GObject *object)
|
|||||||
"notify::allocation",
|
"notify::allocation",
|
||||||
G_CALLBACK (gcal_window_stage_notify_cb),
|
G_CALLBACK (gcal_window_stage_notify_cb),
|
||||||
object);
|
object);
|
||||||
g_signal_connect (button,
|
|
||||||
"clicked",
|
|
||||||
G_CALLBACK (gcal_window_hide_searchbar),
|
|
||||||
object);
|
|
||||||
|
|
||||||
g_signal_connect (priv->toolbar_actor,
|
g_signal_connect (priv->toolbar_actor,
|
||||||
"view-changed",
|
"view-changed",
|
||||||
@@ -470,6 +438,11 @@ gcal_window_constructed (GObject *object)
|
|||||||
G_CALLBACK (gcal_window_bring_searchbar),
|
G_CALLBACK (gcal_window_bring_searchbar),
|
||||||
object);
|
object);
|
||||||
|
|
||||||
|
g_signal_connect (priv->searchbar_actor,
|
||||||
|
"done",
|
||||||
|
G_CALLBACK (gcal_window_hide_searchbar),
|
||||||
|
object);
|
||||||
|
|
||||||
g_signal_connect (priv->toolbar_actor,
|
g_signal_connect (priv->toolbar_actor,
|
||||||
"back",
|
"back",
|
||||||
G_CALLBACK (gcal_window_back_last_view),
|
G_CALLBACK (gcal_window_back_last_view),
|
||||||
|
|||||||
Reference in New Issue
Block a user