/*
- * Copyright (C) 2010-2014 jeanfi@gmail.com
+ * Copyright (C) 2010-2016 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
if (sensorlist_pos == SENSORLIST_POSITION_RIGHT
|| sensorlist_pos == SENSORLIST_POSITION_LEFT)
w_sensor_box
- = GTK_PANED(gtk_paned_new(GTK_ORIENTATION_HORIZONTAL));
+ = GTK_CONTAINER(gtk_paned_new
+ (GTK_ORIENTATION_HORIZONTAL));
else
w_sensor_box
- = GTK_PANED(gtk_paned_new(GTK_ORIENTATION_VERTICAL));
+ = GTK_CONTAINER(gtk_paned_new
+ (GTK_ORIENTATION_VERTICAL));
gtk_box_pack_end(GTK_BOX(w_main_box),
GTK_WIDGET(w_sensor_box), TRUE, TRUE, 2);
if (sensorlist_pos == SENSORLIST_POSITION_RIGHT
|| sensorlist_pos == SENSORLIST_POSITION_BOTTOM) {
- gtk_paned_pack1(w_sensor_box, w_graph, TRUE, TRUE);
- gtk_paned_pack2(w_sensor_box,
+ gtk_paned_pack1(GTK_PANED(w_sensor_box), w_graph, TRUE, TRUE);
+ gtk_paned_pack2(GTK_PANED(w_sensor_box),
w_sensors_scrolled_tree,
FALSE,
TRUE);
} else {
- gtk_paned_pack1(w_sensor_box,
+ gtk_paned_pack1(GTK_PANED(w_sensor_box),
w_sensors_scrolled_tree,
FALSE,
TRUE);
- gtk_paned_pack2(w_sensor_box, w_graph, TRUE, TRUE);
+ gtk_paned_pack2(GTK_PANED(w_sensor_box), w_graph, TRUE, TRUE);
}
g_object_unref(w_sensors_scrolled_tree);
{
struct ui_psensor *ui = data;
- save_window_pos(ui);
-
log_debug("is_status_supported: %d\n", is_status_supported());
- if (is_appindicator_supported() || is_status_supported())
+ if (is_appindicator_supported() || is_status_supported()) {
+ save_window_pos(ui);
gtk_widget_hide(ui->main_window);
- else
+ } else {
ui_psensor_quit(ui);
+ }
return TRUE;
}
-void ui_show_about_dialog(void)
+void ui_show_about_dialog(GtkWindow *parent)
{
static const char *const authors[] = { "jeanfi@gmail.com", NULL };
+ log_fct("parent=%p", parent);
+
gtk_show_about_dialog
- (NULL,
+ (parent,
"authors", authors,
"comments",
_("Psensor is a GTK+ application for monitoring hardware "
"sensors"),
"copyright",
- _("Copyright(c) 2010-2014 jeanfi@gmail.com"),
+ _("Copyright(c) 2010-2016 jeanfi@gmail.com"),
#if GTK_CHECK_VERSION(3, 12, 0)
"license-type", GTK_LICENSE_GPL_2_0,
#endif
NULL);
}
-void ui_cb_about(GtkMenuItem *mi, gpointer data)
+void ui_cb_about(GtkAction *a, gpointer data)
{
- ui_show_about_dialog();
+ struct ui_psensor *ui;
+ GtkWidget *parent;
+
+ ui = (struct ui_psensor *)data;
+
+ log_fct("ui=%p", ui);
+
+ if (ui)
+ parent = ui->main_window;
+ else
+ parent = NULL;
+
+ ui_show_about_dialog(GTK_WINDOW(parent));
}
void ui_cb_menu_quit(GtkMenuItem *mi, gpointer data)
GtkBuilder *builder;
GError *error;
+ log_fct("ui=%p", ui);
+
builder = gtk_builder_new();
error = NULL;
window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
gtk_builder_connect_signals(builder, ui);
+
cfg = ui->config;
- if (cfg->window_restore_enabled)
- gtk_window_move(GTK_WINDOW(window),
- cfg->window_x,
- cfg->window_y);
config_set_slog_enabled_changed_cbk(slog_enabled_cbk, ui);
w_graph = GTK_WIDGET(gtk_builder_get_object(builder, "graph"));
ui_graph_create(ui);
- w_sensor_box = GTK_PANED(gtk_builder_get_object(builder,
- "sensor_box"));
+ w_sensor_box = GTK_CONTAINER(gtk_builder_get_object(builder,
+ "sensor_box"));
ui->sensors_store = GTK_LIST_STORE(gtk_builder_get_object
(builder, "sensors_store"));
ui->sensors_tree = GTK_TREE_VIEW(gtk_builder_get_object
(builder, "sensors_tree"));
w_sensors_scrolled_tree
- = GTK_SCROLLED_WINDOW(gtk_builder_get_object
- (builder, "sensors_scrolled_tree"));
+ = GTK_WIDGET(gtk_builder_get_object
+ (builder, "sensors_scrolled_tree"));
ui_sensorlist_create(ui);
log_debug("ui_window_create() ends");
}
-void ui_window_update(struct ui_psensor *ui)
+void ui_window_show(struct ui_psensor *ui)
{
struct config *cfg;
- enum sensorlist_position sensorlist_pos;
- log_debug("ui_window_update()");
+ log_debug("ui_window_show()");
cfg = ui->config;
+ if (cfg->window_restore_enabled) {
+ gtk_paned_set_position(GTK_PANED(w_sensor_box),
+ cfg->window_divider_pos);
+ gtk_window_move(GTK_WINDOW(ui->main_window),
+ cfg->window_x,
+ cfg->window_y);
+ }
- if (cfg->window_restore_enabled)
- gtk_paned_set_position(w_sensor_box, cfg->window_divider_pos);
-
-}
-
-void ui_window_show(struct ui_psensor *ui)
-{
- log_debug("ui_window_show()");
- ui_window_update(ui);
gtk_window_present(GTK_WINDOW(ui->main_window));
}