Indent fix

This commit is contained in:
Fabio Manganiello 2022-01-25 20:54:26 +01:00
parent 50a5ec3312
commit 7f0cb722a3
1 changed files with 34 additions and 35 deletions

View File

@ -25,54 +25,53 @@
GtkWidget *constructor(LXPanel *panel, config_setting_t *settings) GtkWidget *constructor(LXPanel *panel, config_setting_t *settings)
{ {
/* panel is a pointer to the panel and /* panel is a pointer to the panel and
settings is a pointer to the configuration data settings is a pointer to the configuration data
since we don't use it, we'll make sure it doesn't since we don't use it, we'll make sure it doesn't
give us an error at compilation time */ give us an error at compilation time */
(void)panel; (void)panel;
(void)settings; (void)settings;
// make a label out of the hostname // make a label out of the hostname
char cIdBuf[LabelSize+1] = {'\0'}; char cIdBuf[LabelSize + 1] = {'\0'};
FILE *fp; FILE *fp;
fp = fopen("/etc/hostname", "r"); fp = fopen("/etc/hostname", "r");
fgets(cIdBuf, LabelSize, fp); fgets(cIdBuf, LabelSize, fp);
fclose(fp); fclose(fp);
// create a label widget instance // create a label widget instance
GtkWidget *pLabel = gtk_label_new(cIdBuf); GtkWidget *pLabel = gtk_label_new(cIdBuf);
// set the label to be visible // set the label to be visible
gtk_widget_show(pLabel); gtk_widget_show(pLabel);
// need to create a container to be able to set a border // need to create a container to be able to set a border
GtkWidget *p = gtk_event_box_new(); GtkWidget *p = gtk_event_box_new();
// our widget doesn't have a window... // our widget doesn't have a window...
// it is usually illegal to call gtk_widget_set_has_window() from application but for GtkEventBox it doesn't hurt // it is usually illegal to call gtk_widget_set_has_window() from application but for GtkEventBox it doesn't hurt
gtk_widget_set_has_window(p, FALSE); gtk_widget_set_has_window(p, FALSE);
// set border width // set border width
gtk_container_set_border_width(GTK_CONTAINER(p), 1); gtk_container_set_border_width(GTK_CONTAINER(p), 1);
// add the label to the container // add the label to the container
gtk_container_add(GTK_CONTAINER(p), pLabel); gtk_container_add(GTK_CONTAINER(p), pLabel);
// set the size we want // set the size we want
// gtk_widget_set_size_request(p, 100, 25); // gtk_widget_set_size_request(p, 100, 25);
// success!!! // success!!!
return p; return p;
} }
FM_DEFINE_MODULE(lxpanel_gtk, test) FM_DEFINE_MODULE(lxpanel_gtk, test)
/* Plugin descriptor. */ /* Plugin descriptor. */
LXPanelPluginInit fm_module_init_lxpanel_gtk = { LXPanelPluginInit fm_module_init_lxpanel_gtk = {
.name = "CutiePi battery", .name = "CutiePi battery",
.description = "Displays the current state of the CutiePi battery", .description = "Displays the current state of the CutiePi battery",
.one_per_system = 1, .one_per_system = 1,
// assigning our functions to provided pointers. // assigning our functions to provided pointers.
.new_instance = constructor .new_instance = constructor};
};