From 4417f2a62618da98a50db1d5d2bd4807a1163508 Mon Sep 17 00:00:00 2001 From: Jan Lipovský Date: Mon, 3 Jan 2011 14:57:25 +0100 Subject: Code cleanup --- globals.c | 2 +- globals.h | 2 -- gncpmount.c | 41 +++++++++++++++++++---------------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/globals.c b/globals.c index 64ad24d..86c48f3 100644 --- a/globals.c +++ b/globals.c @@ -11,7 +11,7 @@ void set_parameter_text (GtkWidget *entry, gchar **param) g_strstrip(tmp); - if(!strcmp(tmp,"")) + if(!g_strcmp0(tmp,"")) { g_free(tmp); tmp = g_strdup(NULL);; diff --git a/globals.h b/globals.h index e1172f3..907adf3 100644 --- a/globals.h +++ b/globals.h @@ -3,8 +3,6 @@ #include -#include - #define PROG_VERSION "0.0.3" #define GUI_TITLE "gncpmount - 0.0.3" diff --git a/gncpmount.c b/gncpmount.c index 797dd4c..ef71acc 100644 --- a/gncpmount.c +++ b/gncpmount.c @@ -1,6 +1,3 @@ -#include - - #include "keyfile.h" #include "ncpwrapper.h" #include "dialogs.h" @@ -104,7 +101,7 @@ enable_mount_button () * for mount point */ static void -open_folder (GtkWidget *wid, GtkWidget *win) +open_folder () { GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("Select folder - mount point", @@ -132,7 +129,7 @@ open_folder (GtkWidget *wid, GtkWidget *win) * and load cmd_params from file */ static void -open_file (GtkWidget *wid, GtkWidget *win) +open_file () { GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("Load options from file", @@ -162,7 +159,7 @@ open_file (GtkWidget *wid, GtkWidget *win) * and save cmd_params to file */ static void -save_file (GtkWidget *wid, GtkWidget *win) +save_file () { GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("Save options to file", @@ -202,7 +199,7 @@ save_file (GtkWidget *wid, GtkWidget *win) * Call ncpmount command */ static void -call_ncpmount (GtkWidget *wid, GtkWidget *win) +call_ncpmount () { save_gui_to_cmdparams(); run_ncpmount(); @@ -214,7 +211,7 @@ call_ncpmount (GtkWidget *wid, GtkWidget *win) * Set true if -P (password) is used or not */ static void -passwd_usage (GtkWidget *wid, GtkWidget *win) +passwd_usage () { cmd_params.n = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gui.check_n)); @@ -242,7 +239,7 @@ passwd_usage (GtkWidget *wid, GtkWidget *win) * Open Options dialog */ static void -run_options_dialog ( GtkWidget *w, gpointer data ) +run_options_dialog () { show_options_dialog(); } @@ -253,7 +250,7 @@ run_options_dialog ( GtkWidget *w, gpointer data ) * Open Show command dialog */ static void -run_command_dialog ( GtkWidget *w, gpointer data ) +run_command_dialog () { save_gui_to_cmdparams(); show_ncpmount_command(); @@ -265,7 +262,7 @@ run_command_dialog ( GtkWidget *w, gpointer data ) * Clear cmd_params and set gui to default */ static void -clear_gui ( GtkWidget *w, gpointer data ) +clear_gui () { clear_cmdparams(); set_gui_from_cmdparams(); @@ -276,16 +273,16 @@ clear_gui ( GtkWidget *w, gpointer data ) /** Menu, an array of GtkItemFactoryEntry structures that defines each menu item */ static GtkItemFactoryEntry menu_items[] = { - { "/_File", NULL, NULL, 0, "" }, - { "/File/_New", "N", clear_gui, 0, "", GTK_STOCK_NEW }, - { "/File/_Load", "L", open_file, 0, "", GTK_STOCK_OPEN }, - { "/File/_Save", "S", save_file, 0, "", GTK_STOCK_SAVE }, - { "/File/sep1", NULL, NULL, 0, "" }, - { "/File/_Quit", "Q", gtk_main_quit, 0, "", GTK_STOCK_QUIT }, - { "/Tools", NULL, NULL, 0, "" }, - { "/_Tools/Options", "O", run_options_dialog, 0, "" }, - { "/_Tools/Show command", NULL, run_command_dialog, 0, "" }, - { "/_Help", NULL, NULL, 0, "" }, + { "/_File", NULL, NULL, 0, "", NULL}, + { "/File/_New", "N", clear_gui, 0, "", GTK_STOCK_NEW}, + { "/File/_Load", "L", open_file, 0, "", GTK_STOCK_OPEN}, + { "/File/_Save", "S", save_file, 0, "", GTK_STOCK_SAVE}, + { "/File/sep1", NULL, NULL, 0, "", NULL}, + { "/File/_Quit", "Q", gtk_main_quit, 0, "", GTK_STOCK_QUIT}, + { "/Tools", NULL, NULL, 0, "", NULL }, + { "/_Tools/Options", "O", run_options_dialog, 0, "", NULL}, + { "/_Tools/Show command", NULL, run_command_dialog, 0, "", NULL}, + { "/_Help", NULL, NULL, 0, "", NULL}, { "/_Help/About...", NULL, show_about, 0, "", GTK_STOCK_ABOUT}, }; @@ -472,7 +469,7 @@ int main (int argc, char *argv[]) gtk_box_pack_start (GTK_BOX (gui.btnbox), gui.btn_close, TRUE, TRUE, 0); - /* Fill in informations from cmd_params to wiidgets */ + /* Fill in informations from cmd_params to widgets */ clear_cmdparams (); set_gui_from_cmdparams(); -- cgit