gEDA-user: gaf : glib deprecated symbol

2010-09-19 Thread Camille Delbegue
Hello,

This patch remove all glib deprecated symbols in gaf.
I used the list of deprecated symbols found in the documentation of glib 2.24.1

-- 
Kam
diff --git a/gattrib/src/g_rc.c b/gattrib/src/g_rc.c
index f64d93b..dc7abf2 100644
--- a/gattrib/src/g_rc.c
+++ b/gattrib/src/g_rc.c
@@ -65,7 +65,7 @@ SCM g_rc_gattrib_version(SCM version)
   SCM_ASSERT (scm_is_string (version), version,
 	  SCM_ARG1, "gattrib-version");
   
-  if (g_strcasecmp (SCM_STRING_CHARS (version),
+  if (g_ascii_strcasecmp (SCM_STRING_CHARS (version),
 PACKAGE_DATE_VERSION) != 0) {
 fprintf(stderr,
 "You are running gEDA/gaf version [%s%s.%s],\n",
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index cf61190..cf54f21 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -69,7 +69,7 @@ SCM g_rc_gschem_version(SCM version)
   SCM_ASSERT (scm_is_string (version), version,
   SCM_ARG1, "gschem-version");
 
-  if (g_strcasecmp (SCM_STRING_CHARS (version), PACKAGE_DATE_VERSION) != 0) {
+  if (g_ascii_strcasecmp (SCM_STRING_CHARS (version), PACKAGE_DATE_VERSION) != 0) {
 fprintf(stderr,
 "You are running gEDA/gaf version [%s%s.%s],\n",
 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 507919c..3bec7b3 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -804,12 +804,12 @@ static void line_type_dialog_ok(GtkWidget *w, gpointer data)
 type = -1;
   
   /* convert the options to integers (-1 means unchanged) */
-  width =  g_strcasecmp (width_str,
- _("*unchanged*")) ? atoi (width_str)  : -1;
-  length = g_strcasecmp (length_str,
- _("*unchanged*")) ? atoi (length_str) : -1;
-  space  = g_strcasecmp (space_str,
- _("*unchanged*")) ? atoi (space_str)  : -1;
+  width =  g_utf8_collate (width_str,
+   _("*unchanged*")) ? atoi (width_str)  : -1;
+  length = g_utf8_collate (length_str,
+   _("*unchanged*")) ? atoi (length_str) : -1;
+  space  = g_utf8_collate (space_str,
+   _("*unchanged*")) ? atoi (space_str)  : -1;
 
   for (iter = selection; iter != NULL; iter = g_list_next(iter)) {
 object = (OBJECT *) iter->data;
@@ -1286,16 +1286,16 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
 type = -1;
 
   /* convert the options to integers (-1 means unchanged) */
-  width  = g_strcasecmp (width_str,
- _("*unchanged*")) ? atoi (width_str)  : -1;
-  angle1 = g_strcasecmp (angle1_str,
- _("*unchanged*")) ? atoi (angle1_str) : -1;
-  pitch1 = g_strcasecmp (pitch1_str,
- _("*unchanged*")) ? atoi (pitch1_str) : -1;
-  angle2 = g_strcasecmp (angle2_str,
- _("*unchanged*")) ? atoi (angle2_str) : -1;
-  pitch2 = g_strcasecmp (pitch2_str,
- _("*unchanged*")) ? atoi (pitch2_str) : -1;
+  width  = g_utf8_collate (width_str,
+   _("*unchanged*")) ? atoi (width_str)  : -1;
+  angle1 = g_utf8_collate (angle1_str,
+   _("*unchanged*")) ? atoi (angle1_str) : -1;
+  pitch1 = g_utf8_collate (pitch1_str,
+   _("*unchanged*")) ? atoi (pitch1_str) : -1;
+  angle2 = g_utf8_collate (angle2_str,
+   _("*unchanged*")) ? atoi (angle2_str) : -1;
+  pitch2 = g_utf8_collate (pitch2_str,
+   _("*unchanged*")) ? atoi (pitch2_str) : -1;
 
   for (iter = selection; iter != NULL; iter = g_list_next(iter)) {
 object = (OBJECT *) iter->data;
diff --git a/gschem/src/x_multiattrib.c b/gschem/src/x_multiattrib.c
index 3b611de..75438ff 100644
--- a/gschem/src/x_multiattrib.c
+++ b/gschem/src/x_multiattrib.c
@@ -1527,7 +1527,7 @@ static void multiattrib_popup_menu(Multiattrib *multiattrib,
   menu = gtk_menu_new();
   for (tmp = item_list; tmp->label != NULL; tmp++) {
 GtkWidget *menuitem;
-if (g_strcasecmp (tmp->label, "-") == 0) {
+if (g_ascii_strcasecmp (tmp->label, "-") == 0) {
   menuitem = gtk_separator_menu_item_new ();
 } else {
   menuitem = gtk_menu_item_new_with_label (_(tmp->label));
diff --git a/gschem/src/x_pagesel.c b/gschem/src/x_pagesel.c
index 43331bd..802fdf7 100644
--- a/gschem/src/x_pagesel.c
+++ b/gschem/src/x_pagesel.c
@@ -274,7 +274,7 @@ static void pagesel_popup_menu (Pagesel *pagesel,
   menu = gtk_menu_new();
   for (tmp = menuitems; tmp->label != NULL; tmp++) {
 GtkWidget *menuitem;
-if (g_strcasecmp (tmp->label, "-") == 0) {
+if (g_ascii_strcasecmp (tmp->label, "-") == 0) {
   menuitem = gtk_separator_menu_item_new ();
 } else {
   menuitem = gtk_menu_item_new_with_label (_(tmp->label));
diff --git a/gsymcheck/src/g_rc.c b/gsymcheck/src/g_rc.c
index 933b3cb..8558de9 100644
--- a/gsymcheck/src/g_rc.c
+++ b/gsymcheck/src/g_rc.c
@@ -46,7 +46,7 @@ SC

gEDA-user: gschem : minor beautification

2010-09-14 Thread Camille Delbegue
Hello,

This patch place the scrollbars and the drawing area in a table, this prevents
that the scrollbars doesn't intersect in the bottom right corner.

-- 
Kam
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 5948c74..c0fc760 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -854,7 +854,7 @@ gint x_stroke_translate_and_execute (GSCHEM_TOPLEVEL *w_current);
 void x_window_setup (GSCHEM_TOPLEVEL *w_current);
 void x_window_setup_gc(GSCHEM_TOPLEVEL *w_current);
 void x_window_free_gc(GSCHEM_TOPLEVEL *w_current);
-void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current);
+void x_window_create_drawing(GtkWidget *draw_table, GSCHEM_TOPLEVEL *w_current);
 void x_window_setup_draw_events(GSCHEM_TOPLEVEL *w_current);
 void x_window_create_main(GSCHEM_TOPLEVEL *w_current);
 void x_window_close(GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 07beb6e..485df94 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -98,27 +98,20 @@ void x_window_free_gc(GSCHEM_TOPLEVEL *w_current)
  *  \par Function Description
  *
  */
-void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current)
+void x_window_create_drawing(GtkWidget *draw_table, GSCHEM_TOPLEVEL *w_current)
 {
   /* drawing next */
   w_current->drawing_area = gtk_drawing_area_new ();
-  /* Set the size here.  Be sure that it has an aspect ratio of 1.333
-   * We could calculate this based on root window size, but for now
-   * lets just set it to:
-   * Width = root_width*3/4   Height = Width/1.33
-   * 1.333 is the desired aspect ratio!
-   */
 
-  gtk_drawing_area_size (GTK_DRAWING_AREA (w_current->drawing_area),
- w_current->win_width,
- w_current->win_height);
+  gtk_widget_set_size_request (GTK_WIDGET (w_current->drawing_area),
+   160, 120);
 
-  gtk_box_pack_start (GTK_BOX (drawbox), w_current->drawing_area,
-  TRUE, TRUE, 0);
-  GTK_WIDGET_SET_FLAGS (w_current->drawing_area, GTK_CAN_FOCUS );
-  gtk_widget_grab_focus (w_current->drawing_area);
-  gtk_widget_show (w_current->drawing_area);
+  gtk_table_attach_defaults (GTK_TABLE (draw_table), w_current->drawing_area,
+ 0, 1, 0, 1);
+
+  gtk_widget_set_can_focus (w_current->drawing_area, TRUE);
 
+  gtk_widget_grab_focus (w_current->drawing_area);
 }
 
 /*! \todo Finish function documentation!!!
@@ -247,7 +240,7 @@ void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
   GtkWidget *label=NULL;
   GtkWidget *main_box=NULL;
   GtkWidget *menubar=NULL;
-  GtkWidget *drawbox=NULL;
+  GtkWidget *draw_table=NULL;
   GtkWidget *bottom_box=NULL;
   GtkWidget *toolbar=NULL;
   GtkWidget *handlebox=NULL;
@@ -258,12 +251,16 @@ void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
   w_current->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
   gtk_widget_set_name (w_current->main_window, "gschem");
-  gtk_window_set_policy (GTK_WINDOW (w_current->main_window), TRUE, TRUE, TRUE);
-
-  /* We want the widgets to flow around the drawing area, so we don't
-   * set a size of the main window.  The drawing area's size is fixed,
-   * see below
+  
+  /* Set the size here.  Be sure that it has an aspect ratio of 1.333
+   * We could calculate this based on root window size, but for now
+   * lets just set it to:
+   * Width = root_width*3/4   Height = Width/1.33
+   * 1.333 is the desired aspect ratio!
*/
+  gtk_window_set_default_size (GTK_WINDOW (w_current->main_window),
+   w_current->win_width,
+   w_current->win_height);
 
/* 
 * normally we let the window manager handle locating and sizing
@@ -275,9 +272,9 @@ void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
	gtk_widget_set_uposition (w_current->main_window, 10, 10);
 
   /* this should work fine */
-  gtk_signal_connect (GTK_OBJECT (w_current->main_window), "delete_event",
-  GTK_SIGNAL_FUNC (i_callback_close_wm),
-  w_current);
+  g_signal_connect (G_OBJECT (w_current->main_window), "delete_event",
+G_CALLBACK (i_callback_close_wm),
+w_current);
 
   /* Containers first */
   main_box = gtk_vbox_new(FALSE, 1);
@@ -408,51 +405,47 @@ void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
   /*  Try to create popup menu (appears in right mouse button  */
   w_current->popup_menu = (GtkWidget *) get_main_popup(w_current);
 
-  drawbox = gtk_hbox_new(FALSE, 0);
-  gtk_container_border_width(GTK_CONTAINER(drawbox), 0);
-  gtk_container_add(GTK_CONTAINER(main_box), drawbox);
 
-  x_window_create_drawing(drawbox, w_current);
-  x_window_setup_draw_events(w_current);
+  draw_table = gtk_table_new (2, 2, FALSE);
+  gtk_box_pack_start (GTK_BOX (main_box), draw_table, TRUE, TRUE, 0);
 
-  if (w_current->scrollbars_flag == TRUE) {
-/*

gEDA-user: gschem : Move popupmenu to GtkUIManager

2010-08-03 Thread Camille Delbegue
Hello,

I write a patch to migrate the pop-up-menu from GtkItemFactory (witch is
deprecated since Gtk 2.4) to GtkUIManager.

Why don't use GtkUIManager and GtkAction to manage the menubar toolbar and
accelerator. This permit to use CheckMenuItem (ex : to active rubber-band and
magnetic net) and RadioMenuItem (ex : to select colour theme) in the menu.


--
Camille Delbegue
diff --git a/gschem/include/globals.h b/gschem/include/globals.h
index 8fbeb75..38c81d4 100644
--- a/gschem/include/globals.h
+++ b/gschem/include/globals.h
@@ -88,12 +88,6 @@ extern SCM new_page_hook;
 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
 #endif /* GCC_VERSION */
 
-#if GCC_VERSION > 2007
-#define ATTRIBUTE_UNUSED __attribute__((unused))
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
 /*EK* used by prototype.h */
 #include "../include/x_states.h"
 
diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index c4754cf..b453c88 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -12,6 +12,9 @@ struct st_gschem_toplevel {
   /* main window widgets */
   /* --- */
   GtkWidget *main_window;
+  
+  GtkUIManager *ui_manager;
+  GtkActionGroup *action_group;
 
   GtkWidget *drawing_area;
   GtkWidget *menubar;
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 5948c74..2ec8900 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -321,17 +321,17 @@ void i_callback_edit_undo(gpointer data, guint callback_action, GtkWidget *widge
 void i_callback_toolbar_edit_undo(GtkWidget *widget, gpointer data);
 void i_callback_edit_redo(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_toolbar_edit_redo(GtkWidget *widget, gpointer data);
-void i_callback_edit_select(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_edit_select(GtkAction *action, gpointer data);
 void i_callback_toolbar_edit_select(GtkWidget *widget, gpointer data);
-void i_callback_edit_copy(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_edit_copy(GtkAction *action, gpointer data);
 void i_callback_edit_copy_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_edit_mcopy(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_edit_mcopy_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_edit_move(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_edit_move(GtkAction *action, gpointer data);
 void i_callback_edit_move_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_edit_delete(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_edit_edit(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_edit_pin_type(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_edit_delete(GtkAction *action, gpointer data);
+void i_callback_edit_edit(GtkAction *action, gpointer data);
+void i_callback_edit_pin_type(GtkAction *action, gpointer data);
 void i_callback_edit_text(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_edit_slot(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_edit_color(gpointer data, guint callback_action, GtkWidget *widget);
@@ -355,12 +355,12 @@ void i_callback_edit_autonumber_text(gpointer data, guint callback_action, GtkWi
 void i_callback_edit_linetype(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_edit_filltype(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_view_redraw(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_view_zoom_full(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_view_zoom_extents(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_view_zoom_box(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_view_zoom_full(GtkAction *action, gpointer data);
+void i_callback_view_zoom_extents(GtkAction *action, gpointer data);
+void i_callback_view_zoom_box(GtkAction *action, gpointer data);
 void i_callback_view_zoom_box_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_view_zoom_in(gpointer data, guint callback_action, GtkWidget *widget);
-void i_callback_view_zoom_out(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_view_zoom_in(GtkAction *action, gpointer data);
+void i_callback_view_zoom_out(GtkAction *action, gpointer data);
 void i_callback_view_zoom_in_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_view_zoom_out_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_view_pan(gpointer data, guint callback_action, GtkWidget *widget);
@@ -404,17 +404,17 @@ void i_callback_buffer_paste2_hotkey(gpointer data, guint callback_a