Pass no-define to AM_INIT_AUTOMAKE in order not to define PACKAGE and VERSION
[hvgrip.git] / src / grip.c
index d217f55..f0e2f2f 100644 (file)
@@ -29,6 +29,8 @@
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
 #include <time.h>
+
+#include "config.h"
 #include "grip.h"
 #include "discdb.h"
 #include "cdplay.h"
@@ -52,7 +54,8 @@ static void LoadImages(GripGUI *uinfo);
 static void DoLoadConfig(GripInfo *ginfo);
 void DoSaveConfig(GripInfo *ginfo);
 
-#define GRIP_URL "http://www.nostatic.org/grip"
+#define GRIP_URL "http://www.hugovil.com/hvgrip"
+#define GRIP_HTML_DOC_URL "file://"DOCDIR"/grip.html"
 
 #define BASE_CFG_ENTRIES \
 {"grip_version",CFG_ENTRY_STRING,256,ginfo->version},\
@@ -319,10 +322,10 @@ GtkWidget *GripNew(const gchar* geometry,char *device,char *scsi_device,
   CheckNewDisc(ginfo,FALSE);
 
   /* Check if we're running this version for the first time */
-  if(strcmp(VERSION,ginfo->version)!=0) {
-    strcpy(ginfo->version,VERSION);
+  if (strcmp(PACKAGE_VERSION, ginfo->version) != 0) {
+    strcpy(ginfo->version, PACKAGE_VERSION);
 
-    sscanf(VERSION,"%d.%d.%d",&major,&minor,&point);
+    sscanf(PACKAGE_VERSION, "%d.%d.%d", &major, &minor, &point);
 
     /* Check if we have a dev release */
     if(minor%2) {
@@ -479,12 +482,23 @@ void LogStatus(GripInfo *ginfo,char *fmt,...)
 static void DoHelp(GtkWidget *widget,gpointer data)
 {
   char *section;
+  char *uri;
 
   section=(char *)data;
 
-#ifdef CONVERSION_GNOME_TO_GTK
-  gnome_help_display("grip.xml",section,NULL);
-#endif
+  if (section) {
+    /*
+     * This doesn't work for the moment: the "#section" seems to be
+     * ignored by g_app_info_launch_default_for_uri().
+     */
+    uri = g_strdup_printf("%s#%s", GRIP_HTML_DOC_URL, section);
+  }
+  else {
+    uri = g_strdup_printf("%s", GRIP_HTML_DOC_URL);
+  }
+
+  g_app_info_launch_default_for_uri(uri, NULL, NULL);
+  g_free (uri);
 }
 
 static void MakeHelpPage(GripInfo *ginfo)
@@ -573,7 +587,7 @@ void MakeAboutPage(GripGUI *uinfo)
 
   vbox2=gtk_vbox_new(TRUE,0);
 
-  sprintf(versionbuf,_("Version %s"),VERSION);
+  sprintf(versionbuf, _("Version %s"), PACKAGE_VERSION);
   label=gtk_label_new(versionbuf);
   gtk_widget_set_style(label,uinfo->style_wb);
   gtk_box_pack_start(GTK_BOX(vbox2),label,FALSE,FALSE,0);
@@ -593,7 +607,7 @@ void MakeAboutPage(GripGUI *uinfo)
 
   hbox=gtk_hbox_new(TRUE,0);
 
-  button=gtk_button_new_with_label("http://www.nostatic.org/grip");
+  button=gtk_button_new_with_label(GRIP_URL);
   gtk_widget_set_style(button,uinfo->style_dark_grey);
   gtk_widget_set_style(GTK_BIN(button)->child,
                       uinfo->style_dark_grey);
@@ -636,18 +650,7 @@ static void MakeStyles(GripGUI *uinfo)
 
 static void Homepage(void)
 {
-  int status;
-
-  status = system("firefox " GRIP_URL);
-  if (status != 0) {
-    status = system("opera " GRIP_URL);
-    if (status != 0) {
-      status = system("chromium-browser " GRIP_URL);
-      if (status != 0) {
-       status = system("gnome-moz-remote " GRIP_URL);
-      }
-    }
-  }
+  g_app_info_launch_default_for_uri(GRIP_URL, NULL, NULL);
 }
 
 static void LoadImages(GripGUI *uinfo)