From: Hugo Villeneuve Date: Mon, 5 Sep 2011 19:37:38 +0000 (-0400) Subject: Main part of Gnome to Gtk conversion X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=71083c96d08795256c46411dab74efb0383e8ee2;p=hvgrip.git Main part of Gnome to Gtk conversion --- diff --git a/src/common.h b/src/common.h index 0ddb67a..738e64f 100644 --- a/src/common.h +++ b/src/common.h @@ -20,7 +20,14 @@ * USA */ -#include +#include +#include +#include +#include +#include +#include + +#define _(STRING) gettext(STRING) /* Routines from main.c */ void Debug(char *fmt,...); diff --git a/src/discdb.h b/src/discdb.h index 93bda7c..f7d136c 100644 --- a/src/discdb.h +++ b/src/discdb.h @@ -26,6 +26,8 @@ #ifndef GRIP_DISCDB_H #define GRIP_DISCDB_H +#include + /* HTTP proxy server structure */ typedef struct _proxy_server { diff --git a/src/grip.c b/src/grip.c index 3b74664..303366c 100644 --- a/src/grip.c +++ b/src/grip.c @@ -30,7 +30,6 @@ #include #include #include "grip.h" -#include #include "discdb.h" #include "cdplay.h" #include "discedit.h" @@ -176,9 +175,11 @@ GtkWidget *GripNew(const gchar* geometry,char *device,char *scsi_device, int major,minor,point; char buf[256]; +#ifdef CONVERSION_GNOME_TO_GTK gnome_window_icon_set_default_from_file(GNOME_ICONDIR"/gripicon.png"); +#endif - app=gnome_app_new(PACKAGE,_("Grip")); + app = gtk_window_new(GTK_WINDOW_TOPLEVEL); ginfo=g_new0(GripInfo,1); @@ -307,7 +308,7 @@ GtkWidget *GripNew(const gchar* geometry,char *device,char *scsi_device, gtk_box_pack_start(GTK_BOX(uinfo->winbox),uinfo->controls,FALSE,FALSE,0); gtk_widget_show(uinfo->controls); - gnome_app_set_contents(GNOME_APP(app),uinfo->winbox); + gtk_container_add(GTK_CONTAINER(app), uinfo->winbox); gtk_widget_show(uinfo->winbox); CheckNewDisc(ginfo,FALSE); @@ -471,7 +472,9 @@ static void DoHelp(GtkWidget *widget,gpointer data) section=(char *)data; +#ifdef CONVERSION_GNOME_TO_GTK gnome_help_display("grip.xml",section,NULL); +#endif } static void MakeHelpPage(GripInfo *ginfo) diff --git a/src/grip.h b/src/grip.h index 9141237..396ffa1 100644 --- a/src/grip.h +++ b/src/grip.h @@ -25,7 +25,6 @@ #define GRIP_H #include "config.h" -#include #include "cddev.h" #include "discdb.h" #include "pthread.h" diff --git a/src/gripcfg.c b/src/gripcfg.c index bd046dd..f6660fa 100644 --- a/src/gripcfg.c +++ b/src/gripcfg.c @@ -23,6 +23,7 @@ #include #include #include "grip.h" +#include "common.h" #include "gripcfg.h" #include "dialog.h" #include "parsecfg.h" diff --git a/src/id3.c b/src/id3.c index ab3dda7..46c89bf 100644 --- a/src/id3.c +++ b/src/id3.c @@ -23,8 +23,8 @@ #include #include #include -#include #include "grip_id3.h" +#include "common.h" static void ID3Put(char *dest,char *src,int len,char *encoding); diff --git a/src/main.c b/src/main.c index ffe94c7..a99d61b 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,9 @@ */ #include -#include +#include +#include +#include #include #include "grip.h" @@ -145,6 +147,9 @@ void Debug(char *fmt,...) int Cmain(int argc, char* argv[]) { + poptContext context; + int status; + /* Unbuffer stdout */ setvbuf(stdout, 0, _IONBF, 0); @@ -153,9 +158,19 @@ int Cmain(int argc, char* argv[]) bindtextdomain(GETTEXT_PACKAGE,GNOMELOCALEDIR); textdomain(GETTEXT_PACKAGE); - gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv, - GNOME_PARAM_POPT_TABLE,options, - GNOME_PROGRAM_STANDARD_PROPERTIES,NULL); + gtk_init(&argc, &argv); + context = poptGetContext(NULL, argc, (const char **) argv, options, 0); + status = poptGetNextOpt(context); + if (status != -1) { + fprintf(stderr, "Error with option [%s]:\n %s\n", + poptBadOption(context, POPT_BADOPTION_NOALIAS), + poptStrerror(status)); + + /* Print a short usage message. */ + poptPrintUsage(context, stderr, 0); + + exit(1); + } bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF8"); setenv("CHARSET","UTF-8",1); diff --git a/src/parsecfg.c b/src/parsecfg.c index 94839bd..0f8ac75 100644 --- a/src/parsecfg.c +++ b/src/parsecfg.c @@ -24,6 +24,7 @@ #include #include #include +#include "common.h" #include "grip.h" #include "parsecfg.h" diff --git a/src/status_window.c b/src/status_window.c index 0c982cc..94fa4c8 100644 --- a/src/status_window.c +++ b/src/status_window.c @@ -26,6 +26,7 @@ #include #include #include "status_window.h" +#include "common.h" static void PipeCB(gpointer data,gint source,GdkInputCondition condition); diff --git a/src/tray.c b/src/tray.c index ab1592a..81654ac 100644 --- a/src/tray.c +++ b/src/tray.c @@ -27,6 +27,7 @@ #include "../pixmaps/menustop.xpm" #include "../pixmaps/menuprev.xpm" #include "../pixmaps/menunext.xpm" +#include "common.h" static void MakeTrayIcon(GripInfo *ginfo); static void PlayCB(GtkWidget *widget, gpointer data);