[gnome-commander/gcmd-1-3] cvs plugin: migration to C++
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-3] cvs plugin: migration to C++
- Date: Tue, 8 Dec 2009 16:59:53 +0000 (UTC)
commit 2a7cf0dc24784804288287499ff22c73e7620af1
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Tue Dec 8 17:58:10 2009 +0100
cvs plugin: migration to C++
libgcmd/libgcmd-widget-factory.c | 2 +-
libgcmd/libgcmd-widget-factory.h | 2 +-
plugins/cvs/Makefile.am | 9 +++------
plugins/cvs/close.xpm | 2 +-
plugins/cvs/{cvs-plugin.c => cvs-plugin.cc} | 12 ++++++------
plugins/cvs/cvs-plugin.xpm | 2 +-
plugins/cvs/{interface.c => interface.cc} | 9 ++++-----
plugins/cvs/{parser.l => parser.ll} | 2 --
8 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/libgcmd/libgcmd-widget-factory.c b/libgcmd/libgcmd-widget-factory.c
index 4bfb28b..fe08abb 100644
--- a/libgcmd/libgcmd-widget-factory.c
+++ b/libgcmd/libgcmd-widget-factory.c
@@ -518,7 +518,7 @@ create_combo (GtkWidget *parent)
GtkWidget *
-create_option_menu (GtkWidget *parent, gchar **items)
+create_option_menu (GtkWidget *parent, const gchar **items)
{
gint i = 0;
diff --git a/libgcmd/libgcmd-widget-factory.h b/libgcmd/libgcmd-widget-factory.h
index 1a00f17..3c984da 100644
--- a/libgcmd/libgcmd-widget-factory.h
+++ b/libgcmd/libgcmd-widget-factory.h
@@ -95,7 +95,7 @@ GtkWidget *create_hbuttonbox (GtkWidget *parent);
GtkWidget *create_combo (GtkWidget *parent);
-GtkWidget *create_option_menu (GtkWidget *parent, gchar **items);
+GtkWidget *create_option_menu (GtkWidget *parent, const gchar **items);
const gchar *get_combo_text (GtkWidget *combo);
diff --git a/plugins/cvs/Makefile.am b/plugins/cvs/Makefile.am
index b61c123..928a37a 100644
--- a/plugins/cvs/Makefile.am
+++ b/plugins/cvs/Makefile.am
@@ -1,8 +1,5 @@
## Process this file with automake to produce Makefile.in
-.l.c:
- $(LEXCOMPILE) $<
-
AM_CPPFLAGS = \
$(CC_WARNINGS) \
-I$(top_srcdir) \
@@ -14,9 +11,9 @@ plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = libcvs.la
libcvs_la_SOURCES = \
- parser.h parser.l \
- cvs-plugin.h cvs-plugin.c \
- interface.h interface.c \
+ parser.h parser.ll \
+ cvs-plugin.h cvs-plugin.cc \
+ interface.h interface.cc \
cvs-plugin.xpm close.xpm
libcvs_la_LDFLAGS = $(GNOMEUI_LIBS) $(GNOMEVFS_LIBS)
diff --git a/plugins/cvs/close.xpm b/plugins/cvs/close.xpm
index 82cbe43..5daa06b 100644
--- a/plugins/cvs/close.xpm
+++ b/plugins/cvs/close.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * close_xpm[] = {
+static const char * close_xpm[] = {
"12 11 2 1",
" g None",
". g #000000",
diff --git a/plugins/cvs/cvs-plugin.c b/plugins/cvs/cvs-plugin.cc
similarity index 96%
rename from plugins/cvs/cvs-plugin.c
rename to plugins/cvs/cvs-plugin.cc
index 63e9992..fccd9ce 100644
--- a/plugins/cvs/cvs-plugin.c
+++ b/plugins/cvs/cvs-plugin.cc
@@ -45,7 +45,7 @@ static PluginInfo plugin_nfo = {
};
-static gchar *compression_level_strings[] = {
+static const gchar *compression_level_strings[] = {
"0 - No compression",
"1",
"2",
@@ -102,7 +102,7 @@ static gboolean change_cwd (const gchar *fpath)
static void on_diff (GtkMenuItem *item, GnomeCmdState *state)
{
GList *files = state->active_dir_selected_files;
- CvsPlugin *plugin = gtk_object_get_data (GTK_OBJECT (item), "plugin");
+ CvsPlugin *plugin = (CvsPlugin *) gtk_object_get_data (GTK_OBJECT (item), "plugin");
if (files && !plugin->diff_win)
plugin->diff_win = create_diff_win (plugin);
@@ -128,7 +128,7 @@ static void on_diff (GtkMenuItem *item, GnomeCmdState *state)
static void on_log (GtkMenuItem *item, GnomeCmdState *state)
{
GList *files = state->active_dir_selected_files;
- CvsPlugin *plugin = gtk_object_get_data (GTK_OBJECT (item), "plugin");
+ CvsPlugin *plugin = (CvsPlugin *) gtk_object_get_data (GTK_OBJECT (item), "plugin");
if (files && !plugin->log_win)
plugin->log_win = create_log_win (plugin);
@@ -290,7 +290,7 @@ static void configure (GnomeCmdPlugin *p)
gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
label = create_label (dialog, _("Compression level"));
- table_add (table, label, 0, 1, 0);
+ table_add (table, label, 0, 1, (GtkAttachOptions) 0);
optmenu = create_option_menu (dialog, compression_level_strings);
plugin->priv->compression_level_menu = optmenu;
@@ -326,7 +326,7 @@ static void class_init (CvsPluginClass *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;
@@ -380,7 +380,7 @@ GtkType cvs_plugin_get_type ()
GnomeCmdPlugin *cvs_plugin_new ()
{
- CvsPlugin *plugin = gtk_type_new (cvs_plugin_get_type ());
+ CvsPlugin *plugin = (CvsPlugin *) gtk_type_new (cvs_plugin_get_type ());
return GNOME_CMD_PLUGIN (plugin);
}
diff --git a/plugins/cvs/cvs-plugin.xpm b/plugins/cvs/cvs-plugin.xpm
index 6e764d1..714dd5e 100644
--- a/plugins/cvs/cvs-plugin.xpm
+++ b/plugins/cvs/cvs-plugin.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * cvs_plugin_xpm[] = {
+static const char * cvs_plugin_xpm[] = {
"17 9 30 1",
" c None",
". c #CB9E32",
diff --git a/plugins/cvs/interface.c b/plugins/cvs/interface.cc
similarity index 98%
rename from plugins/cvs/interface.c
rename to plugins/cvs/interface.cc
index 4e3dd49..6593abc 100644
--- a/plugins/cvs/interface.c
+++ b/plugins/cvs/interface.cc
@@ -75,16 +75,15 @@ static void on_compare_clicked (GtkButton *button, LogHistory *log_history)
static void on_compare_ok (GtkButton *button, GtkWidget *dialog)
{
- gchar *cmd, *args, *prev_rev;
- const gchar *selected_rev, *selected_other_rev;
+ gchar *cmd, *args;
GtkWidget *combo = lookup_widget (GTK_WIDGET (button), "rev_combo");
GtkWidget *head_radio = lookup_widget (GTK_WIDGET (button), "head_radio");
GtkWidget *prev_rev_radio = lookup_widget (GTK_WIDGET (button), "prev_rev_radio");
LogHistory *log_history = (LogHistory *) lookup_widget (GTK_WIDGET (button), "log_history");
- selected_rev = gtk_object_get_data (GTK_OBJECT (dialog), "selected_rev");
- selected_other_rev = get_combo_text (combo);
- prev_rev = gtk_object_get_data (GTK_OBJECT (dialog), "prev_rev");
+ const gchar *selected_rev = (const gchar *) gtk_object_get_data (GTK_OBJECT (dialog), "selected_rev");
+ const gchar *selected_other_rev = get_combo_text (combo);
+ const gchar *prev_rev = (const gchar *) gtk_object_get_data (GTK_OBJECT (dialog), "prev_rev");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (head_radio)))
args = g_strdup_printf ("-r %s", selected_rev);
diff --git a/plugins/cvs/parser.l b/plugins/cvs/parser.ll
similarity index 98%
rename from plugins/cvs/parser.l
rename to plugins/cvs/parser.ll
index e9c571f..922a511 100644
--- a/plugins/cvs/parser.l
+++ b/plugins/cvs/parser.ll
@@ -53,8 +53,6 @@ branches:[:alnum:]*; {
%option noyywrap
%option nounput
-%option prefix="parser"
-%option outfile="parser.c"
%{
#include <stdio.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]