[gnome-commander/gcmd-1-2-8] fileroller plugin: migration to C++
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-2-8] fileroller plugin: migration to C++
- Date: Tue, 8 Dec 2009 00:07:24 +0000 (UTC)
commit 35c78030844f5ca7cf25fe1b1f18ef13d43b9427
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Tue Dec 8 00:34:35 2009 +0100
fileroller plugin: migration to C++
plugins/fileroller/Makefile.am | 2 +-
...{file-roller-plugin.c => file-roller-plugin.cc} | 31 +++++++++----------
plugins/fileroller/file-roller-plugin.h | 5 ---
plugins/fileroller/file-roller-small.xpm | 2 +-
plugins/fileroller/file-roller.xpm | 2 +-
po/POTFILES.in | 2 +-
6 files changed, 19 insertions(+), 25 deletions(-)
---
diff --git a/plugins/fileroller/Makefile.am b/plugins/fileroller/Makefile.am
index b046b09..c46724e 100644
--- a/plugins/fileroller/Makefile.am
+++ b/plugins/fileroller/Makefile.am
@@ -11,7 +11,7 @@ plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = libfileroller.la
libfileroller_la_SOURCES = \
- file-roller-plugin.h file-roller-plugin.c \
+ file-roller-plugin.h file-roller-plugin.cc \
file-roller.xpm file-roller-small.xpm
libfileroller_la_LDFLAGS = $(GNOMEUI_LIBS) $(GNOMEVFS_LIBS)
diff --git a/plugins/fileroller/file-roller-plugin.c b/plugins/fileroller/file-roller-plugin.cc
similarity index 93%
rename from plugins/fileroller/file-roller-plugin.c
rename to plugins/fileroller/file-roller-plugin.cc
index fce9a55..c2fd214 100644
--- a/plugins/fileroller/file-roller-plugin.c
+++ b/plugins/fileroller/file-roller-plugin.cc
@@ -44,7 +44,7 @@ static PluginInfo plugin_nfo = {
};
-static gchar *handled_extensions[] =
+static const gchar *handled_extensions[] =
{
".7z", // 7-zip
".ar", // ar
@@ -91,12 +91,12 @@ static GnomeCmdPluginClass *parent_class = NULL;
static void on_extract_cwd (GtkMenuItem *item, GnomeVFSURI *uri)
{
gchar *target_arg, *archive_arg;
- gchar *uri_str = gnome_vfs_uri_to_string (uri, 0);
+ gchar *uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
gchar *local_path = gnome_vfs_get_local_path_from_uri (uri_str);
- gchar *target_name = gtk_object_get_data (GTK_OBJECT (item), "target_name");
- gchar *target_dir = gtk_object_get_data (GTK_OBJECT (item), "target_dir");
+ gchar *target_name = (gchar *) gtk_object_get_data (GTK_OBJECT (item), "target_name");
+ gchar *target_dir = (gchar *) gtk_object_get_data (GTK_OBJECT (item), "target_dir");
gchar *cmd, *t;
- guint argc;
+ gint argc;
gchar **argv;
if (target_dir==NULL)
@@ -129,20 +129,20 @@ static void on_extract_cwd (GtkMenuItem *item, GnomeVFSURI *uri)
}
-static void do_add_to_archive (const gchar *name, GnomeCmdState *state)
+inline void do_add_to_archive (const gchar *name, GnomeCmdState *state)
{
gchar *t = g_strdup_printf ("--add-to=%s", name);
gchar *arg = g_shell_quote (t);
gchar *cmd = g_strdup_printf ("file-roller %s ", arg);
gchar *active_dir_path, *uri_str;
GList *files;
- guint argc;
+ gint argc;
gchar **argv;
for (files = state->active_dir_selected_files; files; files = files->next)
{
GnomeVFSURI *uri = GNOME_CMD_FILE_INFO (files->data)->uri;
- gchar *uri_str = gnome_vfs_uri_to_string (uri, 0);
+ gchar *uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
gchar *path = gnome_vfs_get_local_path_from_uri (uri_str);
gchar *tmp = cmd;
gchar *arg = g_shell_quote (path);
@@ -154,7 +154,7 @@ static void do_add_to_archive (const gchar *name, GnomeCmdState *state)
}
g_printerr ("add: %s\n", cmd);
- uri_str = gnome_vfs_uri_to_string (state->active_dir_uri, 0);
+ uri_str = gnome_vfs_uri_to_string (state->active_dir_uri, GNOME_VFS_URI_HIDE_NONE);
active_dir_path = gnome_vfs_get_local_path_from_uri (uri_str);
g_shell_parse_argv (cmd, &argc, &argv, NULL);
g_spawn_async (active_dir_path, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
@@ -187,7 +187,7 @@ static void on_add_to_archive (GtkMenuItem *item, FileRollerPlugin *plugin)
dialog = gtk_message_dialog_new (
NULL,
- 0,
+ (GtkDialogFlags) 0,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK_CANCEL,
_("What file name should the new archive have?"));
@@ -357,7 +357,6 @@ static void on_configure_close (GtkButton *btn, FileRollerPlugin *plugin)
static void configure (GnomeCmdPlugin *plugin)
{
- gint i;
GList *items = NULL;
GtkWidget *dialog, *table, *cat, *label, *combo, *vbox;
@@ -377,13 +376,13 @@ static void configure (GnomeCmdPlugin *plugin)
gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
label = create_label (dialog, _("Default type"));
- table_add (table, label, 0, 1, 0);
+ table_add (table, label, 0, 1, (GtkAttachOptions) 0);
combo = create_combo (dialog);
table_add (table, combo, 1, 1, GTK_FILL);
- for (i=0; handled_extensions[i] != NULL; i++)
- items = g_list_append (items, handled_extensions[i]);
+ for (gint i=0; handled_extensions[i] != NULL; i++)
+ items = g_list_append (items, (gpointer) handled_extensions[i]);
gtk_combo_set_popdown_strings (GTK_COMBO (combo), items);
@@ -418,7 +417,7 @@ static void class_init (FileRollerPluginClass *klass)
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GnomeCmdPluginClass *plugin_class = GNOME_CMD_PLUGIN_CLASS (klass);
- parent_class = gtk_type_class (gnome_cmd_plugin_get_type ());
+ parent_class = (GnomeCmdPluginClass *) gtk_type_class (gnome_cmd_plugin_get_type ());
object_class->destroy = destroy;
@@ -467,7 +466,7 @@ GtkType file_roller_plugin_get_type ()
GnomeCmdPlugin *file_roller_plugin_new ()
{
- FileRollerPlugin *plugin = gtk_type_new (file_roller_plugin_get_type ());
+ FileRollerPlugin *plugin = (FileRollerPlugin *) gtk_type_new (file_roller_plugin_get_type ());
return GNOME_CMD_PLUGIN (plugin);
}
diff --git a/plugins/fileroller/file-roller-plugin.h b/plugins/fileroller/file-roller-plugin.h
index a14f0a4..09e98d0 100644
--- a/plugins/fileroller/file-roller-plugin.h
+++ b/plugins/fileroller/file-roller-plugin.h
@@ -21,8 +21,6 @@
#ifndef __FILE_ROLLER_PLUGIN_H__
#define __FILE_ROLLER_PLUGIN_H__
-G_BEGIN_DECLS
-
#define FILE_ROLLER_PLUGIN(obj) \
GTK_CHECK_CAST (obj, file_roller_plugin_get_type (), FileRollerPlugin)
#define FILE_ROLLER_PLUGIN_CLASS(klass) \
@@ -47,11 +45,8 @@ struct _FileRollerPluginClass
GnomeCmdPluginClass parent_class;
};
-
GtkType file_roller_plugin_get_type ();
GnomeCmdPlugin *file_roller_plugin_new ();
-G_END_DECLS
-
#endif //__FILE_ROLLER_PLUGIN_H__
diff --git a/plugins/fileroller/file-roller-small.xpm b/plugins/fileroller/file-roller-small.xpm
index a2e0cec..161b67d 100644
--- a/plugins/fileroller/file-roller-small.xpm
+++ b/plugins/fileroller/file-roller-small.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * file_roller_small_xpm[] = {
+static const char * file_roller_small_xpm[] = {
"16 16 101 2",
" c None",
". c #94886F",
diff --git a/plugins/fileroller/file-roller.xpm b/plugins/fileroller/file-roller.xpm
index cedaf95..5afd1f3 100644
--- a/plugins/fileroller/file-roller.xpm
+++ b/plugins/fileroller/file-roller.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * file_roller_xpm[] = {
+static const char * file_roller_xpm[] = {
"48 52 670 2",
" c None",
". c #E3AC16",
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0fe5b2a..a4d2687 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,7 +5,7 @@ data/gnome-commander.desktop.in.in
libgcmd/gnome-cmd-string-dialog.c
plugins/cvs/cvs-plugin.c
plugins/cvs/interface.c
-plugins/fileroller/file-roller-plugin.c
+plugins/fileroller/file-roller-plugin.cc
plugins/test/test-plugin.cc
src/dialogs/gnome-cmd-advrename-regex-dialog.cc
src/dialogs/gnome-cmd-edit-profile-dialog.cc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]