/*
- * Copyright (C) 2010-2013 jeanfi@gmail.com
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
*/
#include <stdlib.h>
-#include "cfg.h"
-#include "slog.h"
-#include "ui.h"
-#include "ui_graph.h"
-#include "ui_pref.h"
-#include "ui_sensorpref.h"
-#include "ui_sensorlist.h"
-#include "ui_status.h"
-#include "ui_appindicator.h"
+#include <cfg.h>
+#include <slog.h>
+#include <ui.h>
+#include <ui_appindicator.h>
+#include <ui_graph.h>
+#include <ui_pref.h>
+#include <ui_sensorlist.h>
+#include <ui_sensorpref.h>
+#include <ui_status.h>
+
+static void set_decoration(GtkWindow *win)
+{
+ gtk_window_set_decorated(win, config_is_window_decoration_enabled());
+}
+
+static void set_keep_below(GtkWindow *win)
+{
+ gtk_window_set_keep_below(win, config_is_window_keep_below_enabled());
+}
+
+static void
+decoration_changed_cbk(GSettings *settings, gchar *key, gpointer data)
+{
+ set_decoration((GtkWindow *)data);
+}
+
+static void
+keep_below_changed_cbk(GSettings *settings, gchar *key, gpointer data)
+{
+ set_keep_below((GtkWindow *)data);
+}
+
+static void connect_cbks(GtkWindow *win)
+{
+ log_fct_enter();
+
+ g_signal_connect_after(config_get_GSettings(),
+ "changed::interface-window-decoration-disabled",
+ G_CALLBACK(decoration_changed_cbk),
+ win);
+
+ g_signal_connect_after(config_get_GSettings(),
+ "changed::interface-window-keep-below-enabled",
+ G_CALLBACK(keep_below_changed_cbk),
+ win);
+
+ log_fct_exit();
+}
static void save_window_pos(struct ui_psensor *ui)
{
return TRUE;
}
-void ui_show_about_dialog()
+void ui_show_about_dialog(void)
{
+ static const char *const authors[] = { "jeanfi@gmail.com", NULL };
+
gtk_show_about_dialog
(NULL,
+ "authors", authors,
"comments",
_("Psensor is a GTK+ application for monitoring hardware "
"sensors"),
"copyright",
- _("Copyright(c) 2010-2012\njeanfi@gmail.com"),
+ _("Copyright(c) 2010-2014 jeanfi@gmail.com"),
+#if GTK_CHECK_VERSION(3, 12, 0)
+ "license-type", GTK_LICENSE_GPL_2_0,
+#endif
"logo-icon-name", "psensor",
"program-name", "Psensor",
"title", _("About Psensor"),
+ "translator-credits", _("translator-credits"),
"version", VERSION,
"website", PACKAGE_URL,
"website-label", _("Psensor Homepage"),
}
}
-static void
-slog_enabled_cbk(GConfClient *client, guint id, GConfEntry *e, gpointer data)
+static void slog_enabled_cbk(void *data)
{
struct ui_psensor *ui;
struct psensor **sensors;
if (!ok) {
log_printf(LOG_ERR, error->message);
g_error_free(error);
- return ;
+ return;
}
window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
cfg->window_x,
cfg->window_y);
- config_slog_enabled_notify_add(slog_enabled_cbk, ui);
+ config_set_slog_enabled_changed_cbk(slog_enabled_cbk, ui);
gtk_window_set_default_size(GTK_WINDOW(window),
cfg->window_w,
g_signal_connect(window,
"delete_event", G_CALLBACK(on_delete_event_cb), ui);
- gtk_window_set_decorated(GTK_WINDOW(window),
- cfg->window_decoration_enabled);
-
- gtk_window_set_keep_below(GTK_WINDOW(window),
- cfg->window_keep_below_enabled);
+ set_decoration(GTK_WINDOW(window));
+ set_keep_below(GTK_WINDOW(window));
ui->menu_bar = GTK_WIDGET(gtk_builder_get_object(builder, "menu_bar"));
ui->main_box = GTK_WIDGET(gtk_builder_get_object(builder, "main_box"));
ui_sensorlist_create(ui);
+ connect_cbks(GTK_WINDOW(window));
+
log_debug("ui_window_create(): show_all");
gtk_widget_show_all(ui->main_box);
return pos1 - pos2;
}
-struct psensor **ui_get_sensors_ordered_by_position(struct ui_psensor *ui)
+struct psensor **ui_get_sensors_ordered_by_position(struct psensor **sensors)
{
struct psensor **result;
- result = psensor_list_copy(ui->sensors);
+ result = psensor_list_copy(sensors);
qsort(result,
psensor_list_size(result),
sizeof(struct psensor *),