window: simplify constructor
We don't need to pass information that can easily be retrieved by the GSettings instance from GcalManager.
This commit is contained in:
+2
-14
@@ -180,12 +180,10 @@ static void
|
||||
gcal_application_activate (GApplication *application)
|
||||
{
|
||||
GcalApplication *self;
|
||||
GSettings *settings;
|
||||
|
||||
GCAL_ENTRY;
|
||||
|
||||
self = GCAL_APPLICATION (application);
|
||||
settings = gcal_manager_get_settings (self->manager);
|
||||
|
||||
if (!self->provider)
|
||||
{
|
||||
@@ -215,18 +213,8 @@ gcal_application_activate (GApplication *application)
|
||||
gcal_manager_get_system_timezone (self->manager));
|
||||
}
|
||||
|
||||
self->window = gcal_window_new_with_view_and_date (GCAL_APPLICATION (application),
|
||||
g_settings_get_enum (settings, "active-view"),
|
||||
self->initial_date);
|
||||
|
||||
g_signal_connect (self->window, "destroy", G_CALLBACK (gtk_widget_destroyed), &(self->window));
|
||||
|
||||
g_settings_bind (settings,
|
||||
"active-view",
|
||||
self->window,
|
||||
"active-view",
|
||||
G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET);
|
||||
|
||||
self->window = gcal_window_new_with_date (GCAL_APPLICATION (application), self->initial_date);
|
||||
g_signal_connect (self->window, "destroy", G_CALLBACK (gtk_widget_destroyed), &self->window);
|
||||
gtk_widget_show (self->window);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -1355,6 +1355,11 @@ gcal_window_set_property (GObject *object,
|
||||
case PROP_MANAGER:
|
||||
if (g_set_object (&self->manager, g_value_get_object (value)))
|
||||
{
|
||||
g_settings_bind (gcal_manager_get_settings (self->manager),
|
||||
"active-view",
|
||||
self,
|
||||
"active-view",
|
||||
G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET);
|
||||
|
||||
if (!gcal_manager_get_loading (self->manager))
|
||||
{
|
||||
@@ -1669,20 +1674,17 @@ gcal_window_init (GcalWindow *self)
|
||||
|
||||
/* Public API */
|
||||
/**
|
||||
* gcal_window_new_with_view_and_date:
|
||||
* gcal_window_new_with_date:
|
||||
* @app: a #GcalApplication
|
||||
* @view_type: a #GcalWindowViewType
|
||||
* @date: the active date
|
||||
*
|
||||
* Creates a #GcalWindow, positions it at @date and shows
|
||||
* @view_type view by default.
|
||||
* Creates a #GcalWindow, positions it at @date.
|
||||
*
|
||||
* Returns: (transfer full): a #GcalWindow
|
||||
*/
|
||||
GtkWidget*
|
||||
gcal_window_new_with_view_and_date (GcalApplication *app,
|
||||
GcalWindowViewType view_type,
|
||||
icaltimetype *date)
|
||||
gcal_window_new_with_date (GcalApplication *app,
|
||||
icaltimetype *date)
|
||||
{
|
||||
GcalManager *manager;
|
||||
GcalWindow *win;
|
||||
@@ -1697,9 +1699,6 @@ gcal_window_new_with_view_and_date (GcalApplication *app,
|
||||
/* loading size */
|
||||
load_geometry (win);
|
||||
|
||||
if (view_type == GCAL_WINDOW_VIEW_DAY)
|
||||
view_changed (NULL, NULL, win);
|
||||
|
||||
return GTK_WIDGET (win);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GcalWindow, gcal_window, GCAL, WINDOW, GtkApplicationWindow)
|
||||
|
||||
GtkWidget* gcal_window_new_with_view_and_date (GcalApplication *app,
|
||||
GcalWindowViewType view_type,
|
||||
GtkWidget* gcal_window_new_with_date (GcalApplication *app,
|
||||
icaltimetype *date);
|
||||
|
||||
void gcal_window_new_event (GcalWindow *self);
|
||||
|
||||
Reference in New Issue
Block a user