Replace gnome_app_warning() with Gtk dialog
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 5 Sep 2011 16:00:12 +0000 (12:00 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Tue, 25 Mar 2014 03:27:04 +0000 (23:27 -0400)
src/cdplay.c
src/dialog.c
src/dialog.h
src/discedit.c
src/grip.c
src/gripcfg.c
src/rip.c

index f5439e5..deb77d5 100644 (file)
@@ -79,7 +79,7 @@ static void DiscDBToggle(GtkWidget *widget,gpointer data)
   }
   else {
     if(ginfo->ripping_a_disc) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("Cannot do lookup while ripping."));
 
       return;
@@ -629,7 +629,7 @@ static void PlaylistChanged(GtkWindow *window,GtkWidget *widget,gpointer data)
 
   if(DiscDBWriteDiscData(&(ginfo->disc),&(ginfo->ddata),NULL,TRUE,FALSE,
                          "utf-8")<0)
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error saving disc data."));
 }
 
@@ -1169,7 +1169,7 @@ static void FastFwdCB(GtkWidget *widget,gpointer data)
   ginfo=(GripInfo *)data;
 
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot fast forward while ripping."));
 
     return;
@@ -1200,7 +1200,7 @@ static void RewindCB(GtkWidget *widget,gpointer data)
   ginfo=(GripInfo *)data;
 
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot rewind while ripping."));
 
     return;
@@ -1231,7 +1231,7 @@ static void NextDisc(GtkWidget *widget,gpointer data)
   ginfo=(GripInfo *)data;
 
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot switch discs while ripping."));
 
     return;
@@ -1253,7 +1253,7 @@ void EjectDisc(GtkWidget *widget,gpointer data)
   LogStatus(ginfo,_("Eject disc\n"));
 
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot eject while ripping."));
 
     return;
@@ -1330,7 +1330,7 @@ void PlayTrackCB(GtkWidget *widget,gpointer data)
   disc=&(ginfo->disc);
 
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot play while ripping."));
    
     return;
@@ -1398,7 +1398,7 @@ void NextTrackCB(GtkWidget *widget,gpointer data)
 void NextTrack(GripInfo *ginfo)
 {
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot switch tracks while ripping."));
     return;
   }
@@ -1429,7 +1429,7 @@ void PrevTrackCB(GtkWidget *widget,gpointer data)
 static void PrevTrack(GripInfo *ginfo)
 {
   if(ginfo->ripping_a_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot switch tracks while ripping."));
     return;
   }
@@ -1916,7 +1916,7 @@ void SubmitEntry(gint reply,gpointer data)
   fd = mkstemp(filename);
 
   if(fd == -1) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: Unable to create temporary file."));
     return;
   }
@@ -1925,7 +1925,7 @@ void SubmitEntry(gint reply,gpointer data)
 
   if(!efp) {
     close(fd);
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: Unable to create temporary file."));
   }
   else {
@@ -1943,7 +1943,7 @@ void SubmitEntry(gint reply,gpointer data)
     if(DiscDBWriteDiscData(&(ginfo->disc),&(ginfo->ddata),efp,FALSE,
                           ginfo->db_use_freedb,ginfo->db_use_freedb?
                           "UTF-8":ginfo->discdb_encoding)<0) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("Error: Unable to write disc data."));
       fclose(efp);
     }
index ece3f40..8e85436 100644 (file)
 #include "common.h"
 #include "dialog.h"
 
+void DisplayWarningMsg(GtkWindow *window, char *msg)
+{
+  GtkWidget *dialog;
+
+  dialog = gtk_message_dialog_new(window,
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_WARNING,
+                                  GTK_BUTTONS_CLOSE,
+                                  msg);
+  gtk_dialog_run(GTK_DIALOG (dialog));
+  gtk_widget_destroy(dialog);
+}
+
 void DisplayErrorMsg(GtkWindow *window, char *msg)
 {
   GtkWidget *dialog;
index 2f29a4d..94488bc 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 /* Message routines */
+void DisplayWarningMsg(GtkWindow *window, char *msg);
 void DisplayErrorMsg(GtkWindow *window, char *msg);
 void BoolDialog(char *question,char *yes,GtkSignalFunc yesfunc,
                gpointer yesdata,
index 7b7a9ee..4b7baa4 100644 (file)
@@ -386,10 +386,10 @@ static void SaveDiscInfo(GtkWidget *widget,gpointer data)
   if(ginfo->have_disc) {
     if(DiscDBWriteDiscData(&(ginfo->disc),&(ginfo->ddata),NULL,TRUE,FALSE,
                            "utf-8")<0)
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("Error saving disc data."));
   }
-  else gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+  else DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                          _("No disc present."));
 }
 
@@ -539,14 +539,14 @@ static void SubmitEntryCB(GtkWidget *widget,gpointer data)
   ginfo=(GripInfo *)data;
 
   if(!ginfo->have_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Cannot submit. No disc is present."));
 
     return;
   }
 
   if(!ginfo->ddata.data_genre) {
-    /*    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    /*    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
           _("Submission requires a genre other than 'unknown'."));*/
     GetDiscDBGenre(ginfo);
 
@@ -554,14 +554,14 @@ static void SubmitEntryCB(GtkWidget *widget,gpointer data)
   }
 
   if(!*ginfo->ddata.data_title) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("You must enter a disc title."));
 
     return;
   }
 
   if(!*ginfo->ddata.data_artist) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("You must enter a disc artist."));
     
     return;
index 4d817af..555e648 100644 (file)
@@ -320,7 +320,7 @@ GtkWidget *GripNew(const gchar* geometry,char *device,char *scsi_device,
 
     /* Check if we have a dev release */
     if(minor%2) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("This is a development version of Grip. If you encounter problems, you are encouraged to revert to the latest stable version."));
     }
   }
@@ -918,7 +918,7 @@ static void DoLoadConfig(GripInfo *ginfo)
   if(confret<0) {
     /* Check if the config is out of date */
     if(confret==-2) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("Your config file is out of date -- "
                           "resetting to defaults.\n"
                           "You will need to re-configure Grip.\n"
@@ -1012,7 +1012,7 @@ void DoSaveConfig(GripInfo *ginfo)
   g_snprintf(filename,256,"%s/%s",getenv("HOME"),ginfo->config_filename);
 
   if(!SaveConfig(filename,"GRIP",2,cfg_entries))
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: Unable to save config file."));
 
   SaveRipperConfig(ginfo,ginfo->selected_ripper);
index 8f8ea75..bd046dd 100644 (file)
@@ -815,7 +815,7 @@ void SaveRipperConfig(GripInfo *ginfo,int ripcfg)
           ripper_defaults[ripcfg].name);
 
   if(!SaveConfig(buf,"GRIP",2,rip_cfg_entries))
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: Unable to save ripper config."));
 }
 
@@ -886,7 +886,7 @@ void SaveEncoderConfig(GripInfo *ginfo,int encodecfg)
           encoder_defaults[encodecfg].name);
 
   if(!SaveConfig(buf,"GRIP",2,encode_cfg_entries))
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: Unable to save encoder config."));
 }
 
index 6cc58e4..7d87f0e 100644 (file)
--- a/src/rip.c
+++ b/src/rip.c
@@ -598,7 +598,7 @@ static gboolean AddM3U(GripInfo *ginfo)
 
   fp=fopen(conv_str, "w");
   if(fp==NULL) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Error: can't open m3u file."));
     return FALSE;
   }
@@ -1266,7 +1266,7 @@ void DoRip(GtkWidget *widget,gpointer data)
   ginfo=(GripInfo *)data;
 
   if(!ginfo->have_disc) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("No disc was detected in the drive. If you have a disc in your drive, please check your CDRom device setting under Config->CD."));
     return;
   }
@@ -1275,7 +1275,7 @@ void DoRip(GtkWidget *widget,gpointer data)
   else ginfo->doencode=TRUE;
 
   if(!ginfo->using_builtin_cdp&&!FileExists(ginfo->ripexename)) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Invalid rip executable.\nCheck your rip config, and ensure it specifies the full path to the ripper executable."));
 
     ginfo->doencode=FALSE;
@@ -1283,7 +1283,7 @@ void DoRip(GtkWidget *widget,gpointer data)
   }
 
   if(ginfo->doencode&&!FileExists(ginfo->mp3exename)) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Invalid encoder executable.\nCheck your encoder config, and ensure it specifies the full path to the encoder executable."));
 
     ginfo->doencode=FALSE;
@@ -1445,7 +1445,7 @@ static gboolean RipNextTrack(GripInfo *ginfo)
 
     MakeDirs(ginfo->ripfile);
     if(!CanWrite(ginfo->ripfile)) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("No write access to write wav file"));
       return FALSE;
     }
@@ -1489,7 +1489,7 @@ static gboolean RipNextTrack(GripInfo *ginfo)
     bytesleft=BytesLeftInFS(ginfo->ripfile);
 
     if(bytesleft<(ginfo->ripsize*1.5)) {
-      gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+      DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                         _("Out of space in output directory"));
 
       return FALSE;
@@ -1715,7 +1715,7 @@ static gboolean MP3Encode(GripInfo *ginfo)
 
   MakeDirs(ginfo->mp3file[cpu]);
   if(!CanWrite(ginfo->mp3file[cpu])) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("No write access to write encoded file."));
     return FALSE;
   }
@@ -1741,7 +1741,7 @@ static gboolean MP3Encode(GripInfo *ginfo)
          (gfloat)(ginfo->kbits_per_sec*1024)/600.0);
   
   if(bytesleft<(ginfo->mp3size[cpu]*1.5)) {
-    gnome_app_warning((GnomeApp *)ginfo->gui_info.app,
+    DisplayWarningMsg(GTK_WINDOW(ginfo->gui_info.app),
                       _("Out of space in output directory"));
     
     return FALSE;