gnome-commander r1796 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1796 - in trunk: . src
- Date: Fri, 30 May 2008 20:45:49 +0000 (UTC)
Author: epiotr
Date: Fri May 30 20:45:49 2008
New Revision: 1796
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1796&view=rev
Log:
Code cleanup
Modified:
trunk/ChangeLog
trunk/src/block.cc
trunk/src/cap.cc
trunk/src/gnome-cmd-about-plugin.cc
trunk/src/gnome-cmd-bookmark-dialog.cc
trunk/src/gnome-cmd-bookmark-dialog.h
trunk/src/gnome-cmd-cmdline.h
trunk/src/gnome-cmd-prepare-xfer-dialog.cc
Modified: trunk/src/block.cc
==============================================================================
--- trunk/src/block.cc (original)
+++ trunk/src/block.cc Fri May 30 20:45:49 2008
@@ -24,12 +24,13 @@
int main (int argc, char **argv)
{
- FILE *fd = fdopen (0, "r");
-
printf ("--------------------------------------------------------------\n");
printf ("The program has now finished, press Enter to close this window\n");
+ FILE *fd = fdopen (0, "r");
+
getc(fd);
fclose(fd);
+
return 0;
}
Modified: trunk/src/cap.cc
==============================================================================
--- trunk/src/cap.cc (original)
+++ trunk/src/cap.cc Fri May 30 20:45:49 2008
@@ -35,8 +35,7 @@
static GnomeCmdFileList *_fl = NULL;
-static void
-on_xfer_done (GList *files, gpointer data)
+static void on_xfer_done (GList *files, gpointer data)
{
if (files != NULL)
gnome_cmd_file_list_free (files);
Modified: trunk/src/gnome-cmd-about-plugin.cc
==============================================================================
--- trunk/src/gnome-cmd-about-plugin.cc (original)
+++ trunk/src/gnome-cmd-about-plugin.cc Fri May 30 20:45:49 2008
@@ -423,7 +423,7 @@
inline void gnome_cmd_about_plugin_set_comments (GnomeCmdAboutPlugin *about, const gchar *comments)
{
g_free (about->priv->comments);
- about->priv->comments = comments ? g_strdup (comments) : NULL;
+ about->priv->comments = g_strdup (comments);
gtk_label_set_text (GTK_LABEL (about->priv->comments_label), about->priv->comments);
}
@@ -451,19 +451,17 @@
static void gnome_cmd_about_plugin_set_copyright (GnomeCmdAboutPlugin *about, const gchar *copyright)
{
- char *copyright_string, *tmp;
+ char *copyright_string = NULL;
g_free (about->priv->copyright);
- about->priv->copyright = copyright ? g_strdup (copyright) : NULL;
+ about->priv->copyright = g_strdup (copyright);
if (about->priv->copyright)
{
- tmp = g_markup_escape_text (about->priv->copyright, -1);
+ char *tmp = g_markup_escape_text (about->priv->copyright, -1);
copyright_string = g_strdup_printf ("<span size=\"small\">%s</span>", tmp);
g_free (tmp);
}
- else
- copyright_string = NULL;
gtk_label_set_markup (GTK_LABEL (about->priv->copyright_label), copyright_string);
@@ -474,7 +472,7 @@
static void gnome_cmd_about_plugin_set_version (GnomeCmdAboutPlugin *about, const gchar *version)
{
g_free (about->priv->version);
- about->priv->version = version ? g_strdup (version) : NULL;
+ about->priv->version = g_strdup (version);
gchar *name_string;
gchar *tmp_name = g_markup_escape_text (about->priv->name, -1);
Modified: trunk/src/gnome-cmd-bookmark-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-bookmark-dialog.cc (original)
+++ trunk/src/gnome-cmd-bookmark-dialog.cc Fri May 30 20:45:49 2008
@@ -81,20 +81,18 @@
}
-static void
-do_add_bookmark (GnomeCmdBookmarkDialog *dialog, GnomeCmdBookmark *bookmark)
+static void do_add_bookmark (GnomeCmdBookmarkDialog *dialog, GnomeCmdBookmark *bookmark)
{
- gint row;
- gchar *text[4];
-
g_return_if_fail (bookmark != NULL);
+ gchar *text[4];
+
text[0] = NULL;
text[1] = bookmark->name;
text[2] = bookmark->path;
text[3] = NULL;
- row = gtk_clist_append (GTK_CLIST (dialog->priv->dir_list), text);
+ gint row = gtk_clist_append (GTK_CLIST (dialog->priv->dir_list), text);
gtk_clist_set_row_data (GTK_CLIST (dialog->priv->dir_list), row, bookmark);
gtk_clist_set_pixmap (GTK_CLIST (dialog->priv->dir_list), row, 0,
@@ -103,8 +101,7 @@
}
-static void
-set_selected_group (GnomeCmdBookmarkDialog *dialog, GnomeCmdBookmarkGroup *group)
+static void set_selected_group (GnomeCmdBookmarkDialog *dialog, GnomeCmdBookmarkGroup *group)
{
g_return_if_fail (group != NULL);
@@ -233,11 +230,9 @@
}
-static void
-on_dir_moved (GtkCList *clist, gint arg1, gint arg2, GnomeCmdBookmarkDialog *dialog)
+static void on_dir_moved (GtkCList *clist, gint arg1, gint arg2, GnomeCmdBookmarkDialog *dialog)
{
GList *bookmarks = dialog->priv->sel_group->bookmarks;
- gpointer data;
if (!bookmarks
|| MAX (arg1, arg2) >= g_list_length (bookmarks)
@@ -245,7 +240,7 @@
|| arg1 == arg2)
return;
- data = g_list_nth_data (bookmarks, arg1);
+ gpointer data = g_list_nth_data (bookmarks, arg1);
bookmarks = g_list_remove (bookmarks, data);
bookmarks = g_list_insert (bookmarks, data, arg2);
@@ -259,19 +254,21 @@
}
-static gboolean
-on_dialog_keypress (GnomeCmdBookmarkDialog *dialog, GdkEventKey *event)
+static gboolean on_dialog_keypress (GnomeCmdBookmarkDialog *dialog, GdkEventKey *event)
{
- if (event->keyval == GDK_Escape) {
- gtk_widget_destroy (GTK_WIDGET (dialog));
- return TRUE;
- }
- else if (event->keyval == GDK_Return) {
- on_dir_goto (NULL, dialog);
- return TRUE;
- }
+ switch (event->keyval)
+ {
+ case GDK_Escape:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ return TRUE;
+
+ case GDK_Return:
+ on_dir_goto (NULL, dialog);
+ return TRUE;
- return FALSE;
+ default:
+ return FALSE;
+ }
}
@@ -330,10 +327,11 @@
static void add_bookmarks (GnomeCmdBookmarkDialog *dialog)
{
GnomeCmdCon *current_con = gnome_cmd_file_selector_get_connection (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
- GnomeCmdBookmarkGroup *group, *current_group = NULL;
g_return_if_fail (current_con != NULL);
+ GnomeCmdBookmarkGroup *group, *current_group = NULL;
+
// Then add bookmarks for all connections
for (GList *all_cons = gnome_cmd_con_list_get_all (gnome_cmd_con_list_get ()); all_cons; all_cons = all_cons->next)
{
@@ -384,8 +382,7 @@
* Gtk class implementation
*******************************/
-static void
-destroy (GtkObject *object)
+static void destroy (GtkObject *object)
{
GnomeCmdBookmarkDialog *dialog = GNOME_CMD_BOOKMARK_DIALOG (object);
@@ -399,16 +396,14 @@
}
-static void
-map (GtkWidget *widget)
+static void map (GtkWidget *widget)
{
if (GTK_WIDGET_CLASS (parent_class)->map != NULL)
GTK_WIDGET_CLASS (parent_class)->map (widget);
}
-static void
-class_init (GnomeCmdBookmarkDialogClass *klass)
+static void class_init (GnomeCmdBookmarkDialogClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
@@ -419,8 +414,7 @@
}
-static void
-init (GnomeCmdBookmarkDialog *in_dialog)
+static void init (GnomeCmdBookmarkDialog *in_dialog)
{
GtkWidget *dialog;
GtkWidget *cat;
@@ -521,8 +515,7 @@
* Public functions
***********************************/
-GtkType
-gnome_cmd_bookmark_dialog_get_type (void)
+GtkType gnome_cmd_bookmark_dialog_get_type (void)
{
static GtkType dlg_type = 0;
@@ -546,8 +539,7 @@
}
-GtkWidget *
-gnome_cmd_bookmark_dialog_new (void)
+GtkWidget *gnome_cmd_bookmark_dialog_new (void)
{
GnomeCmdBookmarkDialog *dialog = (GnomeCmdBookmarkDialog *) gtk_type_new (gnome_cmd_bookmark_dialog_get_type ());
@@ -560,8 +552,7 @@
}
-static gboolean
-on_new_bookmark_ok (GnomeCmdStringDialog *string_dialog, const gchar **values, gpointer data)
+static gboolean on_new_bookmark_ok (GnomeCmdStringDialog *string_dialog, const gchar **values, gpointer data)
{
GnomeCmdBookmark *bookmark = g_new0 (GnomeCmdBookmark, 1);
GnomeCmdCon *con = gnome_cmd_file_selector_get_connection (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
@@ -579,13 +570,13 @@
}
-void
-gnome_cmd_bookmark_add_current (void)
+void gnome_cmd_bookmark_add_current (void)
{
GnomeCmdDir *cwd = gnome_cmd_file_selector_get_directory (gnome_cmd_main_win_get_fs (main_win, ACTIVE));
gchar *path = gnome_cmd_file_get_path (GNOME_CMD_FILE (cwd));
- if (!g_utf8_validate (path, -1, NULL)) {
+ if (!g_utf8_validate (path, -1, NULL))
+ {
create_error_dialog (_("To bookmark a directory the whole search path to the directory must be in valid UTF-8 encoding\n"));
g_free (path);
return;
@@ -602,11 +593,12 @@
void gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark)
{
+ g_return_if_fail (bookmark->group->con != NULL);
+
GnomeCmdFileSelector *fs = gnome_cmd_main_win_get_fs (main_win, ACTIVE);
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
GnomeCmdCon *current_con = gnome_cmd_file_selector_get_connection (fs);
- g_return_if_fail (bookmark->group->con != NULL);
if (current_con == bookmark->group->con)
gnome_cmd_file_selector_goto_directory (fs, bookmark->path);
Modified: trunk/src/gnome-cmd-bookmark-dialog.h
==============================================================================
--- trunk/src/gnome-cmd-bookmark-dialog.h (original)
+++ trunk/src/gnome-cmd-bookmark-dialog.h Fri May 30 20:45:49 2008
@@ -51,19 +51,12 @@
extern guint bookmark_dialog_default_column_width[BOOKMARK_DIALOG_NUM_COLUMNS];
-GtkWidget*
-gnome_cmd_bookmark_dialog_new (void);
+GtkWidget *gnome_cmd_bookmark_dialog_new (void);
-GtkType
-gnome_cmd_bookmark_dialog_get_type (void);
+GtkType gnome_cmd_bookmark_dialog_get_type (void);
-void
-gnome_cmd_bookmark_add_current (void);
+void gnome_cmd_bookmark_add_current (void);
-void
-gnome_cmd_bookmark_add_current (void);
-
-void
-gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark);
+void gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark);
#endif // __GNOME_CMD_BOOKMARK_DIALOG_H__
Modified: trunk/src/gnome-cmd-cmdline.h
==============================================================================
--- trunk/src/gnome-cmd-cmdline.h (original)
+++ trunk/src/gnome-cmd-cmdline.h Fri May 30 20:45:49 2008
@@ -45,50 +45,30 @@
};
-GtkWidget*
-gnome_cmd_cmdline_new (void);
+GtkWidget *gnome_cmd_cmdline_new (void);
-GtkType
-gnome_cmd_cmdline_get_type (void);
+GtkType gnome_cmd_cmdline_get_type (void);
-void
-gnome_cmd_cmdline_set_dir (GnomeCmdCmdline *cmdline, const gchar *cwd);
+GtkWidget *gnome_cmd_cmdline_get_entry (GnomeCmdCmdline *cmdline);
-void
-gnome_cmd_cmdline_append_text (GnomeCmdCmdline *cmdline, const gchar *text);
+void gnome_cmd_cmdline_set_dir (GnomeCmdCmdline *cmdline, const gchar *cwd);
-void
-gnome_cmd_cmdline_insert_text (GnomeCmdCmdline *cmdline, const gchar *text);
+void gnome_cmd_cmdline_append_text (GnomeCmdCmdline *cmdline, const gchar *text);
+void gnome_cmd_cmdline_insert_text (GnomeCmdCmdline *cmdline, const gchar *text);
+void gnome_cmd_cmdline_set_text (GnomeCmdCmdline *cmdline, const gchar *text);
-void
-gnome_cmd_cmdline_set_text (GnomeCmdCmdline *cmdline, const gchar *text);
+gboolean gnome_cmd_cmdline_is_empty (GnomeCmdCmdline *cmdline);
-gboolean
-gnome_cmd_cmdline_is_empty (GnomeCmdCmdline *cmdline);
+void gnome_cmd_cmdline_exec (GnomeCmdCmdline *cmdline);
-void
-gnome_cmd_cmdline_exec (GnomeCmdCmdline *cmdline);
+void gnome_cmd_cmdline_focus (GnomeCmdCmdline *cmdline);
-void
-gnome_cmd_cmdline_focus (GnomeCmdCmdline *cmdline);
+void gnome_cmd_cmdline_update_style (GnomeCmdCmdline *cmdline);
-void
-gnome_cmd_cmdline_update_style (GnomeCmdCmdline *cmdline);
+GList *gnome_cmd_cmdline_get_history (GnomeCmdCmdline *cmdline);
+void gnome_cmd_cmdline_set_history (GnomeCmdCmdline *cmdline, GList *history);
+void gnome_cmd_cmdline_show_history (GnomeCmdCmdline *cmdline);
-void
-gnome_cmd_cmdline_show_history (GnomeCmdCmdline *cmdline);
-
-GList *
-gnome_cmd_cmdline_get_history (GnomeCmdCmdline *cmdline);
-
-void
-gnome_cmd_cmdline_set_history (GnomeCmdCmdline *cmdline, GList *history);
-
-GtkWidget *
-gnome_cmd_cmdline_get_entry (GnomeCmdCmdline *cmdline);
-
-gboolean
-gnome_cmd_cmdline_keypressed (GnomeCmdCmdline *cmdline,
- GdkEventKey *event);
+gboolean gnome_cmd_cmdline_keypressed (GnomeCmdCmdline *cmdline, GdkEventKey *event);
#endif // __GNOME_CMD_CMDLINE_H__
Modified: trunk/src/gnome-cmd-prepare-xfer-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-prepare-xfer-dialog.cc (original)
+++ trunk/src/gnome-cmd-prepare-xfer-dialog.cc Fri May 30 20:45:49 2008
@@ -146,7 +146,7 @@
// There exists a directory, copy to it
dest_dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, dest_path));
}
- else
+ else
if (res == GNOME_VFS_OK)
{
// There exists something which is not a directory, abort!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]