project: Rename GcalSearchView to GcalSearchPopover
This was never a view, but a popover.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<file alias="multi-choice.ui" compressed="true">ui/multi-choice.ui</file>
|
||||
<file alias="online-account-row.ui" compressed="true">ui/online-account-row.ui</file>
|
||||
<file alias="quick-add-popover.ui" compressed="true">ui/quick-add-popover.ui</file>
|
||||
<file alias="search-view.ui" compressed="true">ui/search-view.ui</file>
|
||||
<file alias="search-popover.ui" compressed="true">ui/search-popover.ui</file>
|
||||
<file alias="source-dialog.ui" compressed="true">ui/source-dialog.ui</file>
|
||||
<file alias="time-selector.ui" compressed="true">ui/time-selector.ui</file>
|
||||
<file alias="weather-settings.ui" compressed="true">ui/weather-settings.ui</file>
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ resource_data = files(
|
||||
'ui/month-view.ui',
|
||||
'ui/multi-choice.ui',
|
||||
'ui/quick-add-popover.ui',
|
||||
'ui/search-view.ui',
|
||||
'ui/search-popover.ui',
|
||||
'ui/source-dialog.ui',
|
||||
'ui/time-selector.ui',
|
||||
'ui/weather-settings.ui',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- Generated with glade 3.18.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<template class="GcalSearchView" parent="GtkPopover">
|
||||
<template class="GcalSearchPopover" parent="GtkPopover">
|
||||
<property name="width_request">600</property>
|
||||
<property name="height_request">300</property>
|
||||
<property name="can_focus">True</property>
|
||||
@@ -30,7 +30,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<signal name="row-activated" handler="open_event" object="GcalSearchView" swapped="no"/>
|
||||
<signal name="row-activated" handler="open_event" object="GcalSearchPopover" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
<property name="show_menubar">False</property>
|
||||
<signal name="key-press-event" handler="key_pressed" object="GcalWindow" swapped="no"/>
|
||||
<signal name="window-state-event" handler="window_state_changed" object="GcalWindow" swapped="no"/>
|
||||
<property name="active-date" bind-source="search_view" bind-property="active-date" bind-flags="default|sync-create"/>
|
||||
<property name="active-date" bind-source="search_popover" bind-property="active-date" bind-flags="default|sync-create"/>
|
||||
<style>
|
||||
<class name="org-gnome-Calendar"/>
|
||||
</style>
|
||||
@@ -300,7 +300,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
<object class="GcalSearchView" id="search_view">
|
||||
<object class="GcalSearchPopover" id="search_popover">
|
||||
<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
-2
@@ -10,7 +10,7 @@ data/ui/menus.ui
|
||||
data/ui/month-popover.ui
|
||||
data/ui/month-view.ui
|
||||
data/ui/quick-add-popover.ui
|
||||
data/ui/search-view.ui
|
||||
data/ui/search-popover.ui
|
||||
data/ui/source-dialog.ui
|
||||
data/ui/time-selector.ui
|
||||
data/ui/window.ui
|
||||
@@ -21,7 +21,7 @@ src/gcal-edit-dialog.c
|
||||
src/gcal-event-widget.c
|
||||
src/gcal-manager.c
|
||||
src/gcal-quick-add-popover.c
|
||||
src/gcal-search-view.c
|
||||
src/gcal-search-popover.c
|
||||
src/gcal-source-dialog.c
|
||||
src/gcal-time-selector.c
|
||||
src/gcal-utils.c
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* gcal-search-view.c
|
||||
/* gcal-search-popover.c
|
||||
*
|
||||
* Copyright (C) 2014 - Erick Pérez Castellanos
|
||||
* 2018 - Georges Basile Stavracas Neto
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,11 +17,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define G_LOG_DOMAIN "GcalSearchView"
|
||||
#define G_LOG_DOMAIN "GcalSearchPopover"
|
||||
|
||||
#include "gcal-debug.h"
|
||||
#include "gcal-event.h"
|
||||
#include "gcal-search-view.h"
|
||||
#include "gcal-search-popover.h"
|
||||
#include "gcal-utils.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -31,7 +32,7 @@ typedef struct
|
||||
GtkWidget *row;
|
||||
} RowEventData;
|
||||
|
||||
struct _GcalSearchView
|
||||
struct _GcalSearchPopover
|
||||
{
|
||||
GtkPopover parent;
|
||||
|
||||
@@ -79,67 +80,10 @@ static guint signals[NUM_SIGNALS] = { 0, };
|
||||
|
||||
#define NO_RESULT_TIMEOUT 250 /* ms */
|
||||
|
||||
/* callbacks */
|
||||
static void display_header_func (GtkListBoxRow *row,
|
||||
GtkListBoxRow *before,
|
||||
gpointer user_data);
|
||||
|
||||
static void open_event (GtkListBox *list,
|
||||
GtkListBoxRow *row,
|
||||
gpointer user_data);
|
||||
|
||||
static gint sort_by_event (GtkListBoxRow *row1,
|
||||
GtkListBoxRow *row2,
|
||||
gpointer user_data);
|
||||
|
||||
static gboolean show_no_results_page (GcalSearchView *view);
|
||||
|
||||
/* private */
|
||||
static void free_row_data (RowEventData *data);
|
||||
|
||||
static GtkWidget* make_row_for_event (GcalSearchView *view,
|
||||
GcalEvent *event);
|
||||
|
||||
static void update_view (GcalSearchView *view);
|
||||
|
||||
static gboolean gcal_search_view_do_search (gpointer user_data);
|
||||
|
||||
/* prefixed */
|
||||
static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface);
|
||||
|
||||
static void gcal_search_view_constructed (GObject *object);
|
||||
|
||||
static void gcal_search_view_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gcal_search_view_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gcal_search_view_finalize (GObject *object);
|
||||
|
||||
static void gcal_search_view_component_added (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
|
||||
static void gcal_search_view_component_modified (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
|
||||
static void gcal_search_view_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid);
|
||||
|
||||
static void gcal_search_view_freeze (ECalDataModelSubscriber *subscriber);
|
||||
|
||||
static void gcal_search_view_thaw (ECalDataModelSubscriber *subscriber);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GcalSearchView,
|
||||
gcal_search_view,
|
||||
G_DEFINE_TYPE_WITH_CODE (GcalSearchPopover,
|
||||
gcal_search_popover,
|
||||
GTK_TYPE_POPOVER,
|
||||
G_IMPLEMENT_INTERFACE (E_TYPE_CAL_DATA_MODEL_SUBSCRIBER,
|
||||
gcal_data_model_subscriber_interface_init));
|
||||
@@ -170,9 +114,9 @@ display_header_func (GtkListBoxRow *row,
|
||||
* open_event:
|
||||
* @list: the source #GtkListBox
|
||||
* @row: the activated #GtkListBoxRow
|
||||
* @user_data: a #GcalSearchView instance.
|
||||
* @user_data: a #GcalSearchPopover instance.
|
||||
*
|
||||
* Fire GcalSearchView::'event-activated' event
|
||||
* Fire GcalSearchPopover::'event-activated' event
|
||||
* when the @row is activated by the user.
|
||||
*
|
||||
* It is up to #GcalWindow to hear the signal,
|
||||
@@ -201,7 +145,7 @@ open_event (GtkListBox *list,
|
||||
* sort_by_event:
|
||||
* @row1: the current #GtkListBoxRow being iterated.
|
||||
* @row2: the reference #GtkListBoxRow.
|
||||
* @user_data: a #GcalSearchView instance
|
||||
* @user_data: a #GcalSearchPopover instance
|
||||
*
|
||||
* A #GtkListBoxSortFunc specialy crafted to sort
|
||||
* event rows.
|
||||
@@ -218,11 +162,11 @@ sort_by_event (GtkListBoxRow *row1,
|
||||
GtkListBoxRow *row2,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalSearchView *view;
|
||||
GcalSearchPopover *self;
|
||||
RowEventData *rd1, *rd2;
|
||||
GcalEvent *ev1, *ev2;
|
||||
|
||||
view = GCAL_SEARCH_VIEW (user_data);
|
||||
self = GCAL_SEARCH_POPOVER (user_data);
|
||||
|
||||
/* retrieve event data */
|
||||
rd1 = g_object_get_data (G_OBJECT (row1), "event-data");
|
||||
@@ -234,26 +178,26 @@ sort_by_event (GtkListBoxRow *row1,
|
||||
if (ev1 == NULL || ev2 == NULL)
|
||||
return 0;
|
||||
|
||||
return gcal_event_compare_with_current (ev1, ev2, &(view->current_utc_date));
|
||||
return gcal_event_compare_with_current (ev1, ev2, &(self->current_utc_date));
|
||||
}
|
||||
|
||||
/**
|
||||
* show_no_results_page:
|
||||
* @view: a #GcalSearchView instance.
|
||||
* @view: a #GcalSearchPopover instance.
|
||||
*
|
||||
* Callback to update the 'No results found' page.
|
||||
*
|
||||
* Returns: @G_SOURCE_REMOVE
|
||||
*/
|
||||
static gboolean
|
||||
show_no_results_page (GcalSearchView *view)
|
||||
show_no_results_page (GcalSearchPopover *self)
|
||||
{
|
||||
view->no_results_timeout_id = 0;
|
||||
self->no_results_timeout_id = 0;
|
||||
|
||||
if (view->query)
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (view->stack), view->num_results != 0 ? "results" : "no_results");
|
||||
if (self->query)
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), self->num_results != 0 ? "results" : "no_results");
|
||||
else
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (view->stack), "results");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "results");
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -281,7 +225,7 @@ free_row_data (RowEventData *data)
|
||||
|
||||
/**
|
||||
* make_row_for_event_data:
|
||||
* @view: a #GcalSearchView
|
||||
* @view: a #GcalSearchPopover
|
||||
* @data: a #GcalEventData pointer
|
||||
*
|
||||
* Creates a new #GtkListBoxRow with the event information
|
||||
@@ -290,8 +234,8 @@ free_row_data (RowEventData *data)
|
||||
* Returns: the newly created #GtkListBoxRow with the event data
|
||||
*/
|
||||
static GtkWidget*
|
||||
make_row_for_event (GcalSearchView *view,
|
||||
GcalEvent *event)
|
||||
make_row_for_event (GcalSearchPopover *self,
|
||||
GcalEvent *event)
|
||||
{
|
||||
GDateTime *local_datetime;
|
||||
GDateTime *date_start;
|
||||
@@ -347,7 +291,7 @@ make_row_for_event (GcalSearchView *view,
|
||||
/* show 'all day' instead of 00:00 */
|
||||
if (!gcal_event_get_all_day (event))
|
||||
{
|
||||
text = g_date_time_format (local_datetime, view->format_24h ? "%R" : "%r");
|
||||
text = g_date_time_format (local_datetime, self->format_24h ? "%R" : "%r");
|
||||
time_label = gtk_label_new (text);
|
||||
g_free (text);
|
||||
}
|
||||
@@ -375,7 +319,7 @@ make_row_for_event (GcalSearchView *view,
|
||||
}
|
||||
|
||||
/* lock icon */
|
||||
if (!gcal_manager_is_client_writable (view->manager, gcal_event_get_source (event)))
|
||||
if (!gcal_manager_is_client_writable (self->manager, gcal_event_get_source (event)))
|
||||
{
|
||||
GtkWidget *lock_icon;
|
||||
|
||||
@@ -400,33 +344,24 @@ make_row_for_event (GcalSearchView *view,
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* update_view:
|
||||
* @view: a #GcalSearchView instance.
|
||||
*
|
||||
* Updates the timeout for the 'No results found'
|
||||
* page.
|
||||
*
|
||||
* Returns:
|
||||
*/
|
||||
static void
|
||||
update_view (GcalSearchView *view)
|
||||
update_view (GcalSearchPopover *self)
|
||||
{
|
||||
GCAL_ENTRY;
|
||||
|
||||
if (view->no_results_timeout_id != 0)
|
||||
g_source_remove (view->no_results_timeout_id);
|
||||
if (self->no_results_timeout_id != 0)
|
||||
g_source_remove (self->no_results_timeout_id);
|
||||
|
||||
view->no_results_timeout_id = g_timeout_add (NO_RESULT_TIMEOUT,
|
||||
self->no_results_timeout_id = g_timeout_add (NO_RESULT_TIMEOUT,
|
||||
(GSourceFunc) show_no_results_page,
|
||||
view);
|
||||
self);
|
||||
|
||||
GCAL_EXIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_search_view_do_search:
|
||||
* @view: a #GcalSearchView instance.
|
||||
* gcal_search_popover_do_search:
|
||||
* @view: a #GcalSearchPopover instance.
|
||||
*
|
||||
* Called after 500ms since last typed character
|
||||
* in the search field.
|
||||
@@ -434,20 +369,20 @@ update_view (GcalSearchView *view)
|
||||
* Returns: @G_SOURCE_REMOVE
|
||||
*/
|
||||
static gboolean
|
||||
gcal_search_view_do_search (gpointer user_data)
|
||||
gcal_search_popover_do_search (gpointer user_data)
|
||||
{
|
||||
GcalSearchView *view;
|
||||
GcalSearchPopover *self;
|
||||
gchar *search_query;
|
||||
|
||||
GCAL_ENTRY;
|
||||
|
||||
view = GCAL_SEARCH_VIEW (user_data);
|
||||
self = GCAL_SEARCH_POPOVER (user_data);
|
||||
|
||||
search_query = g_strdup_printf ("(contains? \"%s\" \"%s\")",
|
||||
view->field ? view->field : "summary",
|
||||
view->query ? view->query : "");
|
||||
self->field ? self->field : "summary",
|
||||
self->query ? self->query : "");
|
||||
|
||||
if (!view->subscribed)
|
||||
if (!self->subscribed)
|
||||
{
|
||||
g_autoptr (GDateTime) now, start, end;
|
||||
|
||||
@@ -455,106 +390,170 @@ gcal_search_view_do_search (gpointer user_data)
|
||||
start = g_date_time_add_years (now, -5);
|
||||
end = g_date_time_add_years (now, 5);
|
||||
|
||||
gcal_manager_set_search_subscriber (view->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view),
|
||||
gcal_manager_set_search_subscriber (self->manager,
|
||||
E_CAL_DATA_MODEL_SUBSCRIBER (self),
|
||||
g_date_time_to_unix (start),
|
||||
g_date_time_to_unix (end));
|
||||
|
||||
/* Mark the view as subscribed */
|
||||
view->subscribed = TRUE;
|
||||
self->subscribed = TRUE;
|
||||
}
|
||||
|
||||
/* update internal current time_t */
|
||||
view->current_utc_date = time (NULL);
|
||||
self->current_utc_date = time (NULL);
|
||||
|
||||
gcal_manager_set_query (view->manager, search_query);
|
||||
gcal_manager_set_query (self->manager, search_query);
|
||||
|
||||
view->search_timeout_id = 0;
|
||||
self->search_timeout_id = 0;
|
||||
g_free (search_query);
|
||||
|
||||
GCAL_RETURN (G_SOURCE_REMOVE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ECalDataModelSubscriber iface
|
||||
*/
|
||||
|
||||
static void
|
||||
gcal_search_view_class_init (GcalSearchViewClass *klass)
|
||||
gcal_search_popover_component_added (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GcalSearchPopover *self;
|
||||
RowEventData *row_data;
|
||||
GcalEvent *event;
|
||||
GError *error;
|
||||
gchar *uid;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class->constructed = gcal_search_view_constructed;
|
||||
object_class->set_property = gcal_search_view_set_property;
|
||||
object_class->get_property = gcal_search_view_get_property;
|
||||
object_class->finalize = gcal_search_view_finalize;
|
||||
self = GCAL_SEARCH_POPOVER (subscriber);
|
||||
error = NULL;
|
||||
|
||||
/* signals */
|
||||
/**
|
||||
* GcalSearchView::event-activated:
|
||||
* @view: the #GcalSearchView that generated the signal
|
||||
* @date: the date of the selected event
|
||||
*
|
||||
* Emitted when an event is selected from the list.
|
||||
*
|
||||
*/
|
||||
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated", GCAL_TYPE_SEARCH_VIEW, G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, ICAL_TIME_TYPE);
|
||||
/* event */
|
||||
event = gcal_event_new (e_client_get_source (E_CLIENT (client)), comp, &error);
|
||||
|
||||
/* properties */
|
||||
/**
|
||||
* GcalSearchView::active-date:
|
||||
*
|
||||
* The date from this view, as defined by #GcalWindow.
|
||||
* Actually it is not used.
|
||||
*
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_DATE,
|
||||
g_param_spec_boxed ("active-date",
|
||||
"The active date",
|
||||
"The active/selected date in the view",
|
||||
ICAL_TIME_TYPE, G_PARAM_READWRITE));
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Error creating event: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
/* bind things for/from the template class */
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/search-view.ui");
|
||||
/* insert row_data at the hash of events */
|
||||
row_data = g_new0 (RowEventData, 1);
|
||||
row_data->event = event;
|
||||
row_data->row = make_row_for_event (GCAL_SEARCH_POPOVER (subscriber), event);
|
||||
g_signal_connect (row_data->row, "destroy", G_CALLBACK (gtk_widget_destroyed), &(row_data->row));
|
||||
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalSearchView, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalSearchView, listbox);
|
||||
/* Add to the hash table */
|
||||
uid = g_strdup (gcal_event_get_uid (event));
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), open_event);
|
||||
g_object_set_data (G_OBJECT (row_data->row), "event-data", row_data);
|
||||
g_hash_table_insert (self->uuid_to_event, uid, row_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (self->listbox), row_data->row);
|
||||
|
||||
/* show 'no results' */
|
||||
self->num_results++;
|
||||
|
||||
update_view (GCAL_SEARCH_POPOVER (subscriber));
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_init (GcalSearchView *self)
|
||||
gcal_search_popover_component_modified (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_popover_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid)
|
||||
{
|
||||
GcalSearchPopover *self;
|
||||
RowEventData *row_data;
|
||||
ESource *source;
|
||||
gchar *uuid;
|
||||
|
||||
self = GCAL_SEARCH_POPOVER (subscriber);
|
||||
|
||||
/* if the widget has recurrency, it's UUID is different */
|
||||
source = e_client_get_source (E_CLIENT (client));
|
||||
|
||||
if (rid != NULL)
|
||||
uuid = g_strdup_printf ("%s:%s:%s", e_source_get_uid (source), uid, rid);
|
||||
else
|
||||
uuid = g_strdup_printf ("%s:%s", e_source_get_uid (source), uid);
|
||||
|
||||
/* Lookup the RowEventData */
|
||||
row_data = g_hash_table_lookup (self->uuid_to_event, uuid);
|
||||
|
||||
/* We didn't add this event, so there's nothing to do */
|
||||
if (!row_data)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Removing the given RowEventData entry will call free_row_data(),
|
||||
* which removes the row from the listbox and also frees the hashtable's
|
||||
* uuid.
|
||||
*/
|
||||
g_hash_table_remove (self->uuid_to_event, uuid);
|
||||
|
||||
/* show 'no results' */
|
||||
self->num_results--;
|
||||
|
||||
update_view (GCAL_SEARCH_POPOVER (subscriber));
|
||||
|
||||
out:
|
||||
g_free (uuid);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_popover_freeze (ECalDataModelSubscriber *subscriber)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_popover_thaw (ECalDataModelSubscriber *subscriber)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface)
|
||||
{
|
||||
iface->component_added = gcal_search_view_component_added;
|
||||
iface->component_modified = gcal_search_view_component_modified;
|
||||
iface->component_removed = gcal_search_view_component_removed;
|
||||
iface->freeze = gcal_search_view_freeze;
|
||||
iface->thaw = gcal_search_view_thaw;
|
||||
iface->component_added = gcal_search_popover_component_added;
|
||||
iface->component_modified = gcal_search_popover_component_modified;
|
||||
iface->component_removed = gcal_search_popover_component_removed;
|
||||
iface->freeze = gcal_search_popover_freeze;
|
||||
iface->thaw = gcal_search_popover_thaw;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GObject overrides
|
||||
*/
|
||||
|
||||
static void
|
||||
gcal_search_view_constructed (GObject *object)
|
||||
gcal_search_popover_constructed (GObject *object)
|
||||
{
|
||||
GcalSearchView *view;
|
||||
GcalSearchPopover *self;
|
||||
GtkWidget *placeholder_label;
|
||||
|
||||
view = GCAL_SEARCH_VIEW (object);
|
||||
self = GCAL_SEARCH_POPOVER (object);
|
||||
|
||||
/* make the listbox sorted */
|
||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (view->listbox), (GtkListBoxSortFunc) sort_by_event, object, NULL);
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (view->listbox), display_header_func, NULL, NULL);
|
||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->listbox), (GtkListBoxSortFunc) sort_by_event, object, NULL);
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (self->listbox), display_header_func, NULL, NULL);
|
||||
|
||||
/* gchar* -> RowEventData* */
|
||||
view->uuid_to_event = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) free_row_data);
|
||||
self->uuid_to_event = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) free_row_data);
|
||||
|
||||
/* don't fill the list with all events on startup */
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (object), NULL, NULL);
|
||||
gcal_search_popover_search (GCAL_SEARCH_POPOVER (object), NULL, NULL);
|
||||
|
||||
/* "type to search" label */
|
||||
placeholder_label = g_object_new (GTK_TYPE_LABEL,
|
||||
@@ -566,16 +565,16 @@ gcal_search_view_constructed (GObject *object)
|
||||
NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (placeholder_label), "dim-label");
|
||||
|
||||
gtk_list_box_set_placeholder (GTK_LIST_BOX (view->listbox), placeholder_label);
|
||||
gtk_list_box_set_placeholder (GTK_LIST_BOX (self->listbox), placeholder_label);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gcal_search_popover_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GcalSearchView *self = GCAL_SEARCH_VIEW (object);
|
||||
GcalSearchPopover *self = GCAL_SEARCH_POPOVER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
@@ -592,12 +591,12 @@ gcal_search_view_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gcal_search_popover_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GcalSearchView *self = GCAL_SEARCH_VIEW (object);
|
||||
GcalSearchPopover *self = GCAL_SEARCH_POPOVER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
@@ -611,129 +610,75 @@ gcal_search_view_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_finalize (GObject *object)
|
||||
gcal_search_popover_finalize (GObject *object)
|
||||
{
|
||||
GcalSearchView *self = GCAL_SEARCH_VIEW (object);
|
||||
GcalSearchPopover *self = GCAL_SEARCH_POPOVER (object);
|
||||
|
||||
g_clear_pointer (&self->date, g_free);
|
||||
g_clear_pointer (&self->uuid_to_event, g_hash_table_unref);
|
||||
|
||||
/* Chain up to parent's finalize() method. */
|
||||
G_OBJECT_CLASS (gcal_search_view_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gcal_search_popover_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/* ECalDataModelSubscriber interface API */
|
||||
static void
|
||||
gcal_search_view_component_added (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
{
|
||||
GcalSearchView *view;
|
||||
|
||||
RowEventData *row_data;
|
||||
GcalEvent *event;
|
||||
GError *error;
|
||||
gchar *uid;
|
||||
|
||||
view = GCAL_SEARCH_VIEW (subscriber);
|
||||
error = NULL;
|
||||
|
||||
/* event */
|
||||
event = gcal_event_new (e_client_get_source (E_CLIENT (client)), comp, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Error creating event: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
/* insert row_data at the hash of events */
|
||||
row_data = g_new0 (RowEventData, 1);
|
||||
row_data->event = event;
|
||||
row_data->row = make_row_for_event (GCAL_SEARCH_VIEW (subscriber), event);
|
||||
g_signal_connect (row_data->row, "destroy", G_CALLBACK (gtk_widget_destroyed), &(row_data->row));
|
||||
|
||||
/* Add to the hash table */
|
||||
uid = g_strdup (gcal_event_get_uid (event));
|
||||
|
||||
g_object_set_data (G_OBJECT (row_data->row), "event-data", row_data);
|
||||
g_hash_table_insert (view->uuid_to_event, uid, row_data);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (view->listbox), row_data->row);
|
||||
|
||||
/* show 'no results' */
|
||||
view->num_results++;
|
||||
|
||||
update_view (GCAL_SEARCH_VIEW (subscriber));
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_component_modified (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
gcal_search_popover_class_init (GcalSearchPopoverClass *klass)
|
||||
{
|
||||
;
|
||||
}
|
||||
GObjectClass *object_class;
|
||||
|
||||
static void
|
||||
gcal_search_view_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid)
|
||||
{
|
||||
GcalSearchView *view;
|
||||
ESource *source;
|
||||
RowEventData *row_data;
|
||||
gchar *uuid;
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class->constructed = gcal_search_popover_constructed;
|
||||
object_class->set_property = gcal_search_popover_set_property;
|
||||
object_class->get_property = gcal_search_popover_get_property;
|
||||
object_class->finalize = gcal_search_popover_finalize;
|
||||
|
||||
view = GCAL_SEARCH_VIEW (subscriber);
|
||||
|
||||
/* if the widget has recurrency, it's UUID is different */
|
||||
source = e_client_get_source (E_CLIENT (client));
|
||||
|
||||
if (rid != NULL)
|
||||
uuid = g_strdup_printf ("%s:%s:%s", e_source_get_uid (source), uid, rid);
|
||||
else
|
||||
uuid = g_strdup_printf ("%s:%s", e_source_get_uid (source), uid);
|
||||
|
||||
/* Lookup the RowEventData */
|
||||
row_data = g_hash_table_lookup (view->uuid_to_event, uuid);
|
||||
|
||||
/* We didn't add this event, so there's nothing to do */
|
||||
if (!row_data)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Removing the given RowEventData entry will call free_row_data(),
|
||||
* which removes the row from the listbox and also frees the hashtable's
|
||||
* uuid.
|
||||
/* signals */
|
||||
/**
|
||||
* GcalSearchPopover::event-activated:
|
||||
* @view: the #GcalSearchPopover that generated the signal
|
||||
* @date: the date of the selected event
|
||||
*
|
||||
* Emitted when an event is selected from the list.
|
||||
*
|
||||
*/
|
||||
g_hash_table_remove (view->uuid_to_event, uuid);
|
||||
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated", GCAL_TYPE_SEARCH_POPOVER, G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, ICAL_TIME_TYPE);
|
||||
|
||||
/* show 'no results' */
|
||||
view->num_results--;
|
||||
/* properties */
|
||||
/**
|
||||
* GcalSearchPopover::active-date:
|
||||
*
|
||||
* The date from this view, as defined by #GcalWindow.
|
||||
* Actually it is not used.
|
||||
*
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_DATE,
|
||||
g_param_spec_boxed ("active-date",
|
||||
"The active date",
|
||||
"The active/selected date in the view",
|
||||
ICAL_TIME_TYPE, G_PARAM_READWRITE));
|
||||
|
||||
update_view (GCAL_SEARCH_VIEW (subscriber));
|
||||
/* bind things for/from the template class */
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/search-popover.ui");
|
||||
|
||||
out:
|
||||
g_free (uuid);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalSearchPopover, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalSearchPopover, listbox);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), open_event);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_freeze (ECalDataModelSubscriber *subscriber)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_search_view_thaw (ECalDataModelSubscriber *subscriber)
|
||||
gcal_search_popover_init (GcalSearchPopover *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
/**
|
||||
* gcal_search_view_new:
|
||||
* gcal_search_popover_new:
|
||||
*
|
||||
* Since: 0.1
|
||||
* Create a new month view widget
|
||||
@@ -741,30 +686,30 @@ gcal_search_view_thaw (ECalDataModelSubscriber *subscriber)
|
||||
* Returns: (transfer full):
|
||||
**/
|
||||
GtkWidget*
|
||||
gcal_search_view_new (void)
|
||||
gcal_search_popover_new (void)
|
||||
{
|
||||
return g_object_new (GCAL_TYPE_SEARCH_VIEW, NULL);
|
||||
return g_object_new (GCAL_TYPE_SEARCH_POPOVER, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_search_view_connect:
|
||||
* @search_view: a #GcalSearchView instance
|
||||
* gcal_search_popover_connect:
|
||||
* @search_popover: a #GcalSearchPopover instance
|
||||
* @manager: App singleton #GcalManager instance
|
||||
*
|
||||
* Connect the view to the App singleton manager instance.
|
||||
* This is designed to be called once, after create of the view and before any use.
|
||||
*/
|
||||
void
|
||||
gcal_search_view_connect (GcalSearchView *search_view,
|
||||
GcalManager *manager)
|
||||
gcal_search_popover_connect (GcalSearchPopover *search_popover,
|
||||
GcalManager *manager)
|
||||
{
|
||||
if (manager != NULL && manager != search_view->manager)
|
||||
search_view->manager = manager;
|
||||
if (manager != NULL && manager != search_popover->manager)
|
||||
search_popover->manager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_search_view_set_time_format:
|
||||
* @view: a #GcalSearchView instance.
|
||||
* gcal_search_popover_set_time_format:
|
||||
* @view: a #GcalSearchPopover instance.
|
||||
* @format_24h: whether is 24h or not.
|
||||
*
|
||||
* Setup time format, instead of accessing DConf
|
||||
@@ -772,16 +717,16 @@ gcal_search_view_connect (GcalSearchView *search_view,
|
||||
*
|
||||
*/
|
||||
void
|
||||
gcal_search_view_set_time_format (GcalSearchView *view,
|
||||
gboolean format_24h)
|
||||
gcal_search_popover_set_time_format (GcalSearchPopover *self,
|
||||
gboolean format_24h)
|
||||
{
|
||||
view->format_24h = format_24h;
|
||||
self->format_24h = format_24h;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gcal_search_view_set_search:
|
||||
* @view: a #GcalSearchView instance
|
||||
* gcal_search_popover_set_search:
|
||||
* @view: a #GcalSearchPopover instance
|
||||
* @field: the field to perform the search.
|
||||
* @query: what the search will look for.
|
||||
*
|
||||
@@ -790,32 +735,32 @@ gcal_search_view_set_time_format (GcalSearchView *view,
|
||||
* Returns:
|
||||
*/
|
||||
void
|
||||
gcal_search_view_search (GcalSearchView *view,
|
||||
const gchar *field,
|
||||
const gchar *query)
|
||||
gcal_search_popover_search (GcalSearchPopover *self,
|
||||
const gchar *field,
|
||||
const gchar *query)
|
||||
{
|
||||
GCAL_ENTRY;
|
||||
|
||||
g_clear_pointer (&view->query, g_free);
|
||||
g_clear_pointer (&view->field, g_free);
|
||||
g_clear_pointer (&self->query, g_free);
|
||||
g_clear_pointer (&self->field, g_free);
|
||||
|
||||
if (view->search_timeout_id != 0)
|
||||
g_source_remove (view->search_timeout_id);
|
||||
if (self->search_timeout_id != 0)
|
||||
g_source_remove (self->search_timeout_id);
|
||||
|
||||
/* Only perform search on valid non-empty strings */
|
||||
if (query && g_utf8_strlen (query, -1) >= 3)
|
||||
{
|
||||
view->query = g_strdup (query);
|
||||
view->field = g_strdup (field);
|
||||
view->search_timeout_id = g_timeout_add (500, gcal_search_view_do_search, view);
|
||||
self->query = g_strdup (query);
|
||||
self->field = g_strdup (field);
|
||||
self->search_timeout_id = g_timeout_add (500, gcal_search_popover_do_search, self);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_hash_table_remove_all (view->uuid_to_event);
|
||||
view->num_results = 0;
|
||||
g_hash_table_remove_all (self->uuid_to_event);
|
||||
self->num_results = 0;
|
||||
}
|
||||
|
||||
update_view (view);
|
||||
update_view (self);
|
||||
|
||||
GCAL_EXIT;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/* gcal-search-popover.h
|
||||
*
|
||||
* Copyright (C) 2014 - Erick Pérez Castellanos
|
||||
* 2018 - Georges Basile Stavracas Neto
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gcal-event-widget.h"
|
||||
#include "gcal-manager.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_SEARCH_POPOVER (gcal_search_popover_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GcalSearchPopover, gcal_search_popover, GCAL, SEARCH_POPOVER, GtkPopover)
|
||||
|
||||
void gcal_search_popover_set_time_format (GcalSearchPopover *self,
|
||||
gboolean format_24h);
|
||||
|
||||
void gcal_search_popover_search (GcalSearchPopover *self,
|
||||
const gchar *field,
|
||||
const gchar *query);
|
||||
|
||||
void gcal_search_popover_connect (GcalSearchPopover *self,
|
||||
GcalManager *manager);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,48 +0,0 @@
|
||||
/* gcal-search-view.h
|
||||
*
|
||||
* Copyright (C) 2014 - Erick Pérez Castellanos
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GCAL_SEARCH_VIEW_H__
|
||||
#define __GCAL_SEARCH_VIEW_H__
|
||||
|
||||
#include "gcal-event-widget.h"
|
||||
#include "gcal-manager.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_SEARCH_VIEW (gcal_search_view_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GcalSearchView, gcal_search_view, GCAL, SEARCH_VIEW, GtkPopover)
|
||||
|
||||
void gcal_search_view_set_time_format (GcalSearchView *view,
|
||||
gboolean format_24h);
|
||||
|
||||
void gcal_search_view_search (GcalSearchView *view,
|
||||
const gchar *field,
|
||||
const gchar *query);
|
||||
|
||||
GtkWidget* gcal_search_view_new (void);
|
||||
|
||||
void gcal_search_view_connect (GcalSearchView *search_view,
|
||||
GcalManager *manager);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GCAL_SEARCH_VIEW_H__ */
|
||||
+16
-15
@@ -26,7 +26,7 @@
|
||||
#include "gcal-manager.h"
|
||||
#include "gcal-month-view.h"
|
||||
#include "gcal-quick-add-popover.h"
|
||||
#include "gcal-search-view.h"
|
||||
#include "gcal-search-popover.h"
|
||||
#include "gcal-source-dialog.h"
|
||||
#include "gcal-view.h"
|
||||
#include "gcal-weather-settings.h"
|
||||
@@ -132,7 +132,7 @@ struct _GcalWindow
|
||||
/* new event popover widgets */
|
||||
GtkWidget *quick_add_popover;
|
||||
|
||||
GtkWidget *search_view;
|
||||
GtkWidget *search_popover;
|
||||
|
||||
/* day, week, month, year, list */
|
||||
GtkWidget *views [6];
|
||||
@@ -498,9 +498,9 @@ key_pressed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
search_event_selected (GcalSearchView *search_view,
|
||||
icaltimetype *date,
|
||||
gpointer user_data)
|
||||
search_event_selected (GcalSearchPopover *search_view,
|
||||
icaltimetype *date,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_object_set (user_data, "active-date", date, NULL);
|
||||
gcal_window_set_search_mode (GCAL_WINDOW (user_data), FALSE);
|
||||
@@ -1114,13 +1114,13 @@ search_toggled (GObject *object,
|
||||
/* update header_bar widget */
|
||||
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (window->search_bar)))
|
||||
{
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (window->search_view), NULL, NULL);
|
||||
gcal_search_popover_search (GCAL_SEARCH_POPOVER (window->search_popover), NULL, NULL);
|
||||
|
||||
/* When the search button is toogled we connect the signal */
|
||||
window->click_outside_handler_id = g_signal_connect (window,
|
||||
"button-press-event",
|
||||
G_CALLBACK (hide_search_view_on_click_outside),
|
||||
window->search_view);
|
||||
window->search_popover);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1145,13 +1145,14 @@ search_changed (GtkEditable *editable,
|
||||
|
||||
if (search_length)
|
||||
{
|
||||
gtk_popover_popup (GTK_POPOVER (window->search_view));
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (window->search_view),
|
||||
"summary", gtk_entry_get_text (GTK_ENTRY (window->search_entry)));
|
||||
gtk_popover_popup (GTK_POPOVER (window->search_popover));
|
||||
gcal_search_popover_search (GCAL_SEARCH_POPOVER (window->search_popover),
|
||||
"summary",
|
||||
gtk_entry_get_text (GTK_ENTRY (window->search_entry)));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_popover_popdown (GTK_POPOVER (window->search_view));
|
||||
gtk_popover_popdown (GTK_POPOVER (window->search_popover));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1334,7 +1335,7 @@ gcal_window_set_property (GObject *object,
|
||||
g_signal_connect_swapped (self->manager, "source-enabled", G_CALLBACK (source_enabled), object);
|
||||
g_signal_connect_swapped (self->manager, "source-changed", G_CALLBACK (source_changed), object);
|
||||
|
||||
gcal_search_view_connect (GCAL_SEARCH_VIEW (self->search_view), self->manager);
|
||||
gcal_search_popover_connect (GCAL_SEARCH_POPOVER (self->search_popover), self->manager);
|
||||
|
||||
g_object_notify_by_pspec (object, properties[PROP_MANAGER]);
|
||||
}
|
||||
@@ -1419,7 +1420,7 @@ gcal_window_class_init (GcalWindowClass *klass)
|
||||
g_type_ensure (GCAL_TYPE_MANAGER);
|
||||
g_type_ensure (GCAL_TYPE_MONTH_VIEW);
|
||||
g_type_ensure (GCAL_TYPE_QUICK_ADD_POPOVER);
|
||||
g_type_ensure (GCAL_TYPE_SEARCH_VIEW);
|
||||
g_type_ensure (GCAL_TYPE_SEARCH_POPOVER);
|
||||
g_type_ensure (GCAL_TYPE_SOURCE_DIALOG);
|
||||
g_type_ensure (GCAL_TYPE_WEATHER_SERVICE);
|
||||
g_type_ensure (GCAL_TYPE_WEATHER_SETTINGS);
|
||||
@@ -1487,7 +1488,7 @@ gcal_window_class_init (GcalWindowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, source_dialog);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_popover);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, today_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_overlay);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_stack);
|
||||
@@ -1579,7 +1580,7 @@ gcal_window_init (GcalWindow *self)
|
||||
gcal_year_view_set_use_24h_format (GCAL_YEAR_VIEW (self->views[GCAL_WINDOW_VIEW_YEAR]), use_24h_format);
|
||||
|
||||
/* search view */
|
||||
gcal_search_view_set_time_format (GCAL_SEARCH_VIEW (self->search_view), use_24h_format);
|
||||
gcal_search_popover_set_time_format (GCAL_SEARCH_POPOVER (self->search_popover), use_24h_format);
|
||||
|
||||
/* refresh timeout, first is fast */
|
||||
self->refresh_timeout_id = g_timeout_add (FAST_REFRESH_TIMEOUT, (GSourceFunc) refresh_sources, self);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ sources = files(
|
||||
'gcal-multi-choice.c',
|
||||
'gcal-quick-add-popover.c',
|
||||
'gcal-recurrence.c',
|
||||
'gcal-search-view.c',
|
||||
'gcal-search-popover.c',
|
||||
'gcal-shell-search-provider.c',
|
||||
'gcal-source-dialog.c',
|
||||
'gcal-time-selector.c',
|
||||
|
||||
Reference in New Issue
Block a user