gnome-commander r2213 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Sat Oct 18 10:58:14 2008
New Revision: 2213
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2213&view=rev

Log:
Replaced gnome_cmd_file_list_new() with GnomeCmdFileList::operator new()

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/gnome-cmd-file-list.cc
   branches/gcmd-1-3/src/gnome-cmd-file-list.h
   branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
   branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc

Modified: branches/gcmd-1-3/src/gnome-cmd-file-list.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-list.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-list.cc	Sat Oct 18 10:58:14 2008
@@ -1346,19 +1346,6 @@
 }
 
 
-GtkWidget *gnome_cmd_file_list_new (GtkSignalFunc handler, GtkObject *object)
-{
-    GnomeCmdFileList *fl = (GnomeCmdFileList *) g_object_new (gnome_cmd_file_list_get_type (), "n-columns", GnomeCmdFileList::NUM_COLUMNS, NULL);
-
-    fl->create_column_titles();
-
-    if (handler)
-        gtk_signal_connect (*fl, "files-changed", handler, object);
-
-    return GTK_WIDGET (fl);
-}
-
-
 guint GnomeCmdFileList::get_column_default_width (GnomeCmdFileList::ColumnID col)
 {
     return file_list_column[col].default_width;

Modified: branches/gcmd-1-3/src/gnome-cmd-file-list.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-list.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-list.h	Sat Oct 18 10:58:14 2008
@@ -52,7 +52,7 @@
 {
     GnomeCmdCList parent;
 
-  // private:
+  private:
 
     void create_column_titles();
 
@@ -62,6 +62,9 @@
 
     Private *priv;
 
+    void *operator new (size_t size);
+    void operator delete (void *p)      {  g_free (p);  }
+
     operator GtkObject * ()             {  return GTK_OBJECT (this);       }
     operator GtkCList * ()              {  return GTK_CLIST (this);        }
     operator GnomeCmdCList * ()         {  return GNOME_CMD_CLIST (this);  }
@@ -84,7 +87,7 @@
     GnomeCmdDir *cwd, *lwd;         // current & last working dir
     GnomeCmdDir *connected_dir;
 
-    GnomeCmdFileList();
+    GnomeCmdFileList(GtkSignalFunc handler=NULL, GtkObject *object=NULL);
     ~GnomeCmdFileList();
 
     int size();
@@ -164,10 +167,23 @@
 
 
 GtkType gnome_cmd_file_list_get_type ();
-GtkWidget *gnome_cmd_file_list_new (GtkSignalFunc handler=NULL, GtkObject *object=NULL);
 
-inline GnomeCmdFileList::GnomeCmdFileList(): con(NULL), cwd(NULL), lwd(NULL), connected_dir(NULL)
+inline void *GnomeCmdFileList::operator new (size_t size)
+{
+    return g_object_new (gnome_cmd_file_list_get_type (), "n-columns", GnomeCmdFileList::NUM_COLUMNS, NULL);
+}
+
+inline GnomeCmdFileList::GnomeCmdFileList(GtkSignalFunc handler, GtkObject *object)
 {
+    con = NULL;
+    cwd = NULL;
+    lwd = NULL;
+    connected_dir = NULL;
+
+    create_column_titles();
+
+    if (handler)
+        gtk_signal_connect (*this, "files-changed", handler, object);
 }
 
 inline GnomeCmdFileList::~GnomeCmdFileList()

Modified: branches/gcmd-1-3/src/gnome-cmd-file-selector.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-selector.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-selector.cc	Sat Oct 18 10:58:14 2008
@@ -1171,11 +1171,10 @@
     fs->con_hbox = create_hbox (*fs, FALSE, 2);
 
     // create the list
-    fs->list_widget = gnome_cmd_file_list_new ();
+    fs->file_list() = new GnomeCmdFileList;             // FIXME: file_list() = ...
+    fs->list_widget = GTK_WIDGET (fs->file_list());
     gtk_widget_ref (fs->list_widget);
-    gtk_object_set_data_full (GTK_OBJECT (fs), "list_widget", fs->list_widget,
-                              (GtkDestroyNotify) gtk_widget_unref);
-    fs->file_list() = GNOME_CMD_FILE_LIST (fs->list_widget);            // FIXME: file_list() = ...
+    gtk_object_set_data_full (GTK_OBJECT (fs), "list_widget", fs->list_widget, (GtkDestroyNotify) gtk_widget_unref);
     fs->file_list()->show_column(GnomeCmdFileList::COLUMN_DIR, FALSE);
 
     // create the connection combo

Modified: branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-search-dialog.cc	Sat Oct 18 10:58:14 2008
@@ -917,7 +917,7 @@
     gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
-    dialog->priv->result_list = GNOME_CMD_FILE_LIST (gnome_cmd_file_list_new ());
+    dialog->priv->result_list = new GnomeCmdFileList;
     gtk_widget_ref (GTK_WIDGET (dialog->priv->result_list));
     gtk_object_set_data_full (GTK_OBJECT (window), "result_list", GTK_WIDGET (dialog->priv->result_list), (GtkDestroyNotify) gtk_widget_unref);
     gtk_widget_set_size_request (GTK_WIDGET (dialog->priv->result_list), -1, 200);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]