gEDA-dev: [PATCH 3/3] gattrib: more dialog cleanup

Ivan Stankovic ivan.stankovic at fer.hr
Sun Jul 22 13:23:59 EDT 2007


---
 gattrib/include/prototype.h |   55 +---------------------------
 gattrib/src/x_dialog.c      |   83 ++++++++++--------------------------------
 gattrib/src/x_window.c      |    4 +-
 3 files changed, 24 insertions(+), 118 deletions(-)

diff --git a/gattrib/include/prototype.h b/gattrib/include/prototype.h
index c9e3bf5..a4d724a 100644
--- a/gattrib/include/prototype.h
+++ b/gattrib/include/prototype.h
@@ -171,65 +171,14 @@ void i_vars_setnames(TOPLEVEL * w_current);
 
 
 /* ------------- x_dialog.c ------------- */
-void x_dialog_newattrib_get_name();
-int x_dialog_newattrib_keypress_callback(GtkWidget * widget, 
-					 GdkEventKey * event,
-					 GtkWidget *window);
-void x_dialog_newattrib_close_callback(GtkWidget * widget, 
-				      GtkWidget *window);
-void x_dialog_newattrib_ok_callback(GtkWidget * widget, 
-				      GtkWidget *window);
-
-void x_dialog_delattrib_confirm();
-int x_dialog_delattrib_keypress_callback(GtkWidget * widget, 
-					 GdkEventKey * event,
-					 GtkWidget *window);
-void x_dialog_delattrib_close_callback(GtkWidget *buttonclose, 
-				      GtkWidget *window);
-void x_dialog_delattrib_yes_callback(GtkWidget *buttonok, 
-				    GtkWidget *window);
-
+void x_dialog_newattrib();
+void x_dialog_delattrib();
 void x_dialog_missing_sym();
-int x_dialog_missing_sym_donothing_callback(GtkWidget * widget,
-					    GdkEventKey * event,
-					    GtkWidget *window);
-void x_dialog_missing_sym_continue_callback(GtkWidget *buttonclose,
-					   GtkWidget *window);
-void x_dialog_missing_sym_abort_callback(GtkWidget *buttonyes,
-					GtkWidget *window);
-
 void x_dialog_unsaved_data();
-int x_dialog_unsaved_data_donothing_callback(GtkWidget * widget,
-					    GdkEventKey * event,
-					    GtkWidget *window);
-void x_dialog_unsaved_data_continue_callback(GtkWidget *buttonclose,
-					   GtkWidget *window);
-void x_dialog_unsaved_data_abort_callback(GtkWidget *buttonyes,
-					GtkWidget *window);
-
 void x_dialog_unimplemented_feature();
-
 void x_dialog_fatal_error(gchar *string, gint return_code);
-
-int x_dialog_about_keypress_callback(GtkWidget * widget, GdkEventKey * event,
-				     GtkWidget * window);
-void x_dialog_about_close_callback(GtkWidget * widget, GtkWidget *window);
 void x_dialog_about_dialog();
-
 void x_dialog_export_file();
-int x_dialog_export_file_keypress_callback(GtkWidget * widget, 
-					 GdkEventKey * event,
-					 GtkWidget *window);
-void x_dialog_export_file_close_callback(GtkWidget * widget, 
-				      GtkWidget *window);
-void x_dialog_export_file_ok_callback(GtkWidget * widget, 
-				      GtkWidget *window);
-
-
-GtkWidget *x_dialog_create_dialog_box(GtkWidget ** out_vbox,
-				      GtkWidget ** out_action_area);
-void x_dialog_close_window(GtkWidget * window);
-
 
 /* ------------- x_gtksheet.c ------------- */
 void x_gtksheet_init();
diff --git a/gattrib/src/x_dialog.c b/gattrib/src/x_dialog.c
index 02833ef..d948fa5 100644
--- a/gattrib/src/x_dialog.c
+++ b/gattrib/src/x_dialog.c
@@ -59,25 +59,17 @@
 #include <dmalloc.h>
 #endif
 
-/* ========================================================= *
- * new attrib dialog widgets
- * ========================================================= */
-
-/* --------------------------------------------------------- *
- * This asks for the name of the attrib column to insert
- * --------------------------------------------------------- */
-void x_dialog_newattrib_get_name()
+
+/*! \brief This asks for the name of the attrib column to insert
+ *         and then inserts the column.
+ */
+void x_dialog_newattrib()
 {
   GtkWidget *dialog;
   GtkWidget *label;
   GtkWidget *attrib_entry;
   gchar *entry_text;
 
-#ifdef DEBUG
-  printf("In x_dialog_newattrib_get_name, creating windows.\n");
-#endif
-
-
   /* Create the dialog */
   dialog = gtk_dialog_new_with_buttons("Add new attribute", NULL, 
 				       GTK_DIALOG_MODAL,
@@ -120,25 +112,16 @@ void x_dialog_newattrib_get_name()
 }
 
 
-/* ========================================================= *
- * delete attrib column dialog widgets
- * ========================================================= */
-
-/* --------------------------------------------------------- *
- * This fcn throws up the "detele foo, are you sure" dialog
- * box.  It offers two buttons: "yes" and "cancel" 
- * --------------------------------------------------------- */
-void x_dialog_delattrib_confirm()
+/*! \brief This function throws up the "Delete foo, are you sure?" dialog
+ *         box.  It offers two buttons: "yes" and "cancel".
+ */
+void x_dialog_delattrib()
 {
   GtkWidget *dialog;
   gint mincol, maxcol;
   GtkSheet *sheet;
   gint cur_page;
 
-#ifdef DEBUG
-  printf("In x_dialog_delattrib_confirm, creating windows.\n");
-#endif
-
   /* First verify that exactly one column is selected.  */ 
   cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
   sheet = GTK_SHEET(sheets[cur_page]);
@@ -148,17 +131,12 @@ void x_dialog_delattrib_confirm()
 
   mincol = x_gtksheet_get_min_col(sheet);
   maxcol =  x_gtksheet_get_max_col(sheet);
-#ifdef DEBUG
-  printf("In x_dialog_delattrib_confirm, column range selected = %d, %d\n",
-	 mincol, maxcol);
-#endif
 
   if ( (mincol != maxcol) || (mincol == -1) || (maxcol == -1) ) {
     /* Improper selection -- maybe throw up error box? */
     return;
   }
 
-
   /* Create the dialog */
   dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_QUESTION,
@@ -222,25 +200,15 @@ void x_dialog_missing_sym()
   gtk_widget_destroy(dialog);
 }
 
-
-/* ========================================================= *
- * Unsaved data windows
- * ========================================================= */
-
-/* --------------------------------------------------------- *
- * This is the "Unsaved data -- are you sure you want to quit?"
- * dialog box which is thrown up before the user quits.
- * --------------------------------------------------------- */
+/*! \brief This is the "Unsaved data -- are you sure you want to quit?" dialog
+ *         box which is thrown up before the user quits.
+ */
 void x_dialog_unsaved_data()
 {
   GtkWidget *dialog;
   const char *string = "Warning!  You have unsaved data in the spreadsheet!\n"
                        "Are you sure you want to quit?";
 
-#ifdef DEBUG
-  printf("In x_dialog_unsaved_data, creating windows.\n");
-#endif
-
   /* Create the dialog */
   dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_WARNING,
@@ -262,16 +230,9 @@ void x_dialog_unsaved_data()
   return;
 }
 
-
-/* ========================================================= *
- * Unimplemented feature callback
- * ========================================================= */
-
-/* --------------------------------------------------------- *
- * This fcn informs the user that he has chosen an 
- * unimplemented feature.  It presents only an "OK" button
- * to leave.
- * --------------------------------------------------------- */
+/*! \brief This function informs the user that he has chosen an unimplemented
+ *         feature.  It presents only an "OK" button to leave.
+ */
 void x_dialog_unimplemented_feature()
 {
   GtkWidget *dialog;
@@ -322,9 +283,8 @@ void x_dialog_fatal_error(gchar *string, gint return_code)
   exit(GPOINTER_TO_INT(return_code));
 }
 
-/* ========================================================= *
- * help/about dialog widgets
- * ========================================================= */
+/*! \brief This dosplays the about dialog.
+ */
 void x_dialog_about_dialog()
 {
   GtkWidget *dialog;
@@ -349,12 +309,9 @@ void x_dialog_about_dialog()
   gtk_widget_destroy(dialog);
 }
 
-/* ========================================================= *
- * Get name of file for export of CSV
- * ========================================================= */
-/* --------------------------------------------------------- *
- * This asks for the filename for the export file
- * --------------------------------------------------------- */
+/*! \brief This asks for the filename for the CSV export file and then
+ *         does the exporting.
+ */
 void x_dialog_export_file()
 {
   gchar *filename;
diff --git a/gattrib/src/x_window.c b/gattrib/src/x_window.c
index d2a055b..d4275de 100644
--- a/gattrib/src/x_window.c
+++ b/gattrib/src/x_window.c
@@ -173,14 +173,14 @@ menu_edit_newattrib()
 
   /* Check that we are on components page. */
   if (cur_page == 0) {
-    x_dialog_newattrib_get_name();  /* This creates dialog box  */
+    x_dialog_newattrib();  /* This creates dialog box  */
   }
 }
 
 static void
 menu_edit_delattrib()
 {
-  x_dialog_delattrib_confirm();
+  x_dialog_delattrib();
 }
 
 static const GtkActionEntry actions[] = {
-- 
1.5.2.2


More information about the geda-dev mailing list