[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 01/03: Code cleanup, some doxygen documentation
noreply at xfce.org
noreply at xfce.org
Sun Apr 16 22:37:41 CEST 2017
This is an automated email from the git hooks/post-receive script.
timystery pushed a commit to branch master
in repository panel-plugins/xfce4-sensors-plugin.
commit 9c175b129d10085aabfcf0eacd33de3a52ece33c
Author: Fabian <timystery at arcor.de>
Date: Sun Apr 9 22:02:51 2017 +0200
Code cleanup, some doxygen documentation
---
src/callbacks.h | 24 ++++++++++++
src/interface.c | 120 ++++++++++++++++++++++++++++----------------------------
src/interface.h | 4 +-
3 files changed, 85 insertions(+), 63 deletions(-)
diff --git a/src/callbacks.h b/src/callbacks.h
index e2b79d0..18396d7 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -51,25 +51,49 @@ void on_font_set (GtkWidget *widget, gpointer data);
/* Functions for implementing the sensors interface common callback functions */
+/**
+ * Implementation of interface callback adjustment_value_changed
+ */
void adjustment_value_changed_ (GtkWidget *widget, t_sensors_dialog *sd); // for update timer box
+/**
+ * Implementation of interface callback sensor_entry_changed_
+ */
void sensor_entry_changed_ (GtkWidget *widget, t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback list_cell_text_edited_
+ */
void list_cell_text_edited_ (GtkCellRendererText *cellrenderertext,
gchar *path_str, gchar *new_text, t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback list_cell_toggle_
+ */
void list_cell_toggle_ (GtkCellRendererToggle *cell, gchar *path_str,
t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback list_cell_color_edited_
+ */
void list_cell_color_edited_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
gchar *new_color, t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback minimum_changed_
+ */
void minimum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
gchar *new_value, t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback maximum_changed
+ */
void maximum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
gchar *new_value, t_sensors_dialog *sd);
+/**
+ * Implementation of interface callback temperature_unit_change
+ */
void temperature_unit_change_ (GtkWidget *widget, t_sensors_dialog *sd);
diff --git a/src/interface.c b/src/interface.c
index de7b133..dec84cd 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -44,81 +44,80 @@
/* forward declarations */
-void add_tachos_box (GtkWidget *child, t_sensors_dialog *);
-void add_notebook (GtkWidget *box, t_sensors_dialog *sd);
+void add_tachos_box (GtkWidget *ptr_childwidget, t_sensors_dialog *ptr_sensorsdialog);
+void add_notebook (GtkWidget *ptr_boxwidget, t_sensors_dialog *ptr_sensorsdialog);
/* actual implementations */
/* -------------------------------------------------------------------------- */
void
-add_tachos_box (GtkWidget *child, t_sensors_dialog *sd)
+add_tachos_box (GtkWidget *ptr_childwidget, t_sensors_dialog *ptr_sensorsdialog)
{
- GtkWidget *table;
-
- table = gtk_grid_new();
- gtk_grid_set_row_spacing(GTK_GRID(table), BORDER);
- gtk_grid_set_column_spacing(GTK_GRID(table), BORDER);
- gtk_widget_show (table);
- sd->sensors->widget_sensors = table;
- gtk_container_add (GTK_CONTAINER(child), table);
+ GtkWidget *ptr_gridwidget;
+
+ ptr_gridwidget = gtk_grid_new();
+ gtk_grid_set_row_spacing(GTK_GRID(ptr_gridwidget), BORDER);
+ gtk_grid_set_column_spacing(GTK_GRID(ptr_gridwidget), BORDER);
+ gtk_widget_show (ptr_gridwidget);
+ ptr_sensorsdialog->sensors->widget_sensors = ptr_gridwidget;
+ gtk_container_add (GTK_CONTAINER(ptr_childwidget), ptr_gridwidget);
}
/* -------------------------------------------------------------------------- */
void
-add_notebook (GtkWidget *box, t_sensors_dialog *sd)
+add_notebook (GtkWidget *ptr_boxwidget, t_sensors_dialog *ptr_sensorsdialog)
{
- GtkWidget *nb, *child, *tab_label, *scr_win, *fontbutton;
- //int res;
+ GtkWidget *ptr_notebook, *ptr_childvbox, *ptr_tablabel, *ptr_scrolledwindow, *ptr_fontbutton;
- nb = gtk_notebook_new();
- gtk_widget_show (nb);
+ ptr_notebook = gtk_notebook_new();
+ gtk_widget_show (ptr_notebook);
- child = gtk_vbox_new (FALSE, BORDER);
- gtk_container_set_border_width (GTK_CONTAINER (child), BORDER);
- gtk_widget_show (child);
+ ptr_childvbox = gtk_vbox_new (FALSE, BORDER);
+ gtk_container_set_border_width (GTK_CONTAINER (ptr_childvbox), BORDER);
+ gtk_widget_show (ptr_childvbox);
- add_type_box(child, sd);
- add_sensor_settings_box(child, sd);
- add_temperature_unit_box(child, sd);
- add_update_time_box (child, sd);
+ add_type_box(ptr_childvbox, ptr_sensorsdialog);
+ add_sensor_settings_box(ptr_childvbox, ptr_sensorsdialog);
+ add_temperature_unit_box(ptr_childvbox, ptr_sensorsdialog);
+ add_update_time_box (ptr_childvbox, ptr_sensorsdialog);
- tab_label = gtk_label_new_with_mnemonic(_("_Overview"));
- gtk_widget_show (tab_label);
- gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
+ ptr_tablabel = gtk_label_new_with_mnemonic(_("_Overview"));
+ gtk_widget_show (ptr_tablabel);
+ gtk_notebook_append_page (GTK_NOTEBOOK(ptr_notebook), ptr_childvbox, ptr_tablabel);
- child = gtk_vbox_new (FALSE, BORDER);
- gtk_container_set_border_width (GTK_CONTAINER (child), BORDER);
- gtk_widget_show (child);
+ ptr_childvbox = gtk_vbox_new (FALSE, BORDER);
+ gtk_container_set_border_width (GTK_CONTAINER (ptr_childvbox), BORDER);
+ gtk_widget_show (ptr_childvbox);
- scr_win = gtk_scrolled_window_new( NULL, NULL);
- gtk_box_pack_start(GTK_BOX(child), scr_win, TRUE, TRUE, 0);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scr_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_show_all (scr_win);
+ ptr_scrolledwindow = gtk_scrolled_window_new( NULL, NULL);
+ gtk_box_pack_start(GTK_BOX(ptr_childvbox), ptr_scrolledwindow, TRUE, TRUE, 0);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ptr_scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_widget_show_all (ptr_scrolledwindow);
- add_tachos_box (scr_win, sd);
+ add_tachos_box (ptr_scrolledwindow, ptr_sensorsdialog);
- fontbutton = gtk_font_button_new();
- g_signal_connect (G_OBJECT(fontbutton), "font-set", G_CALLBACK(on_font_set), sd);
- gtk_widget_show (fontbutton);
- gtk_box_pack_end (GTK_BOX(child), fontbutton, FALSE, FALSE, 0);
+ ptr_fontbutton = gtk_font_button_new();
+ g_signal_connect (G_OBJECT(ptr_fontbutton), "font-set", G_CALLBACK(on_font_set), ptr_sensorsdialog);
+ gtk_widget_show (ptr_fontbutton);
+ gtk_box_pack_end (GTK_BOX(ptr_childvbox), ptr_fontbutton, FALSE, FALSE, 0);
- tab_label = gtk_label_new_with_mnemonic(_("_Tachometers"));
- gtk_widget_show (tab_label);
- gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
+ ptr_tablabel = gtk_label_new_with_mnemonic(_("_Tachometers"));
+ gtk_widget_show (ptr_tablabel);
+ gtk_notebook_append_page (GTK_NOTEBOOK(ptr_notebook), ptr_childvbox, ptr_tablabel);
- gtk_box_pack_start(GTK_BOX(box), nb, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(ptr_boxwidget), ptr_notebook, TRUE, TRUE, 0);
}
/* -------------------------------------------------------------------------- */
GtkWidget *
-create_main_window (t_sensors_dialog *sd)
+create_main_window (t_sensors_dialog *ptr_sensorsdialog)
{
- GtkWidget *dlg, *vbox;
+ GtkWidget *ptr_xfcedialog, *ptr_contentareavbox;
/* start and populate */
- dlg = xfce_titled_dialog_new_with_buttons(
+ ptr_xfcedialog = xfce_titled_dialog_new_with_buttons(
_("Sensors Viewer"), // title
NULL, // parent window
0, // flags
@@ -126,32 +125,31 @@ create_main_window (t_sensors_dialog *sd)
GTK_RESPONSE_OK, // response id for previous button
NULL
);
- gtk_widget_show (dlg);
+ gtk_widget_show (ptr_xfcedialog);
- gtk_window_set_icon_name(GTK_WINDOW(dlg),"xfce-sensors");
+ gtk_window_set_icon_name(GTK_WINDOW(ptr_xfcedialog),"xfce-sensors");
- gtk_container_set_border_width (GTK_CONTAINER (dlg), BORDER>>1);
+ gtk_container_set_border_width (GTK_CONTAINER (ptr_xfcedialog), BORDER>>1);
- vbox = gtk_dialog_get_content_area(GTK_DIALOG (dlg));
- gtk_box_set_spacing(GTK_BOX(vbox), BORDER>>1);
+ ptr_contentareavbox = gtk_dialog_get_content_area(GTK_DIALOG (ptr_xfcedialog));
+ gtk_box_set_spacing(GTK_BOX(ptr_contentareavbox), BORDER>>1);
- gtk_widget_show (vbox);
+ gtk_widget_show (ptr_contentareavbox);
- sd->dialog = dlg;
+ ptr_sensorsdialog->dialog = ptr_xfcedialog;
- sd->myComboBox = gtk_combo_box_text_new();
- gtk_widget_show (sd->myComboBox);
+ ptr_sensorsdialog->myComboBox = gtk_combo_box_text_new();
+ gtk_widget_show (ptr_sensorsdialog->myComboBox);
- init_widgets (sd);
+ init_widgets (ptr_sensorsdialog);
- gtk_combo_box_set_active (GTK_COMBO_BOX(sd->myComboBox), 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(ptr_sensorsdialog->myComboBox), 0);
- add_notebook (vbox, sd);
+ add_notebook (ptr_contentareavbox, ptr_sensorsdialog);
- gtk_window_set_default_size (GTK_WINDOW(dlg), sd->sensors->preferred_width, sd->sensors->preferred_height);
+ gtk_window_set_default_size (GTK_WINDOW(ptr_xfcedialog), ptr_sensorsdialog->sensors->preferred_width, ptr_sensorsdialog->sensors->preferred_height);
+ g_signal_connect (G_OBJECT(ptr_xfcedialog), "response", G_CALLBACK(on_main_window_response), ptr_sensorsdialog); // also captures the dialog-destroy event and the closekeybinding-pressed event
- g_signal_connect (G_OBJECT(dlg), "response", G_CALLBACK(on_main_window_response), sd); // also captures the dialog-destroy event and the closekeybinding-pressed event
-
- return dlg;
+ return ptr_xfcedialog;
}
diff --git a/src/interface.h b/src/interface.h
index e9388c4..0637b53 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -27,7 +27,7 @@
/**
* Populate the application's main window
- * @param sd: pointers to already filled sensors dialog structure
+ * @param ptr_sensorsdialog: pointers to already filled sensors dialog structure
* @return newly allocated GtkWidget of main window
*/
-GtkWidget * create_main_window (t_sensors_dialog *sd);
+GtkWidget * create_main_window (t_sensors_dialog *ptr_sensorsdialog);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list