[gnome-commander/gcmd-1-3] fileroller plugin: migration to C++
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-3] fileroller plugin: migration to C++
- Date: Mon, 7 Dec 2009 23:48:54 +0000 (UTC)
commit 7939d8a3da63ebb6a2ff9babbaa7007ebc574d34
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Tue Dec 8 00:37:38 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 +-
5 files changed, 18 insertions(+), 24 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 420a686..5c837a7 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",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]