Re: Gtk API inconstencies
- From: Nils Barth <nils_barth post harvard edu>
- To: Oskar Liljeblad <osk hem passagen se>
- Cc: gtk-devel-list gnome org
- Subject: Re: Gtk API inconstencies
- Date: Mon, 4 Sep 2000 05:49:30 -0400
Thus spake Oskar Liljeblad:
> * The specified parameter/return types should be gboolean (not
> gint or guint), because they are treated as such.
Okay, if not mentioned, I've fixed it in the attached patch.
> function argument index
>
> gtk_color_selection_set_opacity 2nd
do you mean gtk_color_selection_set_USE_opacity ()?
It's okay in CVS HEAD.
> GtkWidget.event signal return
><snip signals>
> GtkRange.timer signal return
> GtkRange.trough_keys signal return
I'm not an expert on the GTK signal internals -- these seem like they
are treated as booleans, but I don't know if GtkWidget stuff needs to
be gint for some reason.
Could someone who knows more help? Is it okay to s/gint/gboolean/ all
the events in gtk+/gtk/gtkwidget.h ? (ditto for gtkrange)
> gnome_canvas_get_color return
Er, I don't know about this one either. (GNOME??)
Looks like a boolean, but I'm not familiar with that code; anyone more
familiar with it?
--
-nils
Public key: http://www.fas.harvard.edu/~nbarth/pub-key.txt
Index: gtkcalendar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcalendar.c,v
retrieving revision 1.21
diff -u -r1.21 gtkcalendar.c
--- gtkcalendar.c 2000/07/26 11:32:42 1.21
+++ gtkcalendar.c 2000/09/04 06:53:29
@@ -2244,7 +2244,7 @@
}
}
-gint
+gboolean
gtk_calendar_mark_day (GtkCalendar *calendar,
guint day)
{
@@ -2264,7 +2264,7 @@
return TRUE;
}
-gint
+gboolean
gtk_calendar_unmark_day (GtkCalendar *calendar,
guint day)
{
Index: gtkcalendar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcalendar.h,v
retrieving revision 1.11
diff -u -r1.11 gtkcalendar.h
--- gtkcalendar.h 2000/08/30 00:33:37 1.11
+++ gtkcalendar.h 2000/09/04 06:53:29
@@ -116,9 +116,9 @@
void gtk_calendar_select_day (GtkCalendar *calendar,
guint day);
-gint gtk_calendar_mark_day (GtkCalendar *calendar,
+gboolean gtk_calendar_mark_day (GtkCalendar *calendar,
guint day);
-gint gtk_calendar_unmark_day (GtkCalendar *calendar,
+gboolean gtk_calendar_unmark_day (GtkCalendar *calendar,
guint day);
void gtk_calendar_clear_marks (GtkCalendar *calendar);
Index: gtkcombo.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcombo.c,v
retrieving revision 1.40
diff -u -r1.40 gtkcombo.c
--- gtkcombo.c 2000/07/26 11:32:43 1.40
+++ gtkcombo.c 2000/09/04 06:53:32
@@ -649,11 +649,11 @@
GtkWidget *event_box;
GdkCursor *cursor;
- combo->case_sensitive = 0;
- combo->value_in_list = 0;
- combo->ok_if_empty = 1;
- combo->use_arrows = 1;
- combo->use_arrows_always = 0;
+ combo->case_sensitive = FALSE;
+ combo->value_in_list = FALSE;
+ combo->ok_if_empty = TRUE;
+ combo->use_arrows = TRUE;
+ combo->use_arrows_always = FALSE;
combo->entry = gtk_entry_new ();
combo->button = gtk_button_new ();
combo->current_button = 0;
@@ -771,7 +771,8 @@
}
void
-gtk_combo_set_value_in_list (GtkCombo * combo, gint val, gint ok_if_empty)
+gtk_combo_set_value_in_list (GtkCombo * combo, gboolean val,
+ gboolean ok_if_empty)
{
g_return_if_fail (combo != NULL);
g_return_if_fail (GTK_IS_COMBO (combo));
@@ -781,7 +782,7 @@
}
void
-gtk_combo_set_case_sensitive (GtkCombo * combo, gint val)
+gtk_combo_set_case_sensitive (GtkCombo * combo, gboolean val)
{
g_return_if_fail (combo != NULL);
g_return_if_fail (GTK_IS_COMBO (combo));
@@ -790,7 +791,7 @@
}
void
-gtk_combo_set_use_arrows (GtkCombo * combo, gint val)
+gtk_combo_set_use_arrows (GtkCombo * combo, gboolean val)
{
g_return_if_fail (combo != NULL);
g_return_if_fail (GTK_IS_COMBO (combo));
@@ -799,13 +800,13 @@
}
void
-gtk_combo_set_use_arrows_always (GtkCombo * combo, gint val)
+gtk_combo_set_use_arrows_always (GtkCombo * combo, gboolean val)
{
g_return_if_fail (combo != NULL);
g_return_if_fail (GTK_IS_COMBO (combo));
combo->use_arrows_always = val;
- combo->use_arrows = 1;
+ combo->use_arrows = TRUE;
}
void
Index: gtkcombo.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcombo.h,v
retrieving revision 1.10
diff -u -r1.10 gtkcombo.h
--- gtkcombo.h 2000/08/30 00:33:37 1.10
+++ gtkcombo.h 2000/09/04 06:53:33
@@ -76,17 +76,17 @@
GtkWidget* gtk_combo_new (void);
/* the text in the entry must be or not be in the list */
void gtk_combo_set_value_in_list (GtkCombo* combo,
- gint val,
- gint ok_if_empty);
+ gboolean val,
+ gboolean ok_if_empty);
/* set/unset arrows working for changing the value (can be annoying */
void gtk_combo_set_use_arrows (GtkCombo* combo,
- gint val);
+ gboolean val);
/* up/down arrows change value if current value not in list */
void gtk_combo_set_use_arrows_always (GtkCombo* combo,
- gint val);
+ gboolean val);
/* perform case-sensitive compares */
void gtk_combo_set_case_sensitive (GtkCombo* combo,
- gint val);
+ gboolean val);
/* call this function on an item if it isn't a label or you
want it to have a different value to be displayed in the entry */
void gtk_combo_set_item_string (GtkCombo* combo,
Index: gtkmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenuitem.c,v
retrieving revision 1.41
diff -u -r1.41 gtkmenuitem.c
--- gtkmenuitem.c 2000/07/26 11:32:45 1.41
+++ gtkmenuitem.c 2000/09/04 06:53:39
@@ -276,8 +276,8 @@
void
gtk_menu_item_configure (GtkMenuItem *menu_item,
- gint show_toggle_indicator,
- gint show_submenu_indicator)
+ gboolean show_toggle_indicator,
+ gboolean show_submenu_indicator)
{
g_return_if_fail (menu_item != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
Index: gtkmenuitem.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenuitem.h,v
retrieving revision 1.12
diff -u -r1.12 gtkmenuitem.h
--- gtkmenuitem.h 2000/08/30 00:33:37 1.12
+++ gtkmenuitem.h 2000/09/04 06:53:39
@@ -93,8 +93,8 @@
void gtk_menu_item_set_placement (GtkMenuItem *menu_item,
GtkSubmenuPlacement placement);
void gtk_menu_item_configure (GtkMenuItem *menu_item,
- gint show_toggle_indicator,
- gint show_submenu_indicator);
+ gboolean show_toggle_indicator,
+ gboolean show_submenu_indicator);
void gtk_menu_item_select (GtkMenuItem *menu_item);
void gtk_menu_item_deselect (GtkMenuItem *menu_item);
void gtk_menu_item_activate (GtkMenuItem *menu_item);
Index: gtkpixmap.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpixmap.c,v
retrieving revision 1.18
diff -u -r1.18 gtkpixmap.c
--- gtkpixmap.c 2000/07/26 11:32:45 1.18
+++ gtkpixmap.c 2000/09/04 06:53:41
@@ -245,7 +245,7 @@
}
void
-gtk_pixmap_set_build_insensitive (GtkPixmap *pixmap, guint build)
+gtk_pixmap_set_build_insensitive (GtkPixmap *pixmap, gboolean build)
{
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GTK_IS_PIXMAP (pixmap));
Index: gtkpixmap.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpixmap.h,v
retrieving revision 1.11
diff -u -r1.11 gtkpixmap.h
--- gtkpixmap.h 2000/08/30 00:33:38 1.11
+++ gtkpixmap.h 2000/09/04 06:53:42
@@ -76,7 +76,7 @@
GdkBitmap **mask);
void gtk_pixmap_set_build_insensitive (GtkPixmap *pixmap,
- guint build);
+ gboolean build);
#ifdef __cplusplus
Index: gtkprogress.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkprogress.c,v
retrieving revision 1.11
diff -u -r1.11 gtkprogress.c
--- gtkprogress.c 2000/07/26 11:32:45 1.11
+++ gtkprogress.c 2000/09/04 06:53:44
@@ -591,7 +591,7 @@
void
gtk_progress_set_show_text (GtkProgress *progress,
- gint show_text)
+ gboolean show_text)
{
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS (progress));
Index: gtkprogress.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkprogress.h,v
retrieving revision 1.9
diff -u -r1.9 gtkprogress.h
--- gtkprogress.h 2000/08/30 00:33:38 1.9
+++ gtkprogress.h 2000/09/04 06:53:45
@@ -80,7 +80,7 @@
GtkType gtk_progress_get_type (void) G_GNUC_CONST;
void gtk_progress_set_show_text (GtkProgress *progress,
- gint show_text);
+ gboolean show_text);
void gtk_progress_set_text_alignment (GtkProgress *progress,
gfloat x_align,
gfloat y_align);
Index: gtktext.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.c,v
retrieving revision 1.83
diff -u -r1.83 gtktext.c
--- gtktext.c 2000/07/26 11:32:54 1.83
+++ gtktext.c 2000/09/04 06:54:05
@@ -747,8 +747,8 @@
}
void
-gtk_text_set_word_wrap (GtkText *text,
- gint word_wrap)
+gtk_text_set_word_wrap (GtkText *text,
+ gboolean word_wrap)
{
g_return_if_fail (text != NULL);
g_return_if_fail (GTK_IS_TEXT (text));
Index: gtktext.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.h,v
retrieving revision 1.24
diff -u -r1.24 gtktext.h
--- gtktext.h 2000/08/30 00:33:38 1.24
+++ gtktext.h 2000/09/04 06:54:06
@@ -183,7 +183,7 @@
void gtk_text_set_editable (GtkText *text,
gboolean editable);
void gtk_text_set_word_wrap (GtkText *text,
- gint word_wrap);
+ gboolean word_wrap);
void gtk_text_set_line_wrap (GtkText *text,
gint line_wrap);
void gtk_text_set_adjustments (GtkText *text,
Index: gtktoolbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.c,v
retrieving revision 1.42
diff -u -r1.42 gtktoolbar.c
--- gtktoolbar.c 2000/07/26 11:32:55 1.42
+++ gtktoolbar.c 2000/09/04 06:54:11
@@ -1077,7 +1077,7 @@
void
gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
- gint enable)
+ gboolean enable)
{
g_return_if_fail (toolbar != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
Index: gtktoolbar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.h,v
retrieving revision 1.22
diff -u -r1.22 gtktoolbar.h
--- gtktoolbar.h 2000/08/30 00:33:38 1.22
+++ gtktoolbar.h 2000/09/04 06:54:12
@@ -197,7 +197,7 @@
void gtk_toolbar_set_space_style (GtkToolbar *toolbar,
GtkToolbarSpaceStyle space_style);
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
- gint enable);
+ gboolean enable);
void gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
GtkReliefStyle relief);
GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar *toolbar);
Index: gtktree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktree.c,v
retrieving revision 1.37
diff -u -r1.37 gtktree.c
--- gtktree.c 2000/07/26 11:32:56 1.37
+++ gtktree.c 2000/09/04 06:54:16
@@ -180,7 +180,7 @@
tree->current_indent = 0;
tree->level = 0;
tree->view_mode = GTK_TREE_VIEW_LINE;
- tree->view_line = 1;
+ tree->view_line = TRUE;
}
GtkWidget*
@@ -555,17 +555,17 @@
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
tree = GTK_TREE (widget);
- if(GTK_IS_TREE(widget->parent))
+ if (GTK_IS_TREE (widget->parent))
{
/* set root tree for this tree */
- tree->root_tree = GTK_TREE(widget->parent)->root_tree;
+ tree->root_tree = GTK_TREE (widget->parent)->root_tree;
- tree->level = GTK_TREE(GTK_WIDGET(tree)->parent)->level+1;
- tree->indent_value = GTK_TREE(GTK_WIDGET(tree)->parent)->indent_value;
- tree->current_indent = GTK_TREE(GTK_WIDGET(tree)->parent)->current_indent +
+ tree->level = GTK_TREE (GTK_WIDGET (tree)->parent)->level + 1;
+ tree->indent_value = GTK_TREE (GTK_WIDGET (tree)->parent)->indent_value;
+ tree->current_indent = GTK_TREE (GTK_WIDGET (tree)->parent)->current_indent +
tree->indent_value;
- tree->view_mode = GTK_TREE(GTK_WIDGET(tree)->parent)->view_mode;
- tree->view_line = GTK_TREE(GTK_WIDGET(tree)->parent)->view_line;
+ tree->view_mode = GTK_TREE (GTK_WIDGET (tree)->parent)->view_mode;
+ tree->view_line = GTK_TREE (GTK_WIDGET (tree)->parent)->view_line;
}
else
tree->root_tree = tree;
@@ -1227,7 +1227,7 @@
void
gtk_tree_set_view_lines (GtkTree *tree,
- guint flag)
+ gboolean flag)
{
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
Index: gtktree.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktree.h,v
retrieving revision 1.14
diff -u -r1.14 gtktree.h
--- gtktree.h 2000/08/30 00:33:38 1.14
+++ gtktree.h 2000/09/04 06:54:17
@@ -118,7 +118,7 @@
void gtk_tree_set_view_mode (GtkTree *tree,
GtkTreeViewMode mode);
void gtk_tree_set_view_lines (GtkTree *tree,
- guint flag);
+ gboolean flag);
/* deprecated function, use gtk_container_remove instead.
*/
Index: gtktreeitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeitem.c,v
retrieving revision 1.40
diff -u -r1.40 gtktreeitem.c
--- gtktreeitem.c 2000/07/26 11:32:57 1.40
+++ gtktreeitem.c 2000/09/04 06:54:25
@@ -548,14 +548,14 @@
border_width = (GTK_CONTAINER (widget)->border_width +
widget->style->xthickness);
- child_allocation.x = border_width + GTK_TREE(widget->parent)->current_indent;
+ child_allocation.x = border_width + GTK_TREE (widget->parent)->current_indent;
child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = item->pixmaps_box->requisition.width;
child_allocation.height = item->pixmaps_box->requisition.height;
temp = allocation->height - child_allocation.height;
- child_allocation.y += ( temp / 2 ) + ( temp % 2 );
+ child_allocation.y += (temp / 2) + (temp % 2);
gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
@@ -580,8 +580,8 @@
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- item = GTK_TREE_ITEM(widget);
- tree = GTK_TREE(widget->parent);
+ item = GTK_TREE_ITEM (widget);
+ tree = GTK_TREE (widget->parent);
if (!tree->view_line)
return;
@@ -600,7 +600,7 @@
gdk_draw_line (widget->window, widget->style->black_gc, lx1, ly1, lx2, ly2);
/* draw vertical line for subtree connecting */
- if(g_list_last(tree->children)->data != (gpointer)widget)
+ if(g_list_last (tree->children)->data != (gpointer)widget)
ly2 = (ly2 / 2) + (ly2 % 2);
lx2 += DEFAULT_DELTA;
@@ -616,7 +616,7 @@
gdk_draw_line (widget->window, widget->style->black_gc,
lx1, ly1, lx2, ly2);
- lx2 -= DEFAULT_DELTA+2;
+ lx2 -= DEFAULT_DELTA + 2;
ly1 = 0;
ly2 = widget->allocation.height;
Index: gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.173
diff -u -r1.173 gtkwidget.c
--- gtkwidget.c 2000/08/22 03:05:14 1.173
+++ gtkwidget.c 2000/09/04 06:54:49
@@ -2273,7 +2273,7 @@
* results:
*****************************************/
-gint
+gboolean
gtk_widget_event (GtkWidget *widget,
GdkEvent *event)
{
@@ -2551,7 +2551,7 @@
* results:
*****************************************/
-gint
+gboolean
gtk_widget_intersect (GtkWidget *widget,
GdkRectangle *area,
GdkRectangle *intersection)
Index: gtkwidget.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.h,v
retrieving revision 1.81
diff -u -r1.81 gtkwidget.h
--- gtkwidget.h 2000/09/03 05:49:34 1.81
+++ gtkwidget.h 2000/09/04 06:54:53
@@ -497,7 +497,7 @@
void gtk_widget_lock_accelerators (GtkWidget *widget);
void gtk_widget_unlock_accelerators (GtkWidget *widget);
gboolean gtk_widget_accelerators_locked (GtkWidget *widget);
-gint gtk_widget_event (GtkWidget *widget,
+gboolean gtk_widget_event (GtkWidget *widget,
GdkEvent *event);
gboolean gtk_widget_activate (GtkWidget *widget);
@@ -510,7 +510,7 @@
void gtk_widget_popup (GtkWidget *widget,
gint x,
gint y);
-gint gtk_widget_intersect (GtkWidget *widget,
+gboolean gtk_widget_intersect (GtkWidget *widget,
GdkRectangle *area,
GdkRectangle *intersection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]