[gnome-commander] libgcmd: migration to C++



commit 75a4299db9f55b3bc9142720344d4df656a4fdb4
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Dec 8 21:37:37 2009 +0100

    libgcmd: migration to C++

 libgcmd/Makefile.am                                |   14 +++++++-------
 .../{gnome-cmd-dialog.c => gnome-cmd-dialog.cc}    |    4 ++--
 libgcmd/gnome-cmd-dialog.h                         |    4 ----
 ...nome-cmd-file-info.c => gnome-cmd-file-info.cc} |    2 +-
 libgcmd/gnome-cmd-file-info.h                      |    4 ----
 .../{gnome-cmd-plugin.c => gnome-cmd-plugin.cc}    |    2 +-
 libgcmd/gnome-cmd-plugin.h                         |    4 ----
 libgcmd/gnome-cmd-state.h                          |    4 ----
 ...-string-dialog.c => gnome-cmd-string-dialog.cc} |    6 +++---
 libgcmd/gnome-cmd-string-dialog.h                  |    5 -----
 libgcmd/{libgcmd-data.c => libgcmd-data.cc}        |    0
 libgcmd/libgcmd-data.h                             |    4 ----
 libgcmd/libgcmd-deps.h                             |    4 ----
 libgcmd/{libgcmd-utils.c => libgcmd-utils.cc}      |    0
 libgcmd/libgcmd-utils.h                            |    4 ----
 ...-widget-factory.c => libgcmd-widget-factory.cc} |    4 ++--
 libgcmd/libgcmd-widget-factory.h                   |    4 ----
 libgcmd/libgcmd.h                                  |    3 ---
 libgcmd/plugin-info.h                              |    4 ----
 po/POTFILES.in                                     |    2 +-
 src/main.cc                                        |    6 +++++-
 21 files changed, 22 insertions(+), 62 deletions(-)
---
diff --git a/libgcmd/Makefile.am b/libgcmd/Makefile.am
index 9473bd1..27ceac7 100644
--- a/libgcmd/Makefile.am
+++ b/libgcmd/Makefile.am
@@ -8,14 +8,14 @@ AM_CPPFLAGS = \
 pkglib_LTLIBRARIES = libgcmd.la
 
 libgcmd_la_SOURCES = \
-	gnome-cmd-plugin.h gnome-cmd-plugin.c \
-	gnome-cmd-file-info.h gnome-cmd-file-info.c \
-	gnome-cmd-dialog.h gnome-cmd-dialog.c \
-	gnome-cmd-string-dialog.h gnome-cmd-string-dialog.c \
+	gnome-cmd-plugin.h gnome-cmd-plugin.cc \
+	gnome-cmd-file-info.h gnome-cmd-file-info.cc \
+	gnome-cmd-dialog.h gnome-cmd-dialog.cc \
+	gnome-cmd-string-dialog.h gnome-cmd-string-dialog.cc \
 	gnome-cmd-state.h \
-	libgcmd-utils.h libgcmd-utils.c \
-	libgcmd-data.h libgcmd-data.c \
-	libgcmd-widget-factory.h libgcmd-widget-factory.c \
+	libgcmd-utils.h libgcmd-utils.cc \
+	libgcmd-data.h libgcmd-data.cc \
+	libgcmd-widget-factory.h libgcmd-widget-factory.cc \
 	plugin-info.h \
 	libgcmd-deps.h \
 	libgcmd.h
diff --git a/libgcmd/gnome-cmd-dialog.c b/libgcmd/gnome-cmd-dialog.cc
similarity index 97%
rename from libgcmd/gnome-cmd-dialog.c
rename to libgcmd/gnome-cmd-dialog.cc
index 97a21a1..f986c70 100644
--- a/libgcmd/gnome-cmd-dialog.c
+++ b/libgcmd/gnome-cmd-dialog.cc
@@ -79,7 +79,7 @@ static void class_init (GnomeCmdDialogClass *klass)
     GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-    parent_class = gtk_type_class (gtk_window_get_type ());
+    parent_class = (GtkWindowClass *) gtk_type_class (gtk_window_get_type ());
     object_class->destroy = destroy;
     widget_class->map = map;
 }
@@ -145,7 +145,7 @@ GtkType gnome_cmd_dialog_get_type ()
 
 GtkWidget *gnome_cmd_dialog_new (const gchar *title)
 {
-    GnomeCmdDialog *dialog = gtk_type_new (gnome_cmd_dialog_get_type ());
+    GnomeCmdDialog *dialog = (GnomeCmdDialog *) gtk_type_new (gnome_cmd_dialog_get_type ());
 
     if (title)
         gnome_cmd_dialog_setup (dialog, title);
diff --git a/libgcmd/gnome-cmd-dialog.h b/libgcmd/gnome-cmd-dialog.h
index 5d71509..6bca042 100644
--- a/libgcmd/gnome-cmd-dialog.h
+++ b/libgcmd/gnome-cmd-dialog.h
@@ -21,8 +21,6 @@
 #ifndef __GNOME_CMD_DIALOG_H__
 #define __GNOME_CMD_DIALOG_H__
 
-G_BEGIN_DECLS
-
 #define GNOME_CMD_DIALOG(obj) \
     GTK_CHECK_CAST (obj, gnome_cmd_dialog_get_type (), GnomeCmdDialog)
 #define GNOME_CMD_DIALOG_CLASS(klass) \
@@ -73,8 +71,6 @@ void gnome_cmd_dialog_set_modal (GnomeCmdDialog *dialog);
 
 void gnome_cmd_dialog_set_resizable (GnomeCmdDialog *dialog, gboolean value);
 
-G_END_DECLS
-
 #endif //__GNOME_CMD_DIALOG_H__
 
 
diff --git a/libgcmd/gnome-cmd-file-info.c b/libgcmd/gnome-cmd-file-info.cc
similarity index 97%
rename from libgcmd/gnome-cmd-file-info.c
rename to libgcmd/gnome-cmd-file-info.cc
index d597bb0..eeb94e0 100644
--- a/libgcmd/gnome-cmd-file-info.c
+++ b/libgcmd/gnome-cmd-file-info.cc
@@ -58,7 +58,7 @@ class_init (GnomeCmdFileInfoClass *klass)
     GtkObjectClass *object_class;
 
     object_class = GTK_OBJECT_CLASS (klass);
-    parent_class = gtk_type_class (gtk_object_get_type ());
+    parent_class = (GtkObjectClass *) gtk_type_class (gtk_object_get_type ());
 
     object_class->destroy = destroy;
 }
diff --git a/libgcmd/gnome-cmd-file-info.h b/libgcmd/gnome-cmd-file-info.h
index 61a0061..4092f47 100644
--- a/libgcmd/gnome-cmd-file-info.h
+++ b/libgcmd/gnome-cmd-file-info.h
@@ -21,8 +21,6 @@
 #ifndef __GNOME_CMD_FILE_INFO_H__
 #define __GNOME_CMD_FILE_INFO_H__
 
-G_BEGIN_DECLS
-
 #define GNOME_CMD_FILE_INFO(obj)          GTK_CHECK_CAST (obj, gnome_cmd_file_info_get_type (), GnomeCmdFileInfo)
 #define GNOME_CMD_FILE_INFO_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gnome_cmd_file_info_get_type (), GnomeCmdFileInfoClass)
 #define GNOME_CMD_IS_FILE_INFO(obj)       GTK_CHECK_TYPE (obj, gnome_cmd_file_info_get_type ())
@@ -52,6 +50,4 @@ GtkType gnome_cmd_file_info_get_type ();
 
 void gnome_cmd_file_info_setup (GnomeCmdFileInfo *f, GnomeVFSURI *uri, GnomeVFSFileInfo *info);
 
-G_END_DECLS
-
 #endif //__GNOME_CMD_FILE_INFO_H__
diff --git a/libgcmd/gnome-cmd-plugin.c b/libgcmd/gnome-cmd-plugin.cc
similarity index 97%
rename from libgcmd/gnome-cmd-plugin.c
rename to libgcmd/gnome-cmd-plugin.cc
index fb6f339..bb4855b 100644
--- a/libgcmd/gnome-cmd-plugin.c
+++ b/libgcmd/gnome-cmd-plugin.cc
@@ -51,7 +51,7 @@ class_init (GnomeCmdPluginClass *klass)
 
     object_class = GTK_OBJECT_CLASS (klass);
     plugin_class = GNOME_CMD_PLUGIN_CLASS (klass);
-    parent_class = gtk_type_class (gtk_object_get_type ());
+    parent_class = (GtkObjectClass *) gtk_type_class (gtk_object_get_type ());
 
     object_class->destroy = destroy;
 
diff --git a/libgcmd/gnome-cmd-plugin.h b/libgcmd/gnome-cmd-plugin.h
index 1c653f8..308e8b5 100644
--- a/libgcmd/gnome-cmd-plugin.h
+++ b/libgcmd/gnome-cmd-plugin.h
@@ -21,8 +21,6 @@
 #ifndef __GNOME_CMD_PLUGIN_H__
 #define __GNOME_CMD_PLUGIN_H__
 
-G_BEGIN_DECLS
-
 #define GNOME_CMD_PLUGIN(obj) \
     GTK_CHECK_CAST (obj, gnome_cmd_plugin_get_type (), GnomeCmdPlugin)
 #define GNOME_CMD_PLUGIN_CLASS(klass) \
@@ -64,6 +62,4 @@ void gnome_cmd_plugin_update_main_menu_state (GnomeCmdPlugin *plugin, GnomeCmdSt
 
 void gnome_cmd_plugin_configure (GnomeCmdPlugin *plugin);
 
-G_END_DECLS
-
 #endif //__GNOME_CMD_PLUGIN_H__
diff --git a/libgcmd/gnome-cmd-state.h b/libgcmd/gnome-cmd-state.h
index b9d044e..9da3ddc 100644
--- a/libgcmd/gnome-cmd-state.h
+++ b/libgcmd/gnome-cmd-state.h
@@ -21,8 +21,6 @@
 #ifndef __GNOME_CMD_STATE_H__
 #define __GNOME_CMD_STATE_H__
 
-G_BEGIN_DECLS
-
 typedef struct {
     GnomeVFSURI *active_dir_uri;
     GnomeVFSURI *inactive_dir_uri;
@@ -32,6 +30,4 @@ typedef struct {
     GList *inactive_dir_selected_files;
 } GnomeCmdState;
 
-G_END_DECLS
-
 #endif //__GNOME_CMD_STATE_H__
diff --git a/libgcmd/gnome-cmd-string-dialog.c b/libgcmd/gnome-cmd-string-dialog.cc
similarity index 96%
rename from libgcmd/gnome-cmd-string-dialog.c
rename to libgcmd/gnome-cmd-string-dialog.cc
index 77d824e..b410acf 100644
--- a/libgcmd/gnome-cmd-string-dialog.c
+++ b/libgcmd/gnome-cmd-string-dialog.cc
@@ -107,7 +107,7 @@ class_init (GnomeCmdStringDialogClass *klass)
     object_class = GTK_OBJECT_CLASS (klass);
     widget_class = GTK_WIDGET_CLASS (klass);
 
-    parent_class = gtk_type_class (gnome_cmd_dialog_get_type ());
+    parent_class = (GnomeCmdDialogClass *) gtk_type_class (gnome_cmd_dialog_get_type ());
     object_class->destroy = destroy;
     widget_class->map = map;
 }
@@ -142,7 +142,7 @@ setup_widget (GnomeCmdStringDialog *string_dialog, gint rows)
 
         string_dialog->entries[i] = create_entry (dialog, "entry", "");
         gtk_entry_set_activates_default (GTK_ENTRY (string_dialog->entries[i]), TRUE);
-        table_add (table, string_dialog->entries[i], 1, i, GTK_FILL|GTK_EXPAND);
+        table_add (table, string_dialog->entries[i], 1, i, GtkAttachOptions(GTK_FILL|GTK_EXPAND));
     }
 
     gnome_cmd_dialog_add_button (
@@ -194,7 +194,7 @@ gnome_cmd_string_dialog_new_with_cancel (const gchar *title,
                                          GtkSignalFunc cancel_cb,
                                          gpointer user_data)
 {
-    GnomeCmdStringDialog *dialog = gtk_type_new (gnome_cmd_string_dialog_get_type ());
+    GnomeCmdStringDialog *dialog = (GnomeCmdStringDialog *) gtk_type_new (gnome_cmd_string_dialog_get_type ());
 
     gnome_cmd_string_dialog_setup_with_cancel (dialog, title, labels, rows, ok_cb, cancel_cb, user_data);
 
diff --git a/libgcmd/gnome-cmd-string-dialog.h b/libgcmd/gnome-cmd-string-dialog.h
index d8489c0..8cb1ada 100644
--- a/libgcmd/gnome-cmd-string-dialog.h
+++ b/libgcmd/gnome-cmd-string-dialog.h
@@ -21,8 +21,6 @@
 #ifndef __GNOME_CMD_STRING_DIALOG_H__
 #define __GNOME_CMD_STRING_DIALOG_H__
 
-G_BEGIN_DECLS
-
 #define GNOME_CMD_STRING_DIALOG(obj) \
     GTK_CHECK_CAST (obj, gnome_cmd_string_dialog_get_type (), GnomeCmdStringDialog)
 #define GNOME_CMD_STRING_DIALOG_CLASS(klass) \
@@ -110,9 +108,6 @@ void gnome_cmd_string_dialog_set_value (GnomeCmdStringDialog *dialog, gint row,
 
 void gnome_cmd_string_dialog_set_error_desc (GnomeCmdStringDialog *dialog, gchar *msg);
 
-
-G_END_DECLS
-
 #endif //__GNOME_CMD_STRING_DIALOG_H__
 
 
diff --git a/libgcmd/libgcmd-data.c b/libgcmd/libgcmd-data.cc
similarity index 100%
rename from libgcmd/libgcmd-data.c
rename to libgcmd/libgcmd-data.cc
diff --git a/libgcmd/libgcmd-data.h b/libgcmd/libgcmd-data.h
index f6612f0..c47a45a 100644
--- a/libgcmd/libgcmd-data.h
+++ b/libgcmd/libgcmd-data.h
@@ -21,8 +21,6 @@
 #ifndef __LIBGCMD_DATA_H__
 #define __LIBGCMD_DATA_H__
 
-G_BEGIN_DECLS
-
 void gnome_cmd_data_set_string (const gchar *path, const gchar *value);
 
 void gnome_cmd_data_set_int (const gchar *path, int value);
@@ -39,6 +37,4 @@ gboolean gnome_cmd_data_get_bool (const gchar *path, gboolean def);
 
 void gnome_cmd_data_get_color (const gchar *path, GdkColor *color);
 
-G_END_DECLS
-
 #endif //__LIBGCMD_DATA_H__
diff --git a/libgcmd/libgcmd-deps.h b/libgcmd/libgcmd-deps.h
index 45d87c2..914aa30 100644
--- a/libgcmd/libgcmd-deps.h
+++ b/libgcmd/libgcmd-deps.h
@@ -23,8 +23,6 @@
 
 #include <glib.h>
 
-G_BEGIN_DECLS
-
 #include <gdk/gdk.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
@@ -36,6 +34,4 @@ G_BEGIN_DECLS
 
 extern GtkWidget *main_win_widget;
 
-G_END_DECLS
-
 #endif //__LIBGCMD_DEPS_H__
diff --git a/libgcmd/libgcmd-utils.c b/libgcmd/libgcmd-utils.cc
similarity index 100%
rename from libgcmd/libgcmd-utils.c
rename to libgcmd/libgcmd-utils.cc
diff --git a/libgcmd/libgcmd-utils.h b/libgcmd/libgcmd-utils.h
index b54b8f2..20c5929 100644
--- a/libgcmd/libgcmd-utils.h
+++ b/libgcmd/libgcmd-utils.h
@@ -21,8 +21,6 @@
 #ifndef __LIB_GCMD_UTILS_H__
 #define __LIB_GCMD_UTILS_H__
 
-G_BEGIN_DECLS
-
 gchar *get_utf8 (const gchar *unknown);
 
 gchar *get_bold_text (const gchar *in);
@@ -31,6 +29,4 @@ gchar *get_mono_text (const gchar *in);
 
 gchar *get_bold_mono_text (const gchar *in);
 
-G_END_DECLS
-
 #endif //__LIB_GCMD_UTILS_H__
diff --git a/libgcmd/libgcmd-widget-factory.c b/libgcmd/libgcmd-widget-factory.cc
similarity index 99%
rename from libgcmd/libgcmd-widget-factory.c
rename to libgcmd/libgcmd-widget-factory.cc
index fe08abb..9ccf6f5 100644
--- a/libgcmd/libgcmd-widget-factory.c
+++ b/libgcmd/libgcmd-widget-factory.cc
@@ -276,7 +276,7 @@ create_named_button (GtkWidget *parent, gchar *label, gchar *name, GtkSignalFunc
 GtkWidget *
 create_named_stock_button_with_data (GtkWidget *parent, gconstpointer stock, gchar *name, GtkSignalFunc func, gpointer data)
 {
-    GtkWidget *w = gtk_button_new_from_stock (stock);
+    GtkWidget *w = gtk_button_new_from_stock ((const gchar *) stock);
     gtk_widget_ref (w);
     gtk_object_set_data_full (GTK_OBJECT (parent), name, w,
                               (GtkDestroyNotify) gtk_widget_unref);
@@ -472,7 +472,7 @@ create_clist (GtkWidget *parent, gchar *name, gint cols, gint rowh,
 void
 create_clist_column (GtkWidget *sw, gint col, gint width, gchar *label)
 {
-    GtkWidget *clist = gtk_object_get_data (GTK_OBJECT (sw), "clist");
+    GtkWidget *clist = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (sw), "clist");
     gtk_clist_set_column_width (GTK_CLIST (clist), col, width);
     gtk_clist_set_column_title (GTK_CLIST (clist), col, label);
 }
diff --git a/libgcmd/libgcmd-widget-factory.h b/libgcmd/libgcmd-widget-factory.h
index 3c984da..fec173f 100644
--- a/libgcmd/libgcmd-widget-factory.h
+++ b/libgcmd/libgcmd-widget-factory.h
@@ -21,8 +21,6 @@
 #ifndef __LIBGCMD_WIDGET_FACTORY_H__
 #define __LIBGCMD_WIDGET_FACTORY_H__
 
-G_BEGIN_DECLS
-
 GtkWidget *lookup_widget (GtkWidget *widget, const gchar *widget_name);
 
 GtkWidget *create_frame (GtkWidget *parent, const gchar *text, gint spacing);
@@ -117,6 +115,4 @@ const char *get_entry_text (GtkWidget *parent, gchar *entry_name);
 
 void create_error_dialog (const gchar *msg, ...);
 
-G_END_DECLS
-
 #endif //__LIBGCMD_WIDGET_FACTORY_H__
diff --git a/libgcmd/libgcmd.h b/libgcmd/libgcmd.h
index 57f565b..05e5314 100644
--- a/libgcmd/libgcmd.h
+++ b/libgcmd/libgcmd.h
@@ -32,7 +32,4 @@
 #include <libgcmd/gnome-cmd-string-dialog.h>
 #include <libgcmd/plugin-info.h>
 
-G_BEGIN_DECLS
-G_END_DECLS
-
 #endif //__LIBGCMD_H__
diff --git a/libgcmd/plugin-info.h b/libgcmd/plugin-info.h
index 8093fef..52bfc38 100644
--- a/libgcmd/plugin-info.h
+++ b/libgcmd/plugin-info.h
@@ -21,8 +21,6 @@
 #ifndef __PLUGIN_INFO_H__
 #define __PLUGIN_INFO_H__
 
-G_BEGIN_DECLS
-
 /* This one should be increased when an api-incompatible change
  * is done to the plugin system. By doing that gcmd can detect
  * old plugins and avoid loading them.
@@ -52,6 +50,4 @@ typedef struct {
  */
 typedef PluginInfo *(*PluginInfoFunc)(void);
 
-G_END_DECLS
-
 #endif //__PLUGIN_INFO_H__
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e6bd1bb..469f648 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,7 @@
 # Please keep this file sorted alphabetically.
 [encoding: UTF-8]
 data/gnome-commander.desktop.in.in
-libgcmd/gnome-cmd-string-dialog.c
+libgcmd/gnome-cmd-string-dialog.cc
 plugins/cvs/cvs-plugin.cc
 plugins/cvs/interface.cc
 plugins/fileroller/file-roller-plugin.cc
diff --git a/src/main.cc b/src/main.cc
index 8fe3267..aef28bd 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -18,6 +18,11 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
+extern "C" 
+{
+    void gnome_authentication_manager_init ();
+}
+
 #include <config.h>
 #include <locale.h>
 
@@ -38,7 +43,6 @@
 
 using namespace std;
 
-
 GnomeCmdMainWin *main_win;
 GtkWidget *main_win_widget;
 gchar *start_dir_left;



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