Browse Source

* widget.h: Use exact type in the listbox callback. Adjust all
legitimate users, remove all unused callbacks.

Pavel Roskin 21 years ago
parent
commit
58545e65c2
9 changed files with 17 additions and 54 deletions
  1. 1 9
      edit/editcmd.c
  2. 3 0
      src/ChangeLog
  3. 1 6
      src/achown.c
  4. 2 8
      src/chown.c
  5. 1 6
      src/complete.c
  6. 1 2
      src/hotlist.c
  7. 1 7
      src/listmode.c
  8. 2 9
      src/panelize.c
  9. 5 7
      src/widget.h

+ 1 - 9
edit/editcmd.c

@@ -2719,13 +2719,6 @@ edit_collect_completions (WEdit *edit, long start, int word_len,
 }
 
 
-static int
-compllist_callback (void *data)
-{
-    return 0;
-}
-
-
 /* let the user select its preferred completion */
 static void
 edit_completion_dialog (WEdit *edit, int max_len, int word_len,
@@ -2766,8 +2759,7 @@ edit_completion_dialog (WEdit *edit, int max_len, int word_len,
 
     /* create the listbox */
     compl_list =
-	listbox_new (1, 1, compl_dlg_w - 2, compl_dlg_h - 2, 0,
-		     compllist_callback);
+	listbox_new (1, 1, compl_dlg_w - 2, compl_dlg_h - 2, 0, NULL);
 
     /* add the dialog */
     add_widget (compl_dlg, compl_list);

+ 3 - 0
src/ChangeLog

@@ -1,5 +1,8 @@
 2003-09-01  Pavel Roskin  <proski@gnu.org>
 
+	* widget.h: Use exact type in the listbox callback.  Adjust all
+	legitimate users, remove all unused callbacks.
+
 	* boxes.c: Fix GUI code for some non-default configurations.
 	* listmode.c: Likewise.
 

+ 1 - 6
src/achown.c

@@ -217,11 +217,6 @@ static void update_mode (Dlg_head * h)
     send_message (h->current->widget, WIDGET_FOCUS, 0);
 }
 
-static int l_call (void *data)
-{
-    return 1;
-}
-
 static int chl_callback (Dlg_head * h, int Par, int Msg)
 {
     switch (Msg) {
@@ -265,7 +260,7 @@ do_enter_key (Dlg_head * h, int f_pos)
 			"[Advanced Chown]", title, DLG_COMPACT);
 
 	/* get new listboxes */
-	chl_list = listbox_new (1, 1, 15, 11, 0, l_call);
+	chl_list = listbox_new (1, 1, 15, 11, 0, NULL);
 
 	listbox_add_item (chl_list, 0, 0, "<Unknown>", NULL);
 

+ 2 - 8
src/chown.c

@@ -141,12 +141,6 @@ chown_callback (Dlg_head * h, int Par, int Msg)
     return 0;
 }
 
-static int
-l_call (void *data)
-{
-    return 1;
-}
-
 static Dlg_head *
 init_chown (void)
 {
@@ -177,8 +171,8 @@ init_chown (void)
     }
 
     /* get new listboxes */
-    l_user = listbox_new (UY + 1, UX + 1, 19, 10, 0, l_call);
-    l_group = listbox_new (GY + 1, GX + 1, 19, 10, 0, l_call);
+    l_user = listbox_new (UY + 1, UX + 1, 19, 10, 0, NULL);
+    l_group = listbox_new (GY + 1, GX + 1, 19, 10, 0, NULL);
 
     /* add fields for unknown names (numbers) */
     listbox_add_item (l_user, 0, 0, _("<Unknown user>"), NULL);

+ 1 - 6
src/complete.c

@@ -909,11 +909,6 @@ query_callback (Dlg_head * h, int Par, int Msg)
     return 0;
 }
 
-static int querylist_callback (void *data)
-{
-    return 1;
-}
-
 #define DO_INSERTION 1
 #define DO_QUERY     2
 /* Returns 1 if the user would like to see us again */
@@ -985,7 +980,7 @@ complete_engine (WInput *in, int what_to_do)
     	    query_dlg = create_dlg (y, x, query_height, query_width,
 				    dialog_colors, query_callback,
 				    "[Completion]", NULL, DLG_COMPACT);
-    	    query_list = listbox_new (1, 1, w - 2, h - 2, 0, querylist_callback);
+    	    query_list = listbox_new (1, 1, w - 2, h - 2, 0, NULL);
     	    add_widget (query_dlg, query_list);
     	    for (p = in->completions + 1; *p; p++)
     	    	listbox_add_item (query_list, 0, 0, *p, NULL);

+ 1 - 2
src/hotlist.c

@@ -476,9 +476,8 @@ l1:
     return 0;
 }
 
-static int l_call (void *l)
+static int l_call (WListbox *list)
 {
-    WListbox *list = (WListbox *) l;
     Dlg_head *dlg = hotlist_state.moving ? movelist_dlg : hotlist_dlg;
 
     if (list->current){

+ 1 - 7
src/listmode.c

@@ -147,12 +147,6 @@ listmode_callback (Dlg_head * h, int Par, int Msg)
     return 0;
 }
 
-static int
-l_call (void *data)
-{
-    return 1;
-}
-
 static Dlg_head *
 init_listmode (char *oldlistformat)
 {
@@ -198,7 +192,7 @@ init_listmode (char *oldlistformat)
     radio_justify->sel = 1;
 
     /* get new listbox */
-    l_listmode = listbox_new (UY + 5, UX + 1, 16, 9, 0, l_call);
+    l_listmode = listbox_new (UY + 5, UX + 1, 16, 9, 0, NULL);
 
     if (strncmp (oldlistformat, "full ", 5) == 0) {
 	format_width = 1;

+ 2 - 9
src/panelize.c

@@ -113,11 +113,6 @@ panelize_callback (Dlg_head * h, int Par, int Msg)
     return 0;
 }
 
-static int l_call (void *data)
-{
-	return listbox_nothing;
-}
-
 static void
 init_panelize (void)
 {
@@ -171,13 +166,11 @@ init_panelize (void)
 		   "in");
     add_widget (panelize_dlg, pname);
 
-    add_widget (panelize_dlg,
-		label_new (UY + 13, UX, _("Command")));
+    add_widget (panelize_dlg, label_new (UY + 13, UX, _("Command")));
 
     /* get new listbox */
     l_panelize =
-	listbox_new (UY + 1, UX + 1, panelize_dlg->cols - 12, 10, 0,
-		     l_call);
+	listbox_new (UY + 1, UX + 1, panelize_dlg->cols - 12, 10, 0, NULL);
 
     while (current) {
 	listbox_add_item (l_panelize, 0, 0, current->label, current);

+ 5 - 7
src/widget.h

@@ -91,10 +91,6 @@ typedef struct WLEntry {
     struct WLEntry *prev;
 } WLEntry;
 
-enum {
-    listbox_begin, listbox_end
-} /* listbox_insert */;
-
 /* Listbox actions when selecting an option: */
 enum {
     listbox_nothing,
@@ -102,9 +98,11 @@ enum {
     listbox_cback		/* call the callback routine */
 } /* listbox_action */;
 
-typedef int (*lcback) (void *);
+struct WListbox;
+typedef struct WListbox WListbox;
+typedef int (*lcback) (WListbox *);
 
-typedef struct WListbox {
+struct WListbox {
     Widget widget;
     WLEntry *list;		/* Pointer to the circular double linked list. */
     WLEntry *top;		/* The first element displayed */
@@ -118,7 +116,7 @@ typedef struct WListbox {
     int scrollbar;		/* Draw a scrollbar? */
     lcback cback;		/* The callback function */
     int cursor_x, cursor_y;	/* Cache the values */
-} WListbox;
+};
 
 typedef void (*buttonbarfn)(void *);