diff --git a/src/backend/redshiftgtk-redshift-wrapper.c b/src/backend/redshiftgtk-redshift-wrapper.c index 969fa98..5c9749e 100644 --- a/src/backend/redshiftgtk-redshift-wrapper.c +++ b/src/backend/redshiftgtk-redshift-wrapper.c @@ -215,7 +215,7 @@ redshiftgtk_redshift_wrapper_get_temperature (RedshiftGtkBackend *backend, return DEFAULT_NIGHT_TEMPERATURE; } -void +static void redshiftgtk_redshift_wrapper_set_temperature (RedshiftGtkBackend *backend, TimePeriod period, gdouble temperature) @@ -239,7 +239,7 @@ redshiftgtk_redshift_wrapper_set_temperature (RedshiftGtkBackend *backend, key, temperature); } -LocationProvider +static LocationProvider redshiftgtk_redshift_wrapper_get_location_provider (RedshiftGtkBackend *backend) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); @@ -265,7 +265,7 @@ redshiftgtk_redshift_wrapper_get_location_provider (RedshiftGtkBackend *backend) return LOCATION_PROVIDER_AUTO; } -void +static void redshiftgtk_redshift_wrapper_set_location_provider (RedshiftGtkBackend *backend, LocationProvider provider) { @@ -285,7 +285,7 @@ redshiftgtk_redshift_wrapper_set_location_provider (RedshiftGtkBackend *backend, "location-provider", provider_string); } -gdouble +static gdouble redshiftgtk_redshift_wrapper_get_latitude (RedshiftGtkBackend *backend) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); @@ -306,7 +306,7 @@ redshiftgtk_redshift_wrapper_get_latitude (RedshiftGtkBackend *backend) return latitude; } -void +static void redshiftgtk_redshift_wrapper_set_latitude (RedshiftGtkBackend *backend, gdouble latitude) { @@ -317,7 +317,7 @@ redshiftgtk_redshift_wrapper_set_latitude (RedshiftGtkBackend *backend, "lat", g_strdup_printf ("%.2f", latitude)); } -gdouble +static gdouble redshiftgtk_redshift_wrapper_get_longtitude (RedshiftGtkBackend *backend) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); @@ -338,7 +338,7 @@ redshiftgtk_redshift_wrapper_get_longtitude (RedshiftGtkBackend *backend) return longtitude; } -void +static void redshiftgtk_redshift_wrapper_set_longtitude (RedshiftGtkBackend *backend, gdouble longtitude) { @@ -349,7 +349,7 @@ redshiftgtk_redshift_wrapper_set_longtitude (RedshiftGtkBackend *backend, "lon", g_strdup_printf ("%.2f", longtitude)); } -gdouble +static gdouble redshiftgtk_redshift_wrapper_get_brightness (RedshiftGtkBackend *backend, TimePeriod period) { @@ -386,7 +386,7 @@ redshiftgtk_redshift_wrapper_get_brightness (RedshiftGtkBackend *backend, return brightness; } -void +static void redshiftgtk_redshift_wrapper_set_brightness (RedshiftGtkBackend *backend, TimePeriod period, gdouble brightness) @@ -410,7 +410,7 @@ redshiftgtk_redshift_wrapper_set_brightness (RedshiftGtkBackend *backend, key, g_strdup_printf ("%.1f", brightness)); } -GArray* +static GArray* redshiftgtk_redshift_wrapper_get_gamma (RedshiftGtkBackend *backend, TimePeriod period) { @@ -499,7 +499,7 @@ redshiftgtk_redshift_wrapper_get_gamma (RedshiftGtkBackend *backend, return gamma; } -void +static void redshiftgtk_redshift_wrapper_set_gamma (RedshiftGtkBackend *backend, TimePeriod period, gdouble red, @@ -528,7 +528,7 @@ redshiftgtk_redshift_wrapper_set_gamma (RedshiftGtkBackend *backend, key, gamma); } -AdjustmentMethod +static AdjustmentMethod redshiftgtk_redshift_wrapper_get_adjustment_method (RedshiftGtkBackend *backend) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); @@ -555,8 +555,9 @@ redshiftgtk_redshift_wrapper_get_adjustment_method (RedshiftGtkBackend *backend) return ADJUSTMENT_METHOD_AUTO; } -void redshiftgtk_redshift_wrapper_set_adjustment_method (RedshiftGtkBackend *backend, - AdjustmentMethod method) +static void +redshiftgtk_redshift_wrapper_set_adjustment_method (RedshiftGtkBackend *backend, + AdjustmentMethod method) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); g_assert (self->config != NULL); @@ -579,7 +580,7 @@ void redshiftgtk_redshift_wrapper_set_adjustment_method (RedshiftGtkBackend *bac "adjustment-method", method_string); } -gboolean +static gboolean redshiftgtk_redshift_wrapper_get_smooth_transition (RedshiftGtkBackend *backend) { RedshiftGtkRedshiftWrapper *self = REDSHIFTGTK_REDSHIFT_WRAPPER (backend); @@ -600,7 +601,7 @@ redshiftgtk_redshift_wrapper_get_smooth_transition (RedshiftGtkBackend *backend) return transition; } -void +static void redshiftgtk_redshift_wrapper_set_smooth_transition (RedshiftGtkBackend *backend, gboolean transition) { @@ -611,7 +612,7 @@ redshiftgtk_redshift_wrapper_set_smooth_transition (RedshiftGtkBackend *backend, "fade", transition); } -gboolean +static gboolean redshiftgtk_redshift_wrapper_get_autostart (RedshiftGtkBackend *self) { g_autoptr (GFile) file = NULL; @@ -674,7 +675,7 @@ redshiftgtk_redshift_wrapper_get_autostart (RedshiftGtkBackend *self) return FALSE; } -void +static void redshiftgtk_redshift_wrapper_autostart_file_create_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) @@ -715,7 +716,7 @@ X-GNOME-Autostart-enabled=%s", hidden_value, autostart_value), NULL, &error); } } -void +static void redshiftgtk_redshift_wrapper_set_autostart (RedshiftGtkBackend *self, gboolean autostart, GError **error) @@ -788,7 +789,7 @@ redshiftgtk_redshift_wrapper_set_autostart (RedshiftGtkBackend *self, GINT_TO_POINTER (autostart)); } -void +static void redshiftgtk_redshift_wrapper_apply_changes (RedshiftGtkBackend *backend, GError **error) { diff --git a/src/gui/redshiftgtk-window.c b/src/gui/redshiftgtk-window.c index 85bc51e..900718e 100644 --- a/src/gui/redshiftgtk-window.c +++ b/src/gui/redshiftgtk-window.c @@ -127,7 +127,7 @@ redshiftgtk_window_class_init (RedshiftGtkWindowClass *klass) cancel_button); } -void +static void redshiftgtk_window_populate_controls (RedshiftGtkWindow *self) { /* Location provider */ @@ -193,7 +193,7 @@ redshiftgtk_window_populate_controls (RedshiftGtkWindow *self) redshiftgtk_backend_get_autostart (self->backend)); } -void +static void adjustment_value_changed_cb (GtkAdjustment *adjustment, gpointer data) { GtkSpinButton *entry = data; @@ -201,14 +201,14 @@ adjustment_value_changed_cb (GtkAdjustment *adjustment, gpointer data) gtk_spin_button_set_value (entry, value); } -void +static void spinner_value_changed_cb (GtkSpinButton *spinner, gpointer data) { RadialSlider *slider = data; redshiftgtk_radial_slider_update(slider); } -void +static void try_again_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data) @@ -224,7 +224,7 @@ try_again_dialog_response_cb (GtkDialog *dialog, callback (self); } -void +static void redshiftgtk_window_show_try_again_dialog (RedshiftGtkWindow *self, const gchar *message, const gchar *error_message, @@ -266,7 +266,7 @@ redshiftgtk_window_show_try_again_dialog (RedshiftGtkWindow *self, callback); } -void +static void backend_set_autostart_cb (RedshiftGtkWindow *self) { g_autoptr (GError) error = NULL; @@ -285,7 +285,7 @@ backend_set_autostart_cb (RedshiftGtkWindow *self) } } -void +static void backend_apply_changes_cb (RedshiftGtkWindow *self) { g_autoptr (GError) error = NULL; @@ -301,7 +301,7 @@ backend_apply_changes_cb (RedshiftGtkWindow *self) } } -void +static void backend_start_cb (RedshiftGtkWindow *self) { g_autoptr (GError) error = NULL; @@ -317,7 +317,7 @@ backend_start_cb (RedshiftGtkWindow *self) } } -void +static void apply_button_clicked_cb (GtkWidget *widget, gpointer data) { RedshiftGtkWindow *self = data; @@ -392,7 +392,7 @@ apply_button_clicked_cb (GtkWidget *widget, gpointer data) backend_start_cb (self); } -void +static void cancel_button_clicked_cb (GtkWidget *widget, gpointer data) { RedshiftGtkWindow *self = data; @@ -400,38 +400,31 @@ cancel_button_clicked_cb (GtkWidget *widget, gpointer data) gtk_window_close (GTK_WINDOW (self)); } -void +static void stop_button_clicked_cb (GtkWidget *widget, gpointer data) { RedshiftGtkWindow *self = data; redshiftgtk_backend_stop (self->backend); } -void +static void window_scale_factor_changed_cb (RedshiftGtkWindow *self, gpointer data) { - gdouble factor = gtk_widget_get_scale_factor (GTK_WIDGET(self)); - - if (factor == 1.0) { - redshiftgtk_radial_slider_set_bg_path (self->day_temp_slider, - "/com/github/cybre/RedshiftGtk/images/slider-day.png"); - redshiftgtk_radial_slider_set_bg_path (self->night_temp_slider, - "/com/github/cybre/RedshiftGtk/images/slider-night.png"); - redshiftgtk_radial_slider_set_knob_path (self->day_temp_slider, - "/com/github/cybre/RedshiftGtk/images/knob.png"); - redshiftgtk_radial_slider_set_knob_path (self->night_temp_slider, - "/com/github/cybre/RedshiftGtk/images/knob.png"); - } else if (factor == 2.0) { - redshiftgtk_radial_slider_set_bg_path (self->day_temp_slider, - "/com/github/cybre/RedshiftGtk/images@2x/slider-day.png"); - redshiftgtk_radial_slider_set_bg_path (self->night_temp_slider, - "/com/github/cybre/RedshiftGtk/images@2x/slider-night.png"); - redshiftgtk_radial_slider_set_knob_path (self->day_temp_slider, - "/com/github/cybre/RedshiftGtk/images@2x/knob.png"); - redshiftgtk_radial_slider_set_knob_path (self->night_temp_slider, - "/com/github/cybre/RedshiftGtk/images@2x/knob.png"); - } + gchar *image_resource_path = "/com/github/cybre/RedshiftGtk/images/"; + + gdouble factor = gtk_widget_get_scale_factor (GTK_WIDGET (self)); + if (factor == 2.0) + image_resource_path = "/com/github/cybre/RedshiftGtk/images@2x/"; + + redshiftgtk_radial_slider_set_bg_path (self->day_temp_slider, + g_strconcat (image_resource_path, "slider-day.png", NULL)); + redshiftgtk_radial_slider_set_bg_path (self->night_temp_slider, + g_strconcat (image_resource_path, "slider-night.png", NULL)); + redshiftgtk_radial_slider_set_knob_path (self->day_temp_slider, + g_strconcat (image_resource_path, "knob.png", NULL)); + redshiftgtk_radial_slider_set_knob_path (self->night_temp_slider, + g_strconcat (image_resource_path, "knob.png", NULL)); } @@ -446,7 +439,7 @@ redshiftgtk_window_init (RedshiftGtkWindow *self) GdkScreen *screen; g_autoptr(GtkCssProvider) provider = NULL; gdouble value; - const gchar *image_resource_path; + gchar *image_resource_path; gtk_widget_init_template (GTK_WIDGET (self)); self->backend = redshiftgtk_redshift_wrapper_new();