[uae] Re: Source code snapshot

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Fri, 10 Sep 2004 22:23:26 -0500

Hi Derek

On Friday 10 September 2004 10:57 am, Derek Piper wrote:
>  Thank you, kind sir. If I'd had my C hat on when I glanced at the file
> I probably should have figured that out, although I guess the original
> code didn't look 'wrong'. With the patch it builds cleanly with GCC2.95
> and appears to run well.

Yeah. Newer versions of GCC are closer to C99: you can mix variable 
declarations and statements in a block. You can't with GCC 2.95. I sometimes 
forget this. ;-)

>  One thing I have noticed straight off is on the floppy insert dialog
> there are no window titles telling you what drive the disk will be
> inserted in. Minor, but something I liked. I hope that it's nothing to
> do with the patched file since that is 'floppyfileentry', although I
> wouldn't see how that would affect it.

Thanks for reminding me. This one of the things that Martin Garton's rewrite 
of the floppy image bits of the GUI didn't feature. I reimplemented most of 
the other missing features (like remembering the last path selected), but I 
had forgotten about this. Ooops. Try the attached patch.

>  I just thought of something that would be cool (Rich says 'Oh no.. if
> you must'). If no joysticks are detected, it'd be nice if it would
> select a keyboard control instead of joystick, maybe a 'fallback' option
> in the config file, or if it just picked the 'Right Ctrl' one that would
> work too.

;-)

Perhaps. I'd have to have a think about the best way to do this.

>  Floppy speed on the floppy menu would be excellent too. I'll stop now. :>

The Gtk GUI needs some serious work. I'm putting off adding new features to it 
for just now - until I've had a chance to sit down and think about the design 
a bit more.

Ideally, I'd like to drop support for Gtk+1.2 fairly soon. It is officially 
obsolete after all, and any recent distro has Gtk+ 2.x (even Woody).

>  It's getting better all the time, dude :) Thank you :)

You're welcome.

Cheers,
Rich
Index: floppyfileentry.c
===================================================================
RCS file: /cvsroot/uaedev/uae/src/gui-gtk/floppyfileentry.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- floppyfileentry.c   10 Sep 2004 03:19:10 -0000      1.6
+++ floppyfileentry.c   11 Sep 2004 03:11:42 -0000      1.7
@@ -167,10 +167,14 @@
 
 static void on_insert (GtkWidget *w, FloppyFileEntry *ffe)
 {
+    gchar *title;
+
     gtk_widget_set_sensitive (ffe->insert_button, 0);
     gtk_widget_set_sensitive (ffe->eject_button, 0);
 
-    ffe->filesel = gtk_file_selection_new ("");
+    title = g_strconcat ("Select floppy image to insert in drive ", 
ffe->drivename, NULL);
+
+    ffe->filesel = gtk_file_selection_new (title);
 
     if (ffe->filesel) {
         gtk_file_selection_set_filename (GTK_FILE_SELECTION (ffe->filesel),
@@ -194,6 +198,9 @@
        gtk_widget_set_sensitive (ffe->insert_button, 1);
        gtk_widget_set_sensitive (ffe->eject_button, 1);
     }
+
+    if (title)
+       g_free (title);
 }
 
 GtkWidget *floppyfileentry_new (void)
@@ -203,6 +210,15 @@
     return GTK_WIDGET (w);
 }
 
+void floppyfileentry_set_drivename (FloppyFileEntry *ffe, const gchar 
*drivename)
+{
+    if (ffe->drivename)
+       g_free (ffe->drivename);
+    ffe->drivename = g_strdup (drivename);
+
+    printf("drivename:%s\n", ffe->drivename);
+}
+
 void floppyfileentry_set_currentdir (FloppyFileEntry *ffe, const gchar 
*pathname)
 {
     if (ffe->currentdir)
Index: floppyfileentry.h
===================================================================
RCS file: /cvsroot/uaedev/uae/src/gui-gtk/floppyfileentry.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- floppyfileentry.h   14 Jun 2004 18:30:51 -0000      1.4
+++ floppyfileentry.h   11 Sep 2004 03:11:42 -0000      1.5
@@ -28,6 +28,7 @@
 
     gchar     *filename;
     gchar     *currentdir;
+    gchar     *drivename;
 
     GtkWidget *filesel;
 };
@@ -44,6 +45,7 @@
 void                   floppyfileentry_set_currentdir  (FloppyFileEntry 
*ffentry, const gchar *filename);
 void                   floppyfileentry_set_filename    (FloppyFileEntry 
*ffentry, const gchar *filename);
 void                   floppyfileentry_set_label       (FloppyFileEntry 
*ffentry, const gchar *filename);
+void                   floppyfileentry_set_drivename   (FloppyFileEntry 
*ffentry, const gchar *filename);
 #if GTK_MAJOR_VERSION > 2
 G_CONST_RETURN
 #endif
Index: gtkui.c
===================================================================
RCS file: /cvsroot/uaedev/uae/src/gui-gtk/gtkui.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- gtkui.c     10 Sep 2004 05:18:43 -0000      1.18
+++ gtkui.c     11 Sep 2004 03:11:42 -0000      1.19
@@ -1082,6 +1082,7 @@
        sprintf (buf, "DF%d:", i);
 
        floppy_widget[i] = floppyfileentry_new ();
+       floppyfileentry_set_drivename (FLOPPYFILEENTRY (floppy_widget[i]), buf);
        floppyfileentry_set_label (FLOPPYFILEENTRY (floppy_widget[i]), buf);
         floppyfileentry_set_currentdir (FLOPPYFILEENTRY (floppy_widget[i]), 
currprefs.path_floppy);
        gtk_box_pack_start (GTK_BOX (vbox), floppy_widget[i], FALSE, TRUE, 0);

Other related posts: