window: propagate manager using properties
This commit is contained in:
@@ -726,8 +726,6 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
|
|||||||
object_class->get_property = gcal_edit_dialog_get_property;
|
object_class->get_property = gcal_edit_dialog_get_property;
|
||||||
object_class->set_property = gcal_edit_dialog_set_property;
|
object_class->set_property = gcal_edit_dialog_set_property;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/edit-dialog.ui");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GcalEditDialog::event:
|
* GcalEditDialog::event:
|
||||||
*
|
*
|
||||||
@@ -767,6 +765,8 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/edit-dialog.ui");
|
||||||
|
|
||||||
/* Alarms */
|
/* Alarms */
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, five_minutes_button);
|
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, five_minutes_button);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, ten_minutes_button);
|
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, ten_minutes_button);
|
||||||
|
|||||||
@@ -777,7 +777,28 @@ gcal_quick_add_popover_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MANAGER:
|
case PROP_MANAGER:
|
||||||
gcal_quick_add_popover_set_manager (self, g_value_get_object (value));
|
if (g_set_object (&self->manager, g_value_get_object (value)))
|
||||||
|
{
|
||||||
|
GcalManager *manager;
|
||||||
|
GList *sources, *l;
|
||||||
|
|
||||||
|
/* Add currently leaded sources */
|
||||||
|
manager = self->manager;
|
||||||
|
sources = gcal_manager_get_sources_connected (manager);
|
||||||
|
|
||||||
|
for (l = sources; l != NULL; l = g_list_next (l))
|
||||||
|
on_source_added (manager, l->data, gcal_manager_is_client_writable (manager, l->data), self);
|
||||||
|
|
||||||
|
g_list_free (sources);
|
||||||
|
|
||||||
|
/* Connect to the manager signals and keep the list updates */
|
||||||
|
g_signal_connect (manager, "source-added", G_CALLBACK (on_source_added), self);
|
||||||
|
g_signal_connect (manager, "source-changed", G_CALLBACK (on_source_changed), self);
|
||||||
|
g_signal_connect (manager, "source-removed", G_CALLBACK (on_source_removed), self);
|
||||||
|
g_signal_connect_swapped (manager, "notify::default-calendar", G_CALLBACK (update_default_calendar_row), self);
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (self), "manager");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -903,41 +924,6 @@ gcal_quick_add_popover_new (void)
|
|||||||
return g_object_new (GCAL_TYPE_QUICK_ADD_POPOVER, NULL);
|
return g_object_new (GCAL_TYPE_QUICK_ADD_POPOVER, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gcal_quick_add_popover_set_manager:
|
|
||||||
* @self: a #GcalQuickAddPopover
|
|
||||||
* @manager: a #GcalManager
|
|
||||||
*
|
|
||||||
* Sets the manager of the popover.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gcal_quick_add_popover_set_manager (GcalQuickAddPopover *self,
|
|
||||||
GcalManager *manager)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GCAL_IS_QUICK_ADD_POPOVER (self));
|
|
||||||
|
|
||||||
if (g_set_object (&self->manager, manager))
|
|
||||||
{
|
|
||||||
GList *sources, *l;
|
|
||||||
|
|
||||||
/* Add currently leaded sources */
|
|
||||||
sources = gcal_manager_get_sources_connected (manager);
|
|
||||||
|
|
||||||
for (l = sources; l != NULL; l = g_list_next (l))
|
|
||||||
on_source_added (manager, l->data, gcal_manager_is_client_writable (manager, l->data), self);
|
|
||||||
|
|
||||||
g_list_free (sources);
|
|
||||||
|
|
||||||
/* Connect to the manager signals and keep the list updates */
|
|
||||||
g_signal_connect (manager, "source-added", G_CALLBACK (on_source_added), self);
|
|
||||||
g_signal_connect (manager, "source-changed", G_CALLBACK (on_source_changed), self);
|
|
||||||
g_signal_connect (manager, "source-removed", G_CALLBACK (on_source_removed), self);
|
|
||||||
g_signal_connect_swapped (manager, "notify::default-calendar", G_CALLBACK (update_default_calendar_row), self);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "manager");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gcal_quick_add_popover_get_date_start:
|
* gcal_quick_add_popover_get_date_start:
|
||||||
* @self: a #GcalQuickAddPopover
|
* @self: a #GcalQuickAddPopover
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ G_DECLARE_FINAL_TYPE (GcalQuickAddPopover, gcal_quick_add_popover, GCAL, QUICK_A
|
|||||||
|
|
||||||
GtkWidget* gcal_quick_add_popover_new (void);
|
GtkWidget* gcal_quick_add_popover_new (void);
|
||||||
|
|
||||||
void gcal_quick_add_popover_set_manager (GcalQuickAddPopover *self,
|
|
||||||
GcalManager *manager);
|
|
||||||
|
|
||||||
GDateTime* gcal_quick_add_popover_get_date_start (GcalQuickAddPopover *self);
|
GDateTime* gcal_quick_add_popover_get_date_start (GcalQuickAddPopover *self);
|
||||||
|
|
||||||
void gcal_quick_add_popover_set_date_start (GcalQuickAddPopover *self,
|
void gcal_quick_add_popover_set_date_start (GcalQuickAddPopover *self,
|
||||||
|
|||||||
+225
-184
@@ -242,6 +242,15 @@ static void discover_sources_cb (GObject *so
|
|||||||
|
|
||||||
G_DEFINE_TYPE (GcalSourceDialog, gcal_source_dialog, GTK_TYPE_DIALOG)
|
G_DEFINE_TYPE (GcalSourceDialog, gcal_source_dialog, GTK_TYPE_DIALOG)
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_MANAGER,
|
||||||
|
N_PROPS
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||||
|
|
||||||
GActionEntry actions[] = {
|
GActionEntry actions[] = {
|
||||||
{"file", on_file_activated, NULL, NULL, NULL},
|
{"file", on_file_activated, NULL, NULL, NULL},
|
||||||
{"local", on_local_activated, NULL, NULL, NULL},
|
{"local", on_local_activated, NULL, NULL, NULL},
|
||||||
@@ -1766,142 +1775,9 @@ remove_button_clicked (GtkWidget *button,
|
|||||||
gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
|
gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
/*
|
||||||
gcal_source_dialog_new (void)
|
* Callbacks
|
||||||
{
|
*/
|
||||||
return g_object_new (GCAL_TYPE_SOURCE_DIALOG, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gcal_source_dialog_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
GcalSourceDialog *self;
|
|
||||||
GtkBuilder *builder;
|
|
||||||
GMenuModel *menu;
|
|
||||||
|
|
||||||
self = GCAL_SOURCE_DIALOG (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gcal_source_dialog_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
/* widget responses */
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (object), GTK_RESPONSE_CANCEL);
|
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (self->remove_button), "response", GINT_TO_POINTER (GCAL_RESPONSE_REMOVE_SOURCE));
|
|
||||||
|
|
||||||
/* Setup listbox header functions */
|
|
||||||
gtk_list_box_set_header_func (GTK_LIST_BOX (self->calendars_listbox), display_header_func, NULL, NULL);
|
|
||||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->calendars_listbox), (GtkListBoxSortFunc) calendar_listbox_sort_func,
|
|
||||||
object, NULL);
|
|
||||||
|
|
||||||
gtk_list_box_set_header_func (GTK_LIST_BOX (self->online_accounts_listbox), display_header_func, NULL, NULL);
|
|
||||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->online_accounts_listbox), (GtkListBoxSortFunc) online_accounts_listbox_sort_func,
|
|
||||||
object, NULL);
|
|
||||||
|
|
||||||
/* Action group */
|
|
||||||
self->action_group = g_simple_action_group_new ();
|
|
||||||
gtk_widget_insert_action_group (GTK_WIDGET (object), "source", G_ACTION_GROUP (self->action_group));
|
|
||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (self->action_group), actions, G_N_ELEMENTS (actions), object);
|
|
||||||
|
|
||||||
/* Load the "Add" button menu */
|
|
||||||
builder = gtk_builder_new_from_resource ("/org/gnome/calendar/gtk/menus.ui");
|
|
||||||
|
|
||||||
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "add-source-menu"));
|
|
||||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->add_calendar_menu_button), menu);
|
|
||||||
|
|
||||||
g_object_unref (builder);
|
|
||||||
|
|
||||||
/* setup titlebar */
|
|
||||||
gtk_window_set_titlebar (GTK_WINDOW (object), self->headerbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class;
|
|
||||||
GtkWidgetClass *widget_class;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Since we cannot guarantee that the
|
|
||||||
* type system registered ESourceLocal,
|
|
||||||
* it must be ensured at least here.
|
|
||||||
*/
|
|
||||||
g_type_ensure (E_TYPE_SOURCE_LOCAL);
|
|
||||||
|
|
||||||
object_class = G_OBJECT_CLASS (klass);
|
|
||||||
object_class->constructed = gcal_source_dialog_constructed;
|
|
||||||
|
|
||||||
widget_class = GTK_WIDGET_CLASS (klass);
|
|
||||||
|
|
||||||
/* bind things for/from the template class */
|
|
||||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/source-dialog.ui");
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, account_box);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, account_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, add_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, add_calendar_menu_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, back_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_address_entry);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_color_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_url_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_visible_check);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendars_listbox);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, cancel_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_cancel_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_connect_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_dialog);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_password_entry);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_user_entry);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, default_check);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, edit_grid);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, exchange_stub_row);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, google_stub_row);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, headerbar);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, location_dim_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, main_scrolledwindow);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, name_entry);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, notification);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, notification_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, online_accounts_listbox);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, owncloud_stub_row);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, remove_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, settings_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, stack);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_source_grid);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_sources_listbox);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_sources_revealer);
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, add_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, back_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, calendar_address_activated);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, calendar_file_selected);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, calendar_listbox_row_activated);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, calendar_visible_check_toggled);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, cancel_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, credential_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, credential_entry_activate);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, color_set);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, default_check_toggled);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, hide_notification);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, notification_child_revealed_changed);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, online_accounts_listbox_row_activated);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, online_accounts_settings_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, remove_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, response_signal);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, settings_button_clicked);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_name_changed);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, undo_remove_action);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gcal_source_dialog_init (GcalSourceDialog *self)
|
|
||||||
{
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static GcalAccountType
|
static GcalAccountType
|
||||||
get_account_type (GoaAccount *account)
|
get_account_type (GoaAccount *account)
|
||||||
@@ -1920,27 +1796,6 @@ get_account_type (GoaAccount *account)
|
|||||||
return GCAL_ACCOUNT_TYPE_NOT_SUPPORTED;
|
return GCAL_ACCOUNT_TYPE_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
|
||||||
online_accounts_listbox_sort_func (GtkListBoxRow *row1,
|
|
||||||
GtkListBoxRow *row2,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GcalAccountType t1, t2;
|
|
||||||
GoaAccount *a1 = g_object_get_data (G_OBJECT (row1), "goa-account");
|
|
||||||
GoaAccount *a2 = g_object_get_data (G_OBJECT (row2), "goa-account");
|
|
||||||
|
|
||||||
if (!a1 || !a2)
|
|
||||||
return a1 ? -1 : (a2 ? 1 : 0);
|
|
||||||
|
|
||||||
t1 = get_account_type (a1);
|
|
||||||
t2 = get_account_type (a2);
|
|
||||||
|
|
||||||
if (t1 != t2)
|
|
||||||
return t1 - t2;
|
|
||||||
|
|
||||||
return g_strcmp0 (goa_account_get_identity (a1), goa_account_get_identity (a2));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
account_calendar_disable_changed (GObject *object,
|
account_calendar_disable_changed (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
@@ -1953,7 +1808,6 @@ account_calendar_disable_changed (GObject *object,
|
|||||||
gtk_label_set_label (GTK_LABEL (user_data), goa_account_get_calendar_disabled (account) ? _("Off") : _("On"));
|
gtk_label_set_label (GTK_LABEL (user_data), goa_account_get_calendar_disabled (account) ? _("Off") : _("On"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_goa_account (GcalSourceDialog *dialog,
|
add_goa_account (GcalSourceDialog *dialog,
|
||||||
GoaAccount *account)
|
GoaAccount *account)
|
||||||
@@ -2132,39 +1986,226 @@ loading_changed_cb (GcalSourceDialog *dialog)
|
|||||||
GCAL_EXIT;
|
GCAL_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gcal_source_dialog_set_manager:
|
static void
|
||||||
* @dialog: a #GcalSourceDialog
|
gcal_source_dialog_constructed (GObject *object)
|
||||||
* @manager: a #GcalManager
|
|
||||||
*
|
|
||||||
* Setup the #GcalManager singleton
|
|
||||||
* instance of the application.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gcal_source_dialog_set_manager (GcalSourceDialog *dialog,
|
|
||||||
GcalManager *manager)
|
|
||||||
{
|
{
|
||||||
dialog->manager = manager;
|
GcalSourceDialog *self;
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GMenuModel *menu;
|
||||||
|
|
||||||
if (!gcal_manager_get_loading (dialog->manager))
|
self = GCAL_SOURCE_DIALOG (object);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gcal_source_dialog_parent_class)->constructed (object);
|
||||||
|
|
||||||
|
/* widget responses */
|
||||||
|
gtk_dialog_set_default_response (GTK_DIALOG (object), GTK_RESPONSE_CANCEL);
|
||||||
|
|
||||||
|
g_object_set_data (G_OBJECT (self->remove_button), "response", GINT_TO_POINTER (GCAL_RESPONSE_REMOVE_SOURCE));
|
||||||
|
|
||||||
|
/* Setup listbox header functions */
|
||||||
|
gtk_list_box_set_header_func (GTK_LIST_BOX (self->calendars_listbox), display_header_func, NULL, NULL);
|
||||||
|
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->calendars_listbox), (GtkListBoxSortFunc) calendar_listbox_sort_func,
|
||||||
|
object, NULL);
|
||||||
|
|
||||||
|
gtk_list_box_set_header_func (GTK_LIST_BOX (self->online_accounts_listbox), display_header_func, NULL, NULL);
|
||||||
|
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->online_accounts_listbox), (GtkListBoxSortFunc) online_accounts_listbox_sort_func,
|
||||||
|
object, NULL);
|
||||||
|
|
||||||
|
/* Action group */
|
||||||
|
self->action_group = g_simple_action_group_new ();
|
||||||
|
gtk_widget_insert_action_group (GTK_WIDGET (object), "source", G_ACTION_GROUP (self->action_group));
|
||||||
|
|
||||||
|
g_action_map_add_action_entries (G_ACTION_MAP (self->action_group), actions, G_N_ELEMENTS (actions), object);
|
||||||
|
|
||||||
|
/* Load the "Add" button menu */
|
||||||
|
builder = gtk_builder_new_from_resource ("/org/gnome/calendar/gtk/menus.ui");
|
||||||
|
|
||||||
|
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "add-source-menu"));
|
||||||
|
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->add_calendar_menu_button), menu);
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
|
/* setup titlebar */
|
||||||
|
gtk_window_set_titlebar (GTK_WINDOW (object), self->headerbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_source_dialog_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GcalSourceDialog *self = (GcalSourceDialog *) object;
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
GList *sources, *l;
|
case PROP_MANAGER:
|
||||||
|
g_value_set_object (value, self->manager);
|
||||||
|
break;
|
||||||
|
|
||||||
sources = gcal_manager_get_sources_connected (dialog->manager);
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
for (l = sources; l != NULL; l = l->next)
|
|
||||||
add_source (dialog->manager, l->data, is_source_enabled (l->data), dialog);
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
static void
|
||||||
|
gcal_source_dialog_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GcalSourceDialog *self = (GcalSourceDialog *) object;
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
g_signal_connect_swapped (manager,
|
case PROP_MANAGER:
|
||||||
"notify::loading",
|
self->manager = g_value_dup_object (value);
|
||||||
G_CALLBACK (loading_changed_cb),
|
|
||||||
dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_signal_connect (dialog->manager, "source-added", G_CALLBACK (add_source), dialog);
|
if (!gcal_manager_get_loading (self->manager))
|
||||||
g_signal_connect (dialog->manager, "source-removed", G_CALLBACK (remove_source), dialog);
|
{
|
||||||
|
GList *sources, *l;
|
||||||
|
|
||||||
|
sources = gcal_manager_get_sources_connected (self->manager);
|
||||||
|
|
||||||
|
for (l = sources; l != NULL; l = l->next)
|
||||||
|
add_source (self->manager, l->data, is_source_enabled (l->data), self);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_signal_connect_swapped (self->manager,
|
||||||
|
"notify::loading",
|
||||||
|
G_CALLBACK (loading_changed_cb),
|
||||||
|
self);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_connect (self->manager, "source-added", G_CALLBACK (add_source), self);
|
||||||
|
g_signal_connect (self->manager, "source-removed", G_CALLBACK (remove_source), self);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (object, properties[PROP_MANAGER]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class;
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since we cannot guarantee that the
|
||||||
|
* type system registered ESourceLocal,
|
||||||
|
* it must be ensured at least here.
|
||||||
|
*/
|
||||||
|
g_type_ensure (E_TYPE_SOURCE_LOCAL);
|
||||||
|
|
||||||
|
object_class = G_OBJECT_CLASS (klass);
|
||||||
|
object_class->constructed = gcal_source_dialog_constructed;
|
||||||
|
object_class->get_property = gcal_source_dialog_get_property;
|
||||||
|
object_class->set_property = gcal_source_dialog_set_property;
|
||||||
|
|
||||||
|
properties[PROP_MANAGER] = g_param_spec_object ("manager",
|
||||||
|
"Manager",
|
||||||
|
"The manager object of the application",
|
||||||
|
GCAL_TYPE_MANAGER,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||||
|
|
||||||
|
widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
/* bind things for/from the template class */
|
||||||
|
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/source-dialog.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, account_box);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, account_label);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, add_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, add_calendar_menu_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, back_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_address_entry);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_color_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_url_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendar_visible_check);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, calendars_listbox);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, cancel_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_cancel_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_connect_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_dialog);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_password_entry);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, credentials_user_entry);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, default_check);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, edit_grid);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, exchange_stub_row);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, google_stub_row);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, headerbar);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, location_dim_label);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, main_scrolledwindow);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, name_entry);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, notification);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, notification_label);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, online_accounts_listbox);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, owncloud_stub_row);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, remove_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, settings_button);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, stack);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_source_grid);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_sources_listbox);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GcalSourceDialog, web_sources_revealer);
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, add_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, back_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, calendar_address_activated);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, calendar_file_selected);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, calendar_listbox_row_activated);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, calendar_visible_check_toggled);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, cancel_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, credential_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, credential_entry_activate);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, color_set);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, default_check_toggled);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, hide_notification);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, notification_child_revealed_changed);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, online_accounts_listbox_row_activated);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, online_accounts_settings_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, remove_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, response_signal);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, settings_button_clicked);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_name_changed);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, undo_remove_action);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_source_dialog_init (GcalSourceDialog *self)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
online_accounts_listbox_sort_func (GtkListBoxRow *row1,
|
||||||
|
GtkListBoxRow *row2,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GcalAccountType t1, t2;
|
||||||
|
GoaAccount *a1 = g_object_get_data (G_OBJECT (row1), "goa-account");
|
||||||
|
GoaAccount *a2 = g_object_get_data (G_OBJECT (row2), "goa-account");
|
||||||
|
|
||||||
|
if (!a1 || !a2)
|
||||||
|
return a1 ? -1 : (a2 ? 1 : 0);
|
||||||
|
|
||||||
|
t1 = get_account_type (a1);
|
||||||
|
t2 = get_account_type (a2);
|
||||||
|
|
||||||
|
if (t1 != t2)
|
||||||
|
return t1 - t2;
|
||||||
|
|
||||||
|
return g_strcmp0 (goa_account_get_identity (a1), goa_account_get_identity (a2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,11 +52,6 @@ typedef enum
|
|||||||
GCAL_SOURCE_DIALOG_MODE_NORMAL
|
GCAL_SOURCE_DIALOG_MODE_NORMAL
|
||||||
} GcalSourceDialogMode;
|
} GcalSourceDialogMode;
|
||||||
|
|
||||||
GtkWidget* gcal_source_dialog_new (void);
|
|
||||||
|
|
||||||
void gcal_source_dialog_set_manager (GcalSourceDialog *dialog,
|
|
||||||
GcalManager *manager);
|
|
||||||
|
|
||||||
void gcal_source_dialog_set_mode (GcalSourceDialog *dialog,
|
void gcal_source_dialog_set_mode (GcalSourceDialog *dialog,
|
||||||
GcalSourceDialogMode mode);
|
GcalSourceDialogMode mode);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ gcal_view_default_init (GcalViewInterface *iface)
|
|||||||
ICAL_TIME_TYPE,
|
ICAL_TIME_TYPE,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GcalView::manager:
|
||||||
|
*
|
||||||
|
* The #GcalManager of the view.
|
||||||
|
*/
|
||||||
|
g_object_interface_install_property (iface,
|
||||||
|
g_param_spec_object ("manager",
|
||||||
|
"The manager",
|
||||||
|
"The manager of the view",
|
||||||
|
GCAL_TYPE_MANAGER,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GcalView::create-event:
|
* GcalView::create-event:
|
||||||
*
|
*
|
||||||
@@ -92,6 +104,27 @@ gcal_view_set_date (GcalView *view,
|
|||||||
GCAL_VIEW_GET_IFACE (view)->set_date (view, date);
|
GCAL_VIEW_GET_IFACE (view)->set_date (view, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gcal_view_get_manager:
|
||||||
|
* @self: a #GcalView
|
||||||
|
*
|
||||||
|
* Retrieves the #GcalManager instance from @self.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): a #GcalManager
|
||||||
|
*/
|
||||||
|
GcalManager*
|
||||||
|
gcal_view_get_manager (GcalView *self)
|
||||||
|
{
|
||||||
|
GcalManager *manager;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GCAL_IS_VIEW (self), NULL);
|
||||||
|
|
||||||
|
g_object_get (self, "manager", &manager, NULL);
|
||||||
|
g_object_unref (manager);
|
||||||
|
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gcal_view_get_date:
|
* gcal_view_get_date:
|
||||||
* @view: a #GcalView
|
* @view: a #GcalView
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ void gcal_view_set_date (GcalView
|
|||||||
|
|
||||||
icaltimetype* gcal_view_get_date (GcalView *view);
|
icaltimetype* gcal_view_get_date (GcalView *view);
|
||||||
|
|
||||||
|
GcalManager* gcal_view_get_manager (GcalView *self);
|
||||||
|
|
||||||
void gcal_view_clear_marks (GcalView *view);
|
void gcal_view_clear_marks (GcalView *view);
|
||||||
|
|
||||||
GList* gcal_view_get_children_by_uuid (GcalView *view,
|
GList* gcal_view_get_children_by_uuid (GcalView *view,
|
||||||
|
|||||||
+14
-8
@@ -1378,12 +1378,6 @@ 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-enabled", G_CALLBACK (source_enabled), object);
|
||||||
g_signal_connect_swapped (self->manager, "source-changed", G_CALLBACK (source_changed), object);
|
g_signal_connect_swapped (self->manager, "source-changed", G_CALLBACK (source_changed), object);
|
||||||
|
|
||||||
gcal_edit_dialog_set_manager (GCAL_EDIT_DIALOG (self->edit_dialog), self->manager);
|
|
||||||
gcal_week_view_set_manager (GCAL_WEEK_VIEW (self->week_view), self->manager);
|
|
||||||
gcal_month_view_set_manager (GCAL_MONTH_VIEW (self->month_view), self->manager);
|
|
||||||
gcal_year_view_set_manager (GCAL_YEAR_VIEW (self->year_view), self->manager);
|
|
||||||
gcal_quick_add_popover_set_manager (GCAL_QUICK_ADD_POPOVER (self->quick_add_popover), self->manager);
|
|
||||||
gcal_source_dialog_set_manager (GCAL_SOURCE_DIALOG (self->source_dialog), self->manager);
|
|
||||||
gcal_search_view_connect (GCAL_SEARCH_VIEW (self->search_view), self->manager);
|
gcal_search_view_connect (GCAL_SEARCH_VIEW (self->search_view), self->manager);
|
||||||
|
|
||||||
g_object_notify (object, "manager");
|
g_object_notify (object, "manager");
|
||||||
@@ -1490,7 +1484,6 @@ gcal_window_class_init(GcalWindowClass *klass)
|
|||||||
widget_class = GTK_WIDGET_CLASS (klass);
|
widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
widget_class->configure_event = gcal_window_configure_event;
|
widget_class->configure_event = gcal_window_configure_event;
|
||||||
widget_class->window_state_event = gcal_window_state_event;
|
widget_class->window_state_event = gcal_window_state_event;
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/window.ui");
|
|
||||||
|
|
||||||
g_object_class_install_property (
|
g_object_class_install_property (
|
||||||
object_class,
|
object_class,
|
||||||
@@ -1507,7 +1500,7 @@ gcal_window_class_init(GcalWindowClass *klass)
|
|||||||
PROP_MANAGER,
|
PROP_MANAGER,
|
||||||
g_param_spec_object ("manager",
|
g_param_spec_object ("manager",
|
||||||
"The manager object",
|
"The manager object",
|
||||||
"A weak reference to the app manager object",
|
"The manager object",
|
||||||
GCAL_TYPE_MANAGER,
|
GCAL_TYPE_MANAGER,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
||||||
|
|
||||||
@@ -1529,6 +1522,8 @@ gcal_window_class_init(GcalWindowClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/window.ui");
|
||||||
|
|
||||||
/* widgets */
|
/* widgets */
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, edit_dialog);
|
gtk_widget_class_bind_template_child (widget_class, GcalWindow, edit_dialog);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWindow, header_bar);
|
gtk_widget_class_bind_template_child (widget_class, GcalWindow, header_bar);
|
||||||
@@ -1658,6 +1653,17 @@ gcal_window_init (GcalWindow *self)
|
|||||||
self->active_date = g_new0 (icaltimetype, 1);
|
self->active_date = g_new0 (icaltimetype, 1);
|
||||||
self->rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
|
self->rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: this is a hack around the issue that happens when trying to bind
|
||||||
|
* there properties using the GtkBuilder .ui file.
|
||||||
|
*/
|
||||||
|
g_object_bind_property (self, "manager", self->edit_dialog, "manager", G_BINDING_DEFAULT);
|
||||||
|
g_object_bind_property (self, "manager", self->source_dialog, "manager", G_BINDING_DEFAULT);
|
||||||
|
g_object_bind_property (self, "manager", self->week_view, "manager", G_BINDING_DEFAULT);
|
||||||
|
g_object_bind_property (self, "manager", self->month_view, "manager", G_BINDING_DEFAULT);
|
||||||
|
g_object_bind_property (self, "manager", self->year_view, "manager", G_BINDING_DEFAULT);
|
||||||
|
g_object_bind_property (self, "manager", self->quick_add_popover, "manager", G_BINDING_DEFAULT);
|
||||||
|
|
||||||
/* setup accels */
|
/* setup accels */
|
||||||
app = g_application_get_default ();
|
app = g_application_get_default ();
|
||||||
|
|
||||||
|
|||||||
+24
-15
@@ -104,7 +104,9 @@ G_DEFINE_TYPE_WITH_CODE (GcalMonthView, gcal_month_view, GCAL_TYPE_SUBSCRIBER_VI
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE, /* active-date inherited property */
|
PROP_DATE,
|
||||||
|
PROP_MANAGER,
|
||||||
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline gint
|
static inline gint
|
||||||
@@ -1006,12 +1008,25 @@ gcal_month_view_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
|
GcalMonthView *self = (GcalMonthView *) object;
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_DATE:
|
case PROP_DATE:
|
||||||
gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value));
|
gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
self->manager = g_value_dup_object (value);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (gcal_manager_get_clock (self->manager),
|
||||||
|
"day-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
self);
|
||||||
|
|
||||||
|
g_object_notify (object, "manager");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -1031,6 +1046,11 @@ gcal_month_view_get_property (GObject *object,
|
|||||||
case PROP_DATE:
|
case PROP_DATE:
|
||||||
g_value_set_boxed (value, self->date);
|
g_value_set_boxed (value, self->date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
g_value_set_object (value, self->manager);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -1044,6 +1064,8 @@ gcal_month_view_finalize (GObject *object)
|
|||||||
|
|
||||||
g_clear_pointer (&self->date, g_free);
|
g_clear_pointer (&self->date, g_free);
|
||||||
|
|
||||||
|
g_clear_object (&self->manager);
|
||||||
|
|
||||||
/* Chain up to parent's finalize() method. */
|
/* Chain up to parent's finalize() method. */
|
||||||
G_OBJECT_CLASS (gcal_month_view_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gcal_month_view_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@@ -2285,6 +2307,7 @@ gcal_month_view_class_init (GcalMonthViewClass *klass)
|
|||||||
subscriber_view_class->clear_state = gcal_month_view_clear_state;
|
subscriber_view_class->clear_state = gcal_month_view_clear_state;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
|
|
||||||
gtk_widget_class_set_css_name (widget_class, "calendar-view");
|
gtk_widget_class_set_css_name (widget_class, "calendar-view");
|
||||||
}
|
}
|
||||||
@@ -2388,17 +2411,3 @@ gcal_month_view_set_use_24h_format (GcalMonthView *self,
|
|||||||
{
|
{
|
||||||
self->use_24h_format = use_24h;
|
self->use_24h_format = use_24h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gcal_month_view_set_manager (GcalMonthView *self,
|
|
||||||
GcalManager *manager)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GCAL_IS_MONTH_VIEW (self));
|
|
||||||
|
|
||||||
self->manager = manager;
|
|
||||||
|
|
||||||
g_signal_connect_swapped (gcal_manager_get_clock (manager),
|
|
||||||
"day-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
self);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ void gcal_month_view_set_first_weekday (GcalMonthView
|
|||||||
void gcal_month_view_set_use_24h_format (GcalMonthView *self,
|
void gcal_month_view_set_use_24h_format (GcalMonthView *self,
|
||||||
gboolean use_24h);
|
gboolean use_24h);
|
||||||
|
|
||||||
void gcal_month_view_set_manager (GcalMonthView *self ,
|
|
||||||
GcalManager *manager);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GCAL_MONTH_VIEW_H__ */
|
#endif /* __GCAL_MONTH_VIEW_H__ */
|
||||||
|
|||||||
+19
-12
@@ -85,6 +85,7 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE,
|
PROP_DATE,
|
||||||
|
PROP_MANAGER,
|
||||||
NUM_PROPS
|
NUM_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -519,6 +520,8 @@ gcal_week_view_finalize (GObject *object)
|
|||||||
|
|
||||||
g_clear_pointer (&self->date, g_free);
|
g_clear_pointer (&self->date, g_free);
|
||||||
|
|
||||||
|
g_clear_object (&self->manager);
|
||||||
|
|
||||||
/* Chain up to parent's finalize() method. */
|
/* Chain up to parent's finalize() method. */
|
||||||
G_OBJECT_CLASS (gcal_week_view_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gcal_week_view_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@@ -529,12 +532,23 @@ gcal_week_view_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
|
GcalWeekView *self = (GcalWeekView *) object;
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_DATE:
|
case PROP_DATE:
|
||||||
gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value));
|
gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
self->manager = g_value_dup_object (value);
|
||||||
|
|
||||||
|
gcal_week_grid_set_manager (GCAL_WEEK_GRID (self->week_grid), self->manager);
|
||||||
|
gcal_week_header_set_manager (GCAL_WEEK_HEADER (self->header), self->manager);
|
||||||
|
|
||||||
|
g_object_notify (object, "manager");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -558,6 +572,10 @@ gcal_week_view_get_property (GObject *object,
|
|||||||
g_value_set_boxed (value, self->date);
|
g_value_set_boxed (value, self->date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
g_value_set_object (value, self->manager);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -575,6 +593,7 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
|
|||||||
object_class->get_property = gcal_week_view_get_property;
|
object_class->get_property = gcal_week_view_get_property;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
|
|
||||||
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated",
|
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated",
|
||||||
GCAL_TYPE_WEEK_VIEW,
|
GCAL_TYPE_WEEK_VIEW,
|
||||||
@@ -619,18 +638,6 @@ gcal_week_view_new (void)
|
|||||||
return g_object_new (GCAL_TYPE_WEEK_VIEW, NULL);
|
return g_object_new (GCAL_TYPE_WEEK_VIEW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gcal_week_view_set_manager (GcalWeekView *self,
|
|
||||||
GcalManager *manager)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GCAL_IS_WEEK_VIEW (self));
|
|
||||||
|
|
||||||
self->manager = manager;
|
|
||||||
|
|
||||||
gcal_week_grid_set_manager (GCAL_WEEK_GRID (self->week_grid), manager);
|
|
||||||
gcal_week_header_set_manager (GCAL_WEEK_HEADER (self->header), manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gcal_week_view_set_first_weekday:
|
* gcal_week_view_set_first_weekday:
|
||||||
* @view:
|
* @view:
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ G_DECLARE_FINAL_TYPE (GcalWeekView, gcal_week_view, GCAL, WEEK_VIEW, GtkBox)
|
|||||||
|
|
||||||
GtkWidget* gcal_week_view_new (void);
|
GtkWidget* gcal_week_view_new (void);
|
||||||
|
|
||||||
void gcal_week_view_set_manager (GcalWeekView *self,
|
|
||||||
GcalManager *manager);
|
|
||||||
|
|
||||||
void gcal_week_view_set_first_weekday (GcalWeekView *self,
|
void gcal_week_view_set_first_weekday (GcalWeekView *self,
|
||||||
gint day_nr);
|
gint day_nr);
|
||||||
|
|
||||||
|
|||||||
+24
-16
@@ -120,6 +120,7 @@ struct _GcalYearView
|
|||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE,
|
PROP_DATE,
|
||||||
|
PROP_MANAGER,
|
||||||
PROP_SHOW_WEEK_NUMBERS,
|
PROP_SHOW_WEEK_NUMBERS,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
@@ -1651,6 +1652,10 @@ gcal_year_view_get_property (GObject *object,
|
|||||||
g_value_set_boxed (value, self->date);
|
g_value_set_boxed (value, self->date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
g_value_set_object (value, self->manager);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_SHOW_WEEK_NUMBERS:
|
case PROP_SHOW_WEEK_NUMBERS:
|
||||||
g_value_set_boolean (value, self->show_week_numbers);
|
g_value_set_boolean (value, self->show_week_numbers);
|
||||||
break;
|
break;
|
||||||
@@ -1674,6 +1679,17 @@ gcal_year_view_set_property (GObject *object,
|
|||||||
gcal_view_set_date (GCAL_VIEW (self), g_value_get_boxed (value));
|
gcal_view_set_date (GCAL_VIEW (self), g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MANAGER:
|
||||||
|
self->manager = g_value_dup_object (value);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (gcal_manager_get_clock (self->manager),
|
||||||
|
"day-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
self->navigator);
|
||||||
|
|
||||||
|
g_object_notify (object, "manager");
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_SHOW_WEEK_NUMBERS:
|
case PROP_SHOW_WEEK_NUMBERS:
|
||||||
if (self->show_week_numbers != g_value_get_boolean (value))
|
if (self->show_week_numbers != g_value_get_boolean (value))
|
||||||
{
|
{
|
||||||
@@ -1948,6 +1964,7 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
|
|||||||
widget_class->direction_changed = gcal_year_view_direction_changed;
|
widget_class->direction_changed = gcal_year_view_direction_changed;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_SHOW_WEEK_NUMBERS,
|
PROP_SHOW_WEEK_NUMBERS,
|
||||||
@@ -1958,10 +1975,13 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
|
|||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
/* FIXME: it will problably go back to GcalView */
|
/* FIXME: it will problably go back to GcalView */
|
||||||
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated", GCAL_TYPE_YEAR_VIEW, G_SIGNAL_RUN_LAST,
|
signals[EVENT_ACTIVATED] = g_signal_new ("event-activated",
|
||||||
0,
|
GCAL_TYPE_YEAR_VIEW,
|
||||||
NULL, NULL, NULL,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_TYPE_NONE, 1, GCAL_TYPE_EVENT_WIDGET);
|
0, NULL, NULL, NULL,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
1,
|
||||||
|
GCAL_TYPE_EVENT_WIDGET);
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/year-view.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/year-view.ui");
|
||||||
|
|
||||||
@@ -2043,18 +2063,6 @@ gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *ifa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
void
|
|
||||||
gcal_year_view_set_manager (GcalYearView *year_view,
|
|
||||||
GcalManager *manager)
|
|
||||||
{
|
|
||||||
year_view->manager = manager;
|
|
||||||
|
|
||||||
g_signal_connect_swapped (gcal_manager_get_clock (manager),
|
|
||||||
"day-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
year_view->navigator);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gcal_year_view_set_first_weekday (GcalYearView *year_view,
|
gcal_year_view_set_first_weekday (GcalYearView *year_view,
|
||||||
gint nr_day)
|
gint nr_day)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (GcalYearView, gcal_year_view, GCAL, YEAR_VIEW, GtkBox)
|
G_DECLARE_FINAL_TYPE (GcalYearView, gcal_year_view, GCAL, YEAR_VIEW, GtkBox)
|
||||||
|
|
||||||
void gcal_year_view_set_manager (GcalYearView *year_view,
|
|
||||||
GcalManager *manager);
|
|
||||||
void gcal_year_view_set_first_weekday (GcalYearView *year_view,
|
void gcal_year_view_set_first_weekday (GcalYearView *year_view,
|
||||||
gint nr_day);
|
gint nr_day);
|
||||||
void gcal_year_view_set_use_24h_format (GcalYearView *year_view,
|
void gcal_year_view_set_use_24h_format (GcalYearView *year_view,
|
||||||
|
|||||||
Reference in New Issue
Block a user