[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: [PCB Patches] GTK 2.12 required now!



Hello,

I saw this afternoon, that Peter Clifton has pushed a patch to the official PCB-branch witch increases the required GTK version to 2.12. This made me happy (a bit), because I have done some patches wich needs GTK > 2.4.

I have attached three of them and also send them to the patch-tracker at sourceforge (the experimental tracker at launchpad seems to be incomplete today??). It would be very welcome, if someone of you will have comments or even push the patches to the official branch :-).

- 0012: Cleans some lines from code, where the GTK-version is tested. This test was covering the tooltips - 0014: GTK offers a dialog for confirming overwriting files. This patch introduces this official dialog and removes the actual implementation for this behaviour - 0013: This patch is NOT in cause of the version-dump! It modifies the main-window title in a kind, that is more like suggested by the gnome human-interface-device-guidelines (http://library.gnome.org/devel/hig-book/nightly/windows-primary.html). I personally like this new window-titles, too ;-).

I am also working at a patch for a recent-file-list. But it is not complete now. Will send it, if it is more ready.

Kind regards,
Felix
From 48cd5f9d5fbdec41c80e43b3e05044785af7fec8 Mon Sep 17 00:00:00 2001
From: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Dec 2010 20:04:58 +0100
Subject: [PATCH] Cleanup conditional code because GTK 2.12 is required now

---
 src/hid/gtk/gui-output-events.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 6164415..9e7889e 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -754,13 +754,6 @@ ghid_port_drawing_area_expose_event_cb (GtkWidget * widget,
   return FALSE;
 }
 
-#if GTK_CHECK_VERSION(2,12,0)
-# define ENABLE_TOOLTIPS 1
-#else
-# define ENABLE_TOOLTIPS 0
-#endif
-
-#if ENABLE_TOOLTIPS
 static char *
 describe_location (LocationType X, LocationType Y)
 {
@@ -874,7 +867,6 @@ queue_tooltip_update (GHidPort *out)
                      (GSourceFunc) check_object_tooltips,
                      out);
 }
-#endif
 
 gint
 ghid_port_window_motion_cb (GtkWidget * widget,
-- 
1.7.1

From f40c6bd3b5e35e7f9e4cf89d08054a866f47e565 Mon Sep 17 00:00:00 2001
From: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Dec 2010 21:46:30 +0100
Subject: [PATCH] Modify window title (see Gnome HID-Guidelines)

This patch modifies the title of the main window. As suggested in the gnome HID-Guidelines
(http://library.gnome.org/devel/hig-book/nightly/windows-primary.html)
The following will be shown there:
 * A star (*) if the layout has unsaved changes (this patch also removes this sign from
   the statusbar, where it actually is)
 * The name of the layout, if set in the config-dialog ('Put layout name on the window title bar')
 * The filename (in braces, if layout name is shown)
 * The string " - PCB"
---
 src/hid/gtk/gui-command-window.c |    1 +
 src/hid/gtk/gui-dialog-size.c    |    1 +
 src/hid/gtk/gui-misc.c           |    6 ++----
 src/hid/gtk/gui-output-events.c  |    2 ++
 src/hid/gtk/gui-top-window.c     |   28 ++++++++++++++++++++--------
 5 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index ef2f637..b97ec0b 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -481,5 +481,6 @@ ghid_handle_user_command (gboolean raise)
 	}
       RestoreCrosshair (true);
     }
+  ghid_window_set_name_label (PCB->Name);
   ghid_set_status_line_label ();
 }
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 16caff3..8409ba5 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -334,5 +334,6 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
     }
 
   gtk_widget_destroy (dialog);
+  ghid_window_set_name_label (PCB->Name);
   ghid_set_status_line_label ();
 }
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index a607a69..e3316aa 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -500,7 +500,7 @@ ghid_set_status_line_label (void)
 
   if (!Settings.grid_units_mm)
     snprintf (text, sizeof (text),
-	      _("<b>%c  view</b>=%s  "
+	      _("<b>view</b>=%s  "
 		"<b>grid</b>=%.1f:%i  "
 		"%s%s  "
 		"<b>line</b>=%.1f  "
@@ -508,7 +508,6 @@ ghid_set_status_line_label (void)
 		"<b>clearance</b>=%.1f  "
 		"<b>text</b>=%i%%  "
 		"<b>buffer</b>=#%i"),
-	      PCB->Changed ? '*' : ' ',
 	      Settings.ShowSolderSide ? _("solder") : _("component"),
 	      PCB->Grid / 100.0,
 	      (int) Settings.GridFactor,
@@ -524,7 +523,7 @@ ghid_set_status_line_label (void)
 	      Settings.TextScale, Settings.BufferNumber + 1);
   else
     snprintf (text, sizeof (text),
-	      _("<b>%c  view</b>=%s  "
+	      _("<b>view</b>=%s  "
 		"<b>grid</b>=%5.3f:%i  "
 		"%s%s  "
 		"<b>line</b>=%5.3f  "
@@ -532,7 +531,6 @@ ghid_set_status_line_label (void)
 		"<b>clearance</b>=%5.3f  "
 		"<b>text</b>=%i%%  "
 		"<b>buffer</b>=#%i"),
-	      PCB->Changed ? '*' : ' ',
 	      Settings.ShowSolderSide ? _("solder") : _("component"),
 	      PCB->Grid * COOR_TO_MM, (int) Settings.GridFactor,
 	      TEST_FLAG (ALLDIRECTIONFLAG, PCB) ? "all" :
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 9e7889e..b1da126 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -644,6 +644,7 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
 
   ghid_invalidate_all ();
   RestoreCrosshair (TRUE);
+  ghid_window_set_name_label (PCB->Name);
   ghid_set_status_line_label ();
   ghid_show_crosshair (TRUE);
   if (!gport->panning)
@@ -677,6 +678,7 @@ ghid_port_button_release_cb (GtkWidget * drawing_area,
       RestoreCrosshair (TRUE);
       ghid_screen_update ();
     }
+  ghid_window_set_name_label (PCB->Name);
   ghid_set_status_line_label ();
   g_idle_add (ghid_idle_cb, NULL);
   return TRUE;
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 1f17b48..40bb2cb 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -660,6 +660,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
       ghid_invalidate_all ();
       RestoreCrosshair (TRUE);
       ghid_screen_update ();
+      ghid_window_set_name_label (PCB->Name);
       ghid_set_status_line_label ();
 #ifdef FIXME
       g_idle_add (ghid_idle_cb, NULL);
@@ -875,6 +876,7 @@ ghid_sync_with_new_layout (void)
   ghid_route_style_button_set_active (0);
   ghid_config_handle_units_changed ();
 
+  ghid_window_set_name_label (PCB->Name);
   ghid_set_status_line_label ();
 }
 
@@ -1198,12 +1200,14 @@ make_top_menubar (GtkWidget * hbox, GHidPort * port)
 }
 
 
-/* Set the PCB name on a label or on the window title bar.
+/* Refreshes the window title bar and sets the PCB name to the
+ * window title bar or to a seperate label
  */
 void
 ghid_window_set_name_label (gchar * name)
 {
   gchar *str;
+  gchar *filename;
 
   /* FIXME -- should this happen?  It does... */
   /* This happens if we're calling an exporter from the command line */
@@ -1213,25 +1217,33 @@ ghid_window_set_name_label (gchar * name)
   dup_string (&(ghidgui->name_label_string), name);
   if (!ghidgui->name_label_string || !*ghidgui->name_label_string)
     ghidgui->name_label_string = g_strdup (_("Unnamed"));
-
+
   if (!ghidgui->name_label)
     return;
-
+
+  if (!PCB->Filename  || !*PCB->Filename)
+    filename = g_strdup(_("Unsaved.pcb"));
+  else
+    filename = g_strdup(PCB->Filename);
+
   if (ghidgui->ghid_title_window)
     {
       gtk_widget_hide (ghidgui->label_hbox);
-      str = g_strdup_printf ("PCB:  %s", ghidgui->name_label_string);
-      gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
+      str = g_strdup_printf ("%s%s (%s) - PCB", PCB->Changed ? "*": "",
+                             ghidgui->name_label_string, filename);
     }
   else
     {
-			gtk_widget_show (ghidgui->label_hbox);
+      gtk_widget_show (ghidgui->label_hbox);
       str = g_strdup_printf (" <b><big>%s</big></b> ",
-			     ghidgui->name_label_string);
+                             ghidgui->name_label_string);
       gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), str);
-      gtk_window_set_title (GTK_WINDOW (gport->top_window), "PCB");
+      str = g_strdup_printf ("%s%s - PCB", PCB->Changed ? "*": "",
+                             filename);
     }
+  gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
   g_free (str);
+  g_free (filename);
 }
 
 static void
-- 
1.7.1

From b5dfc1709a9267c2b671317393517f71af44d8c8 Mon Sep 17 00:00:00 2001
From: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Dec 2010 22:49:45 +0100
Subject: [PATCH] Use GTK dialog for confirming file-overwrite

Since GTK 2.8 GTK provides an dialog for confirming file-overwriting.
This dialog will be introduced by this patch. Needless code which was
used for this, will be removed.
---
 src/hid/gtk/gtkhid-main.c |   17 -----------------
 src/hid/gtk/gui-dialog.c  |    2 ++
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 8bbf3eb..2ec7737 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1310,23 +1310,6 @@ Save (int argc, char **argv, int x, int y)
   
   if (name)
     {
-      FILE *exist;
-      exist = fopen (name, "r");
-      if (exist)
-	{
-	  fclose (exist);
-	  if (ghid_dialog_confirm (_("File exists!  Ok to overwrite?"), NULL, NULL))
-	    {
-	      if (Settings.verbose)
-		fprintf (stderr, _("Overwriting %s\n"), name);
-	    }
-	  else
-	    {
-	      g_free (name);
-	      return 1;
-	    }
-	}
-      
       if (Settings.verbose)
 	fprintf (stderr, "%s:  Calling SaveTo(%s, %s)\n", 
 		 __FUNCTION__, function, name);
diff --git a/src/hid/gtk/gui-dialog.c b/src/hid/gtk/gui-dialog.c
index 80c1157..785f9da 100644
--- a/src/hid/gtk/gui-dialog.c
+++ b/src/hid/gtk/gui-dialog.c
@@ -382,6 +382,8 @@ ghid_dialog_file_select_save (gchar * title, gchar ** path, gchar * file,
 
   if (file && *file)
     gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file);
+
+  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER (dialog), TRUE);
 
   if (shortcuts && *shortcuts)
     {
-- 
1.7.1


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user