summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Painter <jpaint@src.gnome.org>1998-02-18 10:03:54 +0000
committerJay Painter <jpaint@src.gnome.org>1998-02-18 10:03:54 +0000
commit9ad922290cc7495298099a4b97029942b0ce34c3 (patch)
treeea2a61952c1a77e20a90ee41628b9a877e41ff9e
parent7e3692b99f0b1e251ca4264b318b6e5c0462242a (diff)
downloadgtk+-9ad922290cc7495298099a4b97029942b0ce34c3.tar.gz
A couple of compiler warning fixes, GtkCList signal changes, changed
fileselect to work with new CList signals, and enhanced testgtk's clist example to show pixmaps and signal results. -Jay Painter
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-07
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-27
-rw-r--r--ChangeLog.pre-2-47
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--gdk/gdk.c28
-rw-r--r--gdk/x11/gdkmain-x11.c28
-rw-r--r--gtk/gtkclist.c77
-rw-r--r--gtk/gtkclist.h18
-rw-r--r--gtk/gtkfilesel.c110
-rw-r--r--gtk/gtkgamma.c98
-rw-r--r--gtk/testgtk.c93
-rw-r--r--tests/testgtk.c93
15 files changed, 438 insertions, 156 deletions
diff --git a/ChangeLog b/ChangeLog
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index b7f5ea7f26..fe9e992217 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+Wed Feb 18 01:09:56 PST 1998 Jay Painter <jpaint@serv.net>
+ * gdk/gdk.c: fixed ambigous else compiler warning
+ * gtk/gtkgamma.c: fixed ambigous else compiler warning
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: new signals which break everything! (yeah!)
+ * gtk/gtkfilesel.c: fixed to use new clist signals
+
Wed Feb 18 04:38:24 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h:
diff --git a/gdk/gdk.c b/gdk/gdk.c
index b7ecdcf7ad..b11b3f8236 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -1282,21 +1282,23 @@ gdk_pointer_grab (GdkWindow * window,
confine_to,
time);
else
- return_val = Success;;
+ return_val = Success;
if (return_val == Success)
- if (!window_private->destroyed)
- return_val = XGrabPointer (window_private->xdisplay,
- xwindow,
- owner_events,
- xevent_mask,
- GrabModeAsync, GrabModeAsync,
- xconfine_to,
- xcursor,
- time);
- else
- return_val = AlreadyGrabbed;
-
+ {
+ if (!window_private->destroyed)
+ return_val = XGrabPointer (window_private->xdisplay,
+ xwindow,
+ owner_events,
+ xevent_mask,
+ GrabModeAsync, GrabModeAsync,
+ xconfine_to,
+ xcursor,
+ time);
+ else
+ return_val = AlreadyGrabbed;
+ }
+
if (return_val == GrabSuccess)
xgrab_window = window_private;
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index b7ecdcf7ad..b11b3f8236 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -1282,21 +1282,23 @@ gdk_pointer_grab (GdkWindow * window,
confine_to,
time);
else
- return_val = Success;;
+ return_val = Success;
if (return_val == Success)
- if (!window_private->destroyed)
- return_val = XGrabPointer (window_private->xdisplay,
- xwindow,
- owner_events,
- xevent_mask,
- GrabModeAsync, GrabModeAsync,
- xconfine_to,
- xcursor,
- time);
- else
- return_val = AlreadyGrabbed;
-
+ {
+ if (!window_private->destroyed)
+ return_val = XGrabPointer (window_private->xdisplay,
+ xwindow,
+ owner_events,
+ xevent_mask,
+ GrabModeAsync, GrabModeAsync,
+ xconfine_to,
+ xcursor,
+ time);
+ else
+ return_val = AlreadyGrabbed;
+ }
+
if (return_val == GrabSuccess)
xgrab_window = window_private;
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index f6eec931a8..361dbf13e0 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -92,10 +92,11 @@ COLUMN_FROM_XPIXEL (GtkCList * clist,
(clist)->column[(clist)->columns - 1].area.width + \
COLUMN_INSET + CELL_SPACING)
-
/* Signals */
enum
{
+ MOUSE_CLICK,
+ MOUSE_DOUBLE_CLICK,
SELECT_ROW,
UNSELECT_ROW,
CLICK_COLUMN,
@@ -105,7 +106,7 @@ enum
typedef void (*GtkCListSignal1) (GtkObject * object,
gint arg1,
gint arg2,
- GdkEventButton * arg3,
+ gint arg3,
gpointer data);
typedef void (*GtkCListSignal2) (GtkObject * object,
@@ -164,11 +165,11 @@ static void size_allocate_columns (GtkCList * clist);
static void real_select_row (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event);
+ gint button);
static void real_unselect_row (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event);
+ gint button);
static gint get_selection_info (GtkCList * clist,
gint x,
gint y,
@@ -248,13 +249,11 @@ static void gtk_clist_marshal_signal_2 (GtkObject * object,
GtkArg * args);
/* Fill in data after widget is realized and has style */
-
static void add_style_data (GtkCList * clist);
static GtkContainerClass *parent_class = NULL;
static gint clist_signals[LAST_SIGNAL] = {0};
-
guint
gtk_clist_get_type ()
{
@@ -291,21 +290,34 @@ gtk_clist_class_init (GtkCListClass * klass)
container_class = (GtkContainerClass *) klass;
parent_class = gtk_type_class (gtk_container_get_type ());
-
+ clist_signals[MOUSE_CLICK] =
+ gtk_signal_new ("mouse_click",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkCListClass, mouse_click),
+ gtk_clist_marshal_signal_1,
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_INT);
+ clist_signals[MOUSE_DOUBLE_CLICK] =
+ gtk_signal_new ("mouse_double_click",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkCListClass, mouse_double_click),
+ gtk_clist_marshal_signal_1,
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_INT);
clist_signals[SELECT_ROW] =
gtk_signal_new ("select_row",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkCListClass, select_row),
gtk_clist_marshal_signal_1,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_INT);
clist_signals[UNSELECT_ROW] =
gtk_signal_new ("unselect_row",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkCListClass, unselect_row),
gtk_clist_marshal_signal_1,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_INT);
clist_signals[CLICK_COLUMN] =
gtk_signal_new ("click_column",
GTK_RUN_LAST,
@@ -335,6 +347,8 @@ gtk_clist_class_init (GtkCListClass * klass)
container_class->remove = NULL;
container_class->foreach = gtk_clist_foreach;
+ klass->mouse_click = NULL;
+ klass->mouse_double_click = NULL;
klass->select_row = real_select_row;
klass->unselect_row = real_unselect_row;
klass->click_column = NULL;
@@ -352,9 +366,10 @@ gtk_clist_marshal_signal_1 (GtkObject * object,
rfunc = (GtkCListSignal1) func;
- (*rfunc) (object, GTK_VALUE_INT (args[0]),
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
+ GTK_VALUE_INT (args[2]),
func_data);
}
@@ -368,7 +383,8 @@ gtk_clist_marshal_signal_2 (GtkObject * object,
rfunc = (GtkCListSignal2) func;
- (*rfunc) (object, GTK_VALUE_INT (args[0]),
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
func_data);
}
@@ -812,7 +828,7 @@ gtk_clist_set_row_height (GtkCList * clist,
if (GTK_WIDGET_REALIZED (clist))
{
text_height = height - (GTK_WIDGET (clist)->style->font->ascent +
- GTK_WIDGET (clist) ->style->font->descent + 1);
+ GTK_WIDGET (clist)->style->font->descent + 1);
clist->row_center_offset = (text_height / 2) + GTK_WIDGET (clist)->style->font->ascent + 1.5;
}
@@ -1425,7 +1441,7 @@ gtk_clist_select_row (GtkCList * clist,
if (column < -1 || column >= clist->columns)
return;
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW], row, column, NULL);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW], row, column, 0);
}
void
@@ -1441,7 +1457,7 @@ gtk_clist_unselect_row (GtkCList * clist,
if (column < -1 || column >= clist->columns)
return;
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW], row, column, NULL);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW], row, column, 0);
}
gint
@@ -1904,8 +1920,25 @@ gtk_clist_button_press (GtkWidget * widget,
y = event->y;
if (get_selection_info (clist, x, y, &row, &column))
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
+ {
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[MOUSE_CLICK],
+ row, column, event->button);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
+ row, column, event->button);
+ break;
+
+ case GDK_2BUTTON_PRESS:
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[MOUSE_DOUBLE_CLICK],
+ row, column, event->button);
+ break;
+
+ default:
+ break;
+ }
+ }
return FALSE;
}
@@ -2724,7 +2757,7 @@ static void
real_select_row (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event)
+ gint button)
{
gint i;
GList *list;
@@ -2763,7 +2796,7 @@ real_select_row (GtkCList * clist,
}
else if (clist_row->state == GTK_STATE_SELECTED)
{
- gtk_clist_unselect_row (clist, i, column);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW], i, column, button);
}
i++;
@@ -2791,7 +2824,7 @@ real_select_row (GtkCList * clist,
}
else if (clist_row->state == GTK_STATE_SELECTED)
{
- gtk_clist_unselect_row (clist, i, column);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW], i, column, button);
}
i++;
@@ -2811,7 +2844,7 @@ real_select_row (GtkCList * clist,
if (clist_row->state == GTK_STATE_SELECTED)
{
clist_row->state = GTK_STATE_NORMAL;
- gtk_clist_unselect_row (clist, i, column);
+ gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW], i, column, button);
}
else
{
@@ -2839,7 +2872,7 @@ static void
real_unselect_row (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event)
+ gint button)
{
GtkCListRow *clist_row;
diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h
index 164e2070c5..fb3d3afdd7 100644
--- a/gtk/gtkclist.h
+++ b/gtk/gtkclist.h
@@ -110,7 +110,7 @@ struct _GtkCList
/* dynamicly allocated array of column structures */
GtkCListColumn *column;
- /*the scrolling window and it's height and width to
+ /* the scrolling window and it's height and width to
* make things a little speedier */
GdkWindow *clist_window;
gint clist_window_width;
@@ -153,14 +153,26 @@ struct _GtkCListClass
{
GtkContainerClass parent_class;
+ void (*mouse_click) (GtkCList * clist,
+ gint row,
+ gint column,
+ gint button);
+
+ void (*mouse_double_click) (GtkCList * clist,
+ gint row,
+ gint column,
+ gint button);
+
void (*select_row) (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event);
+ gint button);
+
void (*unselect_row) (GtkCList * clist,
gint row,
gint column,
- GdkEventButton * event);
+ gint button);
+
void (*click_column) (GtkCList * clist,
gint column);
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 6ac0326598..2001e2d937 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -286,15 +286,27 @@ static gint gtk_file_selection_key_press (GtkWidget *widget,
static void gtk_file_selection_file_button (GtkWidget *widget,
gint row,
gint column,
- GdkEventButton *bevent,
+ gint button,
gpointer user_data);
+static void gtk_file_selection_file_button_double (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button,
+ gpointer user_data);
+
static void gtk_file_selection_dir_button (GtkWidget *widget,
gint row,
gint column,
- GdkEventButton *bevent,
+ gint button,
gpointer data);
+static void gtk_file_selection_dir_button_double (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button,
+ gpointer data);
+
static void gtk_file_selection_populate (GtkFileSelection *fs,
gchar *rel_path,
gint try_complete);
@@ -428,6 +440,9 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_signal_connect (GTK_OBJECT (filesel->dir_list), "select_row",
(GtkSignalFunc) gtk_file_selection_dir_button,
(gpointer) filesel);
+ gtk_signal_connect (GTK_OBJECT (filesel->dir_list), "mouse_double_click",
+ (GtkSignalFunc) gtk_file_selection_dir_button_double,
+ (gpointer) filesel);
gtk_clist_set_policy (GTK_CLIST (filesel->dir_list), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list));
gtk_container_border_width (GTK_CONTAINER (filesel->dir_list), 5);
@@ -440,6 +455,9 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_signal_connect (GTK_OBJECT (filesel->file_list), "select_row",
(GtkSignalFunc) gtk_file_selection_file_button,
(gpointer) filesel);
+ gtk_signal_connect (GTK_OBJECT (filesel->file_list), "mouse_double_click",
+ (GtkSignalFunc) gtk_file_selection_file_button_double,
+ (gpointer) filesel);
gtk_clist_set_policy (GTK_CLIST (filesel->file_list), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list));
gtk_container_border_width (GTK_CONTAINER (filesel->file_list), 5);
@@ -1092,10 +1110,10 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
static void
gtk_file_selection_file_button (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *bevent,
- gpointer user_data)
+ gint row,
+ gint column,
+ gint button,
+ gpointer user_data)
{
GtkFileSelection *fs = NULL;
gchar *filename;
@@ -1108,29 +1126,37 @@ gtk_file_selection_file_button (GtkWidget *widget,
filename = gtk_clist_get_row_data (GTK_CLIST (fs->file_list), row);
- if (bevent && filename)
- {
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
-
- case GDK_2BUTTON_PRESS:
- gtk_button_clicked (GTK_BUTTON (fs->ok_button));
- break;
-
- default:
- break;
- }
- }
+ if (filename)
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+}
+
+static void
+gtk_file_selection_file_button_double (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button,
+ gpointer user_data)
+{
+ GtkFileSelection *fs = NULL;
+ gchar *filename;
+
+ g_return_if_fail (GTK_IS_CLIST (widget));
+
+ fs = user_data;
+ g_return_if_fail (fs != NULL);
+ g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
+
+ filename = gtk_clist_get_row_data (GTK_CLIST (fs->file_list), row);
+
+ if (filename)
+ gtk_button_clicked (GTK_BUTTON (fs->ok_button));
}
static void
gtk_file_selection_dir_button (GtkWidget *widget,
gint row,
gint column,
- GdkEventButton *bevent,
+ gint button,
gpointer user_data)
{
GtkFileSelection *fs = NULL;
@@ -1144,22 +1170,30 @@ gtk_file_selection_dir_button (GtkWidget *widget,
filename = gtk_clist_get_row_data (GTK_CLIST (fs->dir_list), row);
- if (bevent && filename) {
+ if (filename)
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+}
+
+static void
+gtk_file_selection_dir_button_double (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button,
+ gpointer user_data)
+{
+ GtkFileSelection *fs = NULL;
+ gchar *filename;
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
-
- case GDK_2BUTTON_PRESS:
- gtk_file_selection_populate (fs, filename, FALSE);
- break;
-
- default:
- break;
- }
- }
+ g_return_if_fail (GTK_IS_CLIST (widget));
+
+ fs = GTK_FILE_SELECTION (user_data);
+ g_return_if_fail (fs != NULL);
+ g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
+
+ filename = gtk_clist_get_row_data (GTK_CLIST (fs->dir_list), row);
+
+ if (filename)
+ gtk_file_selection_populate (fs, filename, FALSE);
}
static void
diff --git a/gtk/gtkgamma.c b/gtk/gtkgamma.c
index 9d88de54e0..cfad6cc8b8 100644
--- a/gtk/gtkgamma.c
+++ b/gtk/gtkgamma.c
@@ -320,54 +320,58 @@ button_clicked_callback (GtkWidget *w, gpointer data)
active = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
if (active == 3)
- /* set gamma */
- if (c->gamma_dialog)
- return;
- else
- {
- GtkWidget *vbox, *hbox, *label, *button;
- gchar buf[64];
-
- c->gamma_dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), "Gamma");
- vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
-
- hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("Gamma value");
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
- gtk_widget_show (label);
-
- sprintf (buf, "%g", c->gamma);
- c->gamma_text = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf);
- gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2);
- gtk_widget_show (c->gamma_text);
-
- /* fill in action area: */
- hbox = GTK_DIALOG (c->gamma_dialog)->action_area;
-
- button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gamma_ok_callback, c);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gamma_cancel_callback, c);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_widget_show (c->gamma_dialog);
- }
+ {
+ /* set gamma */
+ if (c->gamma_dialog)
+ return;
+ else
+ {
+ GtkWidget *vbox, *hbox, *label, *button;
+ gchar buf[64];
+
+ c->gamma_dialog = gtk_dialog_new ();
+ gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), "Gamma");
+ vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
+
+ hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
+ gtk_widget_show (hbox);
+
+ label = gtk_label_new ("Gamma value");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
+ gtk_widget_show (label);
+
+ sprintf (buf, "%g", c->gamma);
+ c->gamma_text = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf);
+ gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2);
+ gtk_widget_show (c->gamma_text);
+
+ /* fill in action area: */
+ hbox = GTK_DIALOG (c->gamma_dialog)->action_area;
+
+ button = gtk_button_new_with_label ("OK");
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gamma_ok_callback, c);
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_grab_default (button);
+ gtk_widget_show (button);
+
+ button = gtk_button_new_with_label ("Cancel");
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gamma_cancel_callback, c);
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_show (button);
+
+ gtk_widget_show (c->gamma_dialog);
+ }
+ }
else
- /* reset */
- gtk_curve_reset (GTK_CURVE (c->curve));
+ {
+ /* reset */
+ gtk_curve_reset (GTK_CURVE (c->curve));
+ }
}
static void
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 3a2ea1a0fb..d520e52af2 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -1660,20 +1660,37 @@ hide_titles_clist (GtkWidget *widget, gpointer data)
}
void
+mouse_click_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ g_print ("GtkCList Mouse Click: row %d column %d button %d\n",
+ row, column, button);
+}
+
+void
+mouse_double_click_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ g_print ("GtkCList Mouse Double Click: row %d column %d button %d\n",
+ row, column, button);
+}
+
+void
select_clist (GtkWidget *widget,
gint row,
gint column,
- GdkEventButton *bevent)
+ gint button)
{
- gint button = 0, i;
+ gint i;
guint8 spacing;
gchar *text;
GdkPixmap *pixmap;
GdkBitmap *mask;
- if (bevent)
- button = bevent->button;
-
g_print ("GtkCList Selection: row %d column %d button %d\n",
row, column, button);
@@ -1714,6 +1731,55 @@ select_clist (GtkWidget *widget,
}
void
+unselect_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ gint i;
+ guint8 spacing;
+ gchar *text;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ g_print ("GtkCList UnSelection: row %d column %d button %d\n",
+ row, column, button);
+
+ for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
+ {
+ switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
+ {
+ case GTK_CELL_TEXT:
+ g_print ("CELL %d GTK_CELL_TEXT\n", i);
+ gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
+ g_print ("TEXT: %s\n", text);
+ break;
+
+ case GTK_CELL_PIXMAP:
+ g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
+ gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
+ g_print ("PIXMAP: %d\n", (int) pixmap);
+ g_print ("MASK: %d\n", (int) mask);
+ break;
+
+ case GTK_CELL_PIXTEXT:
+ g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
+ gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
+ g_print ("TEXT: %s\n", text);
+ g_print ("SPACING: %d\n", spacing);
+ g_print ("PIXMAP: %d\n", (int) pixmap);
+ g_print ("MASK: %d\n", (int) mask);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ g_print ("\n\n");
+}
+
+void
list_selection_clist (GtkWidget *widget, gpointer data)
{
}
@@ -1852,17 +1918,24 @@ create_clist ()
/*
* the rest of the clist configuration
*/
- /*
- gtk_clist_set_column_title (GTK_CLIST (clist), 0, "Hello");
- gtk_clist_set_column_title (GTK_CLIST (clist), 4, "Joe 4");
- */
- gtk_clist_column_titles_passive (GTK_CLIST (clist));
gtk_clist_set_row_height (GTK_CLIST (clist), 20);
gtk_signal_connect (GTK_OBJECT (clist),
+ "mouse_click",
+ (GtkSignalFunc) mouse_click_clist,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
+ "mouse_double_click",
+ (GtkSignalFunc) mouse_double_click_clist,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
"select_row",
(GtkSignalFunc) select_clist,
NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
+ "unselect_row",
+ (GtkSignalFunc) unselect_clist,
+ NULL);
gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 3a2ea1a0fb..d520e52af2 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -1660,20 +1660,37 @@ hide_titles_clist (GtkWidget *widget, gpointer data)
}
void
+mouse_click_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ g_print ("GtkCList Mouse Click: row %d column %d button %d\n",
+ row, column, button);
+}
+
+void
+mouse_double_click_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ g_print ("GtkCList Mouse Double Click: row %d column %d button %d\n",
+ row, column, button);
+}
+
+void
select_clist (GtkWidget *widget,
gint row,
gint column,
- GdkEventButton *bevent)
+ gint button)
{
- gint button = 0, i;
+ gint i;
guint8 spacing;
gchar *text;
GdkPixmap *pixmap;
GdkBitmap *mask;
- if (bevent)
- button = bevent->button;
-
g_print ("GtkCList Selection: row %d column %d button %d\n",
row, column, button);
@@ -1714,6 +1731,55 @@ select_clist (GtkWidget *widget,
}
void
+unselect_clist (GtkWidget *widget,
+ gint row,
+ gint column,
+ gint button)
+{
+ gint i;
+ guint8 spacing;
+ gchar *text;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ g_print ("GtkCList UnSelection: row %d column %d button %d\n",
+ row, column, button);
+
+ for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
+ {
+ switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
+ {
+ case GTK_CELL_TEXT:
+ g_print ("CELL %d GTK_CELL_TEXT\n", i);
+ gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
+ g_print ("TEXT: %s\n", text);
+ break;
+
+ case GTK_CELL_PIXMAP:
+ g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
+ gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
+ g_print ("PIXMAP: %d\n", (int) pixmap);
+ g_print ("MASK: %d\n", (int) mask);
+ break;
+
+ case GTK_CELL_PIXTEXT:
+ g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
+ gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
+ g_print ("TEXT: %s\n", text);
+ g_print ("SPACING: %d\n", spacing);
+ g_print ("PIXMAP: %d\n", (int) pixmap);
+ g_print ("MASK: %d\n", (int) mask);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ g_print ("\n\n");
+}
+
+void
list_selection_clist (GtkWidget *widget, gpointer data)
{
}
@@ -1852,17 +1918,24 @@ create_clist ()
/*
* the rest of the clist configuration
*/
- /*
- gtk_clist_set_column_title (GTK_CLIST (clist), 0, "Hello");
- gtk_clist_set_column_title (GTK_CLIST (clist), 4, "Joe 4");
- */
- gtk_clist_column_titles_passive (GTK_CLIST (clist));
gtk_clist_set_row_height (GTK_CLIST (clist), 20);
gtk_signal_connect (GTK_OBJECT (clist),
+ "mouse_click",
+ (GtkSignalFunc) mouse_click_clist,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
+ "mouse_double_click",
+ (GtkSignalFunc) mouse_double_click_clist,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
"select_row",
(GtkSignalFunc) select_clist,
NULL);
+ gtk_signal_connect (GTK_OBJECT (clist),
+ "unselect_row",
+ (GtkSignalFunc) unselect_clist,
+ NULL);
gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);