[Pkg-wmaker-commits] [wmshutdown] 144/173: wmshutdown.c: Consistent code style; no warnings or errors from checkpatch.pl in Window Maker source tree.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:46:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmshutdown.
commit c71da9dc865699024b1f539def62cb56d1973df2
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Mon Oct 27 19:37:11 2014 -0500
wmshutdown.c: Consistent code style; no warnings or errors from checkpatch.pl
in Window Maker source tree.
---
wmshutdown.c | 81 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 41 insertions(+), 40 deletions(-)
diff --git a/wmshutdown.c b/wmshutdown.c
index 0d4cd43..8602d9c 100644
--- a/wmshutdown.c
+++ b/wmshutdown.c
@@ -41,22 +41,21 @@
#define DBUS_DESTINATION "org.freedesktop.login1"
#endif
-static int showVersion = 0;
+static int showVersion;
GtkWidget *dialog = NULL;
-static GOptionEntry entries[] =
-{
+static GOptionEntry entries[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &showVersion,
"Display version information", NULL },
{ NULL }
};
-
/* gtk3 dockapp code based on wmpasman by Brad Jorsch
* <anomie at users.sourceforge.net>
* http://sourceforge.net/projects/wmpasman */
-GtkWidget *cria_dock(GtkWidget *mw, unsigned int s) {
+GtkWidget *cria_dock(GtkWidget *mw, unsigned int s)
+{
GdkDisplay *display;
GtkWidget *foobox;
@@ -70,36 +69,38 @@ GtkWidget *cria_dock(GtkWidget *mw, unsigned int s) {
gtk_widget_realize(foobox);
Display *d = GDK_DISPLAY_XDISPLAY(display);
- Window mainwin = GDK_WINDOW_XID(gtk_widget_get_window(mw));
- Window iw = GDK_WINDOW_XID(gtk_widget_get_window(foobox));
- Window p, dummy1, *dummy2;
- unsigned int dummy3;
- XQueryTree(d, mainwin, &dummy1, &p, &dummy2, &dummy3);
- if (dummy2) XFree(dummy2);
- Window w = XCreateSimpleWindow(d, p, 0, 0, 1, 1, 0, 0, 0);
- XReparentWindow(d, mainwin, w, 0, 0);
- gtk_widget_show(mw);
- gtk_widget_show(foobox);
- XWMHints *wmHints = XGetWMHints(d, mainwin);
- if (!wmHints) {
- wmHints = XAllocWMHints();
- }
- wmHints->flags |= IconWindowHint;
- wmHints->icon_window = iw;
- XSetWMHints(d, mainwin, wmHints);
- XFree(wmHints);
- XReparentWindow(d, mainwin, p, 0, 0);
- XDestroyWindow(d, w);
+ Window mainwin = GDK_WINDOW_XID(gtk_widget_get_window(mw));
+ Window iw = GDK_WINDOW_XID(gtk_widget_get_window(foobox));
+ Window p, dummy1, *dummy2;
+ unsigned int dummy3;
+ XQueryTree(d, mainwin, &dummy1, &p, &dummy2, &dummy3);
+ if (dummy2)
+ XFree(dummy2);
+ Window w = XCreateSimpleWindow(d, p, 0, 0, 1, 1, 0, 0, 0);
+ XReparentWindow(d, mainwin, w, 0, 0);
+ gtk_widget_show(mw);
+ gtk_widget_show(foobox);
+ XWMHints *wmHints = XGetWMHints(d, mainwin);
+ if (!wmHints)
+ wmHints = XAllocWMHints();
+ wmHints->flags |= IconWindowHint;
+ wmHints->icon_window = iw;
+ XSetWMHints(d, mainwin, wmHints);
+ XFree(wmHints);
+ XReparentWindow(d, mainwin, p, 0, 0);
+ XDestroyWindow(d, w);
return foobox;
}
-void fecha(void) {
+void fecha(void)
+{
gtk_widget_destroy(dialog);
dialog = NULL;
}
-void handle_click(GtkWidget *widget, gpointer data) {
+void handle_click(GtkWidget *widget, gpointer data)
+{
GDBusConnection *connection;
GDBusMessage *message, *reply;
GError *error = NULL;
@@ -141,7 +142,8 @@ void handle_click(GtkWidget *widget, gpointer data) {
g_object_unref(connection);
}
-void button_press(GtkWidget *widget, GdkEvent *event) {
+void button_press(GtkWidget *widget, GdkEvent *event)
+{
GtkWidget *label;
GtkWidget *halt_button;
GtkWidget *reboot_button;
@@ -186,40 +188,39 @@ void button_press(GtkWidget *widget, GdkEvent *event) {
G_CALLBACK(handle_click),
REBOOT_METHOD);
gtk_widget_show_all(dialog);
+ break;
default:
break;
}
}
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
GError *error = NULL;
GOptionContext *context;
GtkWidget *gtkiw;
GtkWidget *dockArea;
GtkWidget *pixmap;
-
gtk_init(&argc, &argv);
- context = g_option_context_new ("- dockapp to shutdown or reboot your "
- "machine");
- g_option_context_add_main_entries (context, entries, NULL);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- g_option_context_parse (context, &argc, &argv, &error);
+ context = g_option_context_new(
+ "- dockapp to shutdown or reboot your machine");
+ g_option_context_add_main_entries(context, entries, NULL);
+ g_option_context_add_group(context, gtk_get_option_group(TRUE));
+ g_option_context_parse(context, &argc, &argv, &error);
if (showVersion) {
printf(PACKAGE_STRING"\n");
return 0;
}
-
gtkiw = gtk_window_new(GTK_WINDOW_TOPLEVEL);
dockArea = cria_dock(gtkiw, 47);
-
pixmap = gtk_image_new_from_file(DATADIR"/wmshutdown.xpm");
- gtk_widget_show(pixmap);
- gtk_container_add(GTK_CONTAINER(dockArea), pixmap);
+ gtk_widget_show(pixmap);
+ gtk_container_add(GTK_CONTAINER(dockArea), pixmap);
gtk_widget_add_events(dockArea, GDK_BUTTON_PRESS_MASK);
g_signal_connect(dockArea, "button-press-event",
@@ -227,5 +228,5 @@ int main(int argc, char *argv[]) {
gtk_main();
- return(0);
+ return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmshutdown.git
More information about the Pkg-wmaker-commits
mailing list