Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
None of these should be global
Browse files Browse the repository at this point in the history
  • Loading branch information
cybre committed Aug 7, 2019
1 parent 9070090 commit 5c2f2f6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 54 deletions.
41 changes: 21 additions & 20 deletions src/backend/redshiftgtk-redshift-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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)
{
Expand All @@ -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);
Expand All @@ -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)
{
Expand All @@ -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);
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
61 changes: 27 additions & 34 deletions src/gui/redshiftgtk-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ redshiftgtk_window_class_init (RedshiftGtkWindowClass *klass)
cancel_button);
}

void
static void
redshiftgtk_window_populate_controls (RedshiftGtkWindow *self)
{
/* Location provider */
Expand Down Expand Up @@ -193,22 +193,22 @@ 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;
gdouble value = gtk_adjustment_get_value (adjustment);
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)
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -285,7 +285,7 @@ backend_set_autostart_cb (RedshiftGtkWindow *self)
}
}

void
static void
backend_apply_changes_cb (RedshiftGtkWindow *self)
{
g_autoptr (GError) error = NULL;
Expand All @@ -301,7 +301,7 @@ backend_apply_changes_cb (RedshiftGtkWindow *self)
}
}

void
static void
backend_start_cb (RedshiftGtkWindow *self)
{
g_autoptr (GError) error = NULL;
Expand All @@ -317,7 +317,7 @@ backend_start_cb (RedshiftGtkWindow *self)
}
}

void
static void
apply_button_clicked_cb (GtkWidget *widget, gpointer data)
{
RedshiftGtkWindow *self = data;
Expand Down Expand Up @@ -392,46 +392,39 @@ 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;

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));

}

Expand All @@ -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();
Expand Down

0 comments on commit 5c2f2f6

Please sign in to comment.