changeset 49:0fec02fb9e54

2002-11-5 Brian Masney <masneyb@gftp.org> * src/gtk/transfer.c - use stock icons in GTK+ 2.0 port
author masneyb
date Wed, 06 Nov 2002 02:46:12 +0000
parents e5f6054590b5
children d433c1417d7d
files ChangeLog src/gtk/transfer.c
diffstat 2 files changed, 64 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 06 02:20:25 2002 +0000
+++ b/ChangeLog	Wed Nov 06 02:46:12 2002 +0000
@@ -1,3 +1,20 @@
+2002-11-5 Brian Masney <masneyb@gftp.org>
+	* src/gtk/transfer.c - use stock icons in GTK+ 2.0 port
+
+2002-11-5 Brian Masney <masneyb@gftp.org>
+	* lib/*.c src/gtk/*.c - removed function declarations for the static 
+	functions from the top of the file. I had to rearrange the order of a 
+	bunch of functions to avoid compiler warnings
+
+	* lib/gftp.h - include sys/sysmacros.h. If major() and minor() isn't
+	defined, give a compiler warning and define our own
+
+	* lib/local.c (local_get_next_file) - if this file is a device, store
+	the major/minor number in the file size
+
+	* src/gtk/misc-gtk.c (add_file_listbox) - if this file is a device, 
+	use the major() and minor() macros to display the major and minor number
+
 2002-11-5 Brian Masney <masneyb@gftp.org>
 	* lib/cache.c lib/gftp.h - added second argument ignore_directory to
 	gftp_delete_cache_entry
@@ -137,7 +154,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.26 2002/11/05 20:36:10 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.27 2002/11/06 02:46:11 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/src/gtk/transfer.c	Wed Nov 06 02:20:25 2002 +0000
+++ b/src/gtk/transfer.c	Wed Nov 06 02:46:12 2002 +0000
@@ -2044,38 +2044,67 @@
 }
 
 
+#if GTK_MAJOR_VERSION > 1
+static void
+transfer_action (GtkWidget * widget, gint response, gpointer user_data)
+{
+  switch (response)
+    {
+      case GTK_RESPONSE_OK:
+        ok (widget, user_data);
+        gtk_widget_destroy (widget);
+        break;
+      case GTK_RESPONSE_CANCEL:
+        cancel (widget, user_data);
+        /* no break */
+      default:
+        gtk_widget_destroy (widget);
+    }
+}   
+#endif
+
+
 void
 gftp_gtk_ask_transfer (gftp_transfer * tdata)
 {
   char *dltitles[4], *add_data[4] = { NULL, NULL, NULL, NULL },
-       tempstr[50], temp1str[50];
+       tempstr[50], temp1str[50], *pos, *title;
   GtkWidget * tempwid, * scroll, * hbox;
   gftp_file * tempfle;
   GList * templist;
   size_t len;
-  char *pos;
   int i;
 
   dltitles[0] = _("Filename");
   dltitles[1] = _("Local Size");
   dltitles[2] = _("Remote Size");
   dltitles[3] = _("Action");
-  dialog = gtk_dialog_new (); /* FIXME - gtk+ 2.0 stock icons */
+  title = tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD ?  
+                               _("Download Files") : _("Upload Files");
+
+#if GTK_MAJOR_VERSION == 1
+  dialog = gtk_dialog_new ();
   gtk_grab_add (dialog);
-  gtk_window_set_title (GTK_WINDOW (dialog), 
-                        tdata->transfer_direction == GFTP_DIRECTION_DOWNLOAD ? 
-                                      _("Download Files") : _("Upload Files"));
-  gtk_window_set_wmclass (GTK_WINDOW(dialog), "transfer", "gFTP");
-  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
-  gtk_container_border_width (GTK_CONTAINER
-			      (GTK_DIALOG (dialog)->action_area), 5);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
+  gtk_window_set_title (GTK_WINDOW (dialog), title);
+  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
   gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 35);
   gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
+
   gtk_signal_connect_object (GTK_OBJECT (dialog), "delete_event",
                              GTK_SIGNAL_FUNC (gtk_widget_destroy),
                              GTK_OBJECT (dialog));
+#else
+  dialog = gtk_dialog_new_with_buttons (title, NULL, 0, 
+                                        GTK_STOCK_OK,
+                                        GTK_RESPONSE_OK,
+                                        GTK_STOCK_CANCEL,
+                                        GTK_RESPONSE_CANCEL,
+                                        NULL);
+#endif
+  gtk_window_set_wmclass (GTK_WINDOW(dialog), "transfer", "gFTP");
+  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
+  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
+  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
 
   tempwid = gtk_label_new (_("The following file(s) exist on both the local and remote computer\nPlease select what you would like to do"));
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE,
@@ -2201,6 +2230,7 @@
 		      GTK_SIGNAL_FUNC (trans_unselectall), (gpointer) tdata);
   gtk_widget_show (tempwid);
 
+#if GTK_MAJOR_VERSION == 1
   tempwid = gtk_button_new_with_label (_("OK"));
   GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
@@ -2223,6 +2253,10 @@
 			     GTK_SIGNAL_FUNC (gtk_widget_destroy),
 			     GTK_OBJECT (dialog));
   gtk_widget_show (tempwid);
+#else
+  g_signal_connect (GTK_OBJECT (dialog), "response",
+                    G_CALLBACK (transfer_action), (gpointer) tdata);
+#endif
 
   gtk_widget_show (dialog);
   dialog = NULL;