complete api change to honour message contexts. unfortunaltely this also

Sun Mar  1 22:59:09 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkstatusbar.h:
        * gtk/gtkstatusbar.c: complete api change to honour message contexts.
        unfortunaltely this also involved argument changes on the signal
        emissions which will not be caught by the compiler. your callbacks
        should look like:
        void  message_text_popped (GtkStatusbar   *statusbar,
                                   guint           context_id,
                                   const gchar    *text,
                                   gpointer        func_data);

        * gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
        initial signal emission.
        (gtk_widget_set_parent): don't ensure style, just call
        gtk_widget_set_style_recurse.
        (gtk_widget_set_style_recurse): only change a widget's rc styles if
        if there has already been a lookup.

        * gtk/testgtk.c: adaptions for statusbar widget.
        substituted notebook pixmaps with pixmaps from fvwm, since
        we don't know where the originals came from.

        * gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
        notifier with the objects data, not its internal structure.

        * gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
        fix from lars.
This commit is contained in:
Tim Janik 1998-03-01 23:29:40 +00:00 committed by Tim Janik
parent 3fb589b2ff
commit af18ab4305
14 changed files with 496 additions and 163 deletions

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1,3 +1,32 @@
Sun Mar 1 22:59:09 1998 Tim Janik <timj@gimp.org>
* gtk/gtkstatusbar.h:
* gtk/gtkstatusbar.c: complete api change to honour message contexts.
unfortunaltely this also involved argument changes on the signal
emissions which will not be caught by the compiler. your callbacks
should look like:
void message_text_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text,
gpointer func_data);
* gtk/gtkwidget.c (gtk_widget_set_rc_style): eliminated bug about
initial signal emission.
(gtk_widget_set_parent): don't ensure style, just call
gtk_widget_set_style_recurse.
(gtk_widget_set_style_recurse): only change a widget's rc styles if
if there has already been a lookup.
* gtk/testgtk.c: adaptions for statusbar widget.
substituted notebook pixmaps with pixmaps from fvwm, since
we don't know where the originals came from.
* gtk/gtkobject.c (gtk_object_data_destroy): call the destroy
notifier with the objects data, not its internal structure.
* gtk/gtkspinbutton.c (gtk_spin_button_button_press): small
fix from lars.
Sun Mar 1 15:08:13 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* docs/*.texi changes from Greg Mclean.

View File

@ -1272,7 +1272,7 @@ gtk_object_data_destroy (GtkObjectData *odata)
g_return_if_fail (odata != NULL);
if (odata->destroy)
odata->destroy (odata);
odata->destroy (odata->data);
g_mem_chunk_free (object_data_mem_chunk, odata);
}

View File

@ -528,9 +528,6 @@ gtk_spin_button_button_press (GtkWidget *widget,
spin = GTK_SPIN_BUTTON (widget);
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
if (!spin->button)
{
if (event->window == spin->panel)

View File

@ -31,13 +31,16 @@ enum
};
typedef void (*SignalTextP) (GtkObject *object,
guint context_id,
const gchar *text,
gpointer func_data);
static void gtk_statusbar_class_init (GtkStatusbarClass *class);
static void gtk_statusbar_init (GtkStatusbar *statusbar);
static void gtk_statusbar_destroy (GtkObject *object);
static void gtk_statusbar_finalize (GtkObject *object);
static void gtk_statusbar_update (GtkStatusbar *statusbar,
guint context_id,
const gchar *text);
static GtkContainerClass *parent_class;
@ -76,7 +79,8 @@ gtk_statusbar_marshal_text_p (GtkObject *object,
SignalTextP sfunc = (SignalTextP) func;
(* sfunc) (object,
GTK_VALUE_STRING (args[0]),
GTK_VALUE_UINT (args[0]),
GTK_VALUE_STRING (args[1]),
func_data);
}
@ -99,7 +103,8 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
object_class->type,
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_pushed),
gtk_statusbar_marshal_text_p,
GTK_TYPE_NONE, 1,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
statusbar_signals[SIGNAL_TEXT_POPPED] =
gtk_signal_new ("text_popped",
@ -107,11 +112,13 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
object_class->type,
GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_popped),
gtk_statusbar_marshal_text_p,
GTK_TYPE_NONE, 1,
GTK_TYPE_NONE, 2,
GTK_TYPE_UINT,
GTK_TYPE_STRING);
gtk_object_class_add_signals (object_class, statusbar_signals, SIGNAL_LAST);
object_class->destroy = gtk_statusbar_destroy;
object_class->finalize = gtk_statusbar_finalize;
class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusBar messages mem chunk",
sizeof (GtkStatusbarMsg),
@ -142,8 +149,10 @@ gtk_statusbar_init (GtkStatusbar *statusbar)
gtk_container_add (GTK_CONTAINER (statusbar->frame), statusbar->label);
gtk_widget_show (statusbar->label);
statusbar->seq_status_id = 1;
statusbar->seq_context_id = 1;
statusbar->seq_message_id = 1;
statusbar->messages = NULL;
statusbar->keys = NULL;
}
GtkWidget*
@ -154,6 +163,7 @@ gtk_statusbar_new ()
static void
gtk_statusbar_update (GtkStatusbar *statusbar,
guint context_id,
const gchar *text)
{
g_return_if_fail (statusbar != NULL);
@ -165,8 +175,37 @@ gtk_statusbar_update (GtkStatusbar *statusbar,
gtk_label_set (GTK_LABEL (statusbar->label), text);
}
guint
gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
const gchar *context_description)
{
gchar *string;
guint *id;
g_return_val_if_fail (statusbar != NULL, 0);
g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
g_return_val_if_fail (context_description != NULL, 0);
/* we need to preserve namespaces on object datas */
string = g_strconcat ("gtk-status-bar-context:", context_description, NULL);
id = gtk_object_get_data (GTK_OBJECT (statusbar), string);
if (!id)
{
id = g_new (guint, 1);
*id = statusbar->seq_context_id++;
gtk_object_set_data_full (GTK_OBJECT (statusbar), string, id, (GtkDestroyNotify) g_free);
statusbar->keys = g_slist_prepend (statusbar->keys, string);
}
else
g_free (string);
return *id;
}
guint
gtk_statusbar_push (GtkStatusbar *statusbar,
guint context_id,
const gchar *text)
{
GtkStatusbarMsg *msg;
@ -175,65 +214,79 @@ gtk_statusbar_push (GtkStatusbar *statusbar,
g_return_val_if_fail (statusbar != NULL, 0);
g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (context_id > 0, 0);
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
msg = g_chunk_new (GtkStatusbarMsg, class->messages_mem_chunk);
msg->text = g_strdup (text);
msg->status_id = statusbar->seq_status_id++;
msg->context_id = context_id;
msg->message_id = statusbar->seq_message_id++;
statusbar->messages = g_list_prepend (statusbar->messages, msg);
statusbar->messages = g_slist_prepend (statusbar->messages, msg);
gtk_signal_emit (GTK_OBJECT (statusbar), statusbar_signals[SIGNAL_TEXT_PUSHED], msg->text);
gtk_signal_emit (GTK_OBJECT (statusbar),
statusbar_signals[SIGNAL_TEXT_PUSHED],
msg->context_id,
msg->text);
return msg->status_id;
return msg->message_id;
}
void
gtk_statusbar_pop (GtkStatusbar *statusbar)
gtk_statusbar_pop (GtkStatusbar *statusbar,
guint context_id)
{
GtkStatusbarMsg *msg;
g_return_if_fail (statusbar != NULL);
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
g_return_if_fail (context_id > 0);
if (statusbar->messages)
{
GList *list;
GSList *list;
GtkStatusbarClass *class;
list = statusbar->messages;
msg = list->data;
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
statusbar->messages = g_list_remove_link (statusbar->messages, list);
statusbar->messages = g_slist_remove_link (statusbar->messages, list);
g_free (msg->text);
g_mem_chunk_free (class->messages_mem_chunk, msg);
g_list_free_1 (list);
g_slist_free_1 (list);
}
msg = statusbar->messages ? statusbar->messages->data : NULL;
gtk_signal_emit (GTK_OBJECT (statusbar), statusbar_signals[SIGNAL_TEXT_POPPED],
gtk_signal_emit (GTK_OBJECT (statusbar),
statusbar_signals[SIGNAL_TEXT_POPPED],
(guint) (msg ? msg->context_id : 0),
msg ? msg->text : NULL);
}
void
gtk_statusbar_steal (GtkStatusbar *statusbar,
guint status_id)
gtk_statusbar_remove (GtkStatusbar *statusbar,
guint context_id,
guint message_id)
{
GtkStatusbarMsg *msg;
g_return_if_fail (statusbar != NULL);
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
g_return_if_fail (context_id > 0);
g_return_if_fail (message_id > 0);
msg = statusbar->messages ? statusbar->messages->data : NULL;
if (msg)
{
GList *list;
if (msg->status_id == status_id)
GSList *list;
/* care about signal emission if the topmost item is removed */
if (msg->context_id == context_id &&
msg->message_id == message_id)
{
gtk_statusbar_pop (statusbar);
gtk_statusbar_pop (statusbar, context_id);
return;
}
@ -241,15 +294,16 @@ gtk_statusbar_steal (GtkStatusbar *statusbar,
{
msg = list->data;
if (msg->status_id == status_id)
if (msg->context_id == context_id &&
msg->message_id == message_id)
{
GtkStatusbarClass *class;
class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
statusbar->messages = g_list_remove_link (statusbar->messages, list);
statusbar->messages = g_slist_remove_link (statusbar->messages, list);
g_free (msg->text);
g_mem_chunk_free (class->messages_mem_chunk, msg);
g_list_free_1 (list);
g_slist_free_1 (list);
break;
}
@ -262,7 +316,7 @@ gtk_statusbar_destroy (GtkObject *object)
{
GtkStatusbar *statusbar;
GtkStatusbarClass *class;
GList *list;
GSList *list;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_STATUSBAR (object));
@ -278,9 +332,28 @@ gtk_statusbar_destroy (GtkObject *object)
g_free (msg->text);
g_mem_chunk_free (class->messages_mem_chunk, msg);
}
g_list_free (statusbar->messages);
g_slist_free (statusbar->messages);
statusbar->messages = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_statusbar_finalize (GtkObject *object)
{
GtkStatusbar *statusbar;
GSList *list;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_STATUSBAR (object));
statusbar = GTK_STATUSBAR (object);
for (list = statusbar->keys; list; list = list->next)
g_free (list->data);
g_slist_free (statusbar->messages);
statusbar->keys = NULL;
printf("huhu\n");
GTK_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -41,9 +41,11 @@ struct _GtkStatusbar
GtkWidget *frame;
GtkWidget *label;
GList *messages;
GSList *messages;
GSList *keys;
guint seq_status_id;
guint seq_context_id;
guint seq_message_id;
};
struct _GtkStatusbarClass
@ -53,26 +55,33 @@ struct _GtkStatusbarClass
GMemChunk *messages_mem_chunk;
void (*text_pushed) (GtkStatusbar *statusbar,
guint context_id,
const gchar *text);
void (*text_popped) (GtkStatusbar *statusbar,
guint context_id,
const gchar *text);
};
struct _GtkStatusbarMsg
{
gchar *text;
guint status_id;
guint context_id;
guint message_id;
};
guint gtk_statusbar_get_type (void);
GtkWidget* gtk_statusbar_new (void);
/* Returns StatusID used for gtk_statusbar_push */
guint gtk_statusbar_push (GtkStatusbar *statusbar,
guint gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
const gchar *context_description);
/* Returns message_id used for gtk_statusbar_remove */
guint gtk_statusbar_push (GtkStatusbar *statusbar,
guint context_id,
const gchar *text);
void gtk_statusbar_pop (GtkStatusbar *statusbar);
void gtk_statusbar_steal (GtkStatusbar *statusbar,
guint status_id);
void gtk_statusbar_pop (GtkStatusbar *statusbar,
guint context_id);
void gtk_statusbar_remove (GtkStatusbar *statusbar,
guint context_id,
guint message_id);

View File

@ -125,7 +125,7 @@ typedef void (*GtkWidgetSignal6) (GtkObject *object,
GtkObject *arg1,
gpointer data);
typedef void (*GtkWidgetSignal7) (GtkObject *object,
gpointer *arg1,
gpointer arg1,
gpointer data);
typedef struct _GtkStateData GtkStateData;
@ -2326,15 +2326,7 @@ gtk_widget_set_parent (GtkWidget *widget,
while (parent->parent != NULL)
parent = parent->parent;
if (GTK_WIDGET_TOPLEVEL (parent))
{
gtk_widget_ensure_style (widget);
if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER (widget),
gtk_widget_set_style_recurse,
NULL);
}
gtk_widget_set_style_recurse (widget, NULL);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
}
@ -2413,9 +2405,8 @@ gtk_widget_set_rc_style (GtkWidget *widget)
}
else
{
g_assert (initial_emission == TRUE); /* FIXME: remove this line */
gtk_widget_set_style_internal (widget, widget->style, TRUE);
if (initial_emission)
gtk_widget_set_style_internal (widget, widget->style, TRUE);
}
}
}
@ -2508,7 +2499,7 @@ static void
gtk_widget_set_style_recurse (GtkWidget *widget,
gpointer client_data)
{
if (!GTK_WIDGET_USER_STYLE (widget))
if (GTK_WIDGET_RC_STYLE (widget))
gtk_widget_set_rc_style (widget);
if (GTK_IS_CONTAINER (widget))

View File

@ -800,31 +800,64 @@ statusbar_push (GtkWidget *button,
sprintf (text, "something %d", statusbar_counter++);
gtk_statusbar_push (statusbar, text);
gtk_statusbar_push (statusbar, 1, text);
}
static void
statusbar_pop (GtkWidget *button,
GtkStatusbar *statusbar)
{
gtk_statusbar_pop (statusbar);
gtk_statusbar_pop (statusbar, 1);
}
static void
statusbar_steal (GtkWidget *button,
GtkStatusbar *statusbar)
{
gtk_statusbar_steal (statusbar, 4);
gtk_statusbar_remove (statusbar, 1, 4);
}
static void
statusbar_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text)
{
if (!statusbar->messages)
statusbar_counter = 1;
}
static void
statusbar_contexts (GtkWidget *button,
GtkStatusbar *statusbar)
{
gchar *string;
string = "any context";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "idle messages";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "some text";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "hit the mouse";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "hit the mouse2";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
}
static void
statusbar_dump_stack (GtkWidget *button,
GtkStatusbar *statusbar)
@ -836,7 +869,10 @@ statusbar_dump_stack (GtkWidget *button,
GtkStatusbarMsg *msg;
msg = list->data;
g_print ("status_id: %d, status_text: \"%s\"\n", msg->status_id, msg->text);
g_print ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
msg->context_id,
msg->message_id,
msg->text);
}
}
@ -911,6 +947,13 @@ create_statusbar ()
"GtkObject::signal::clicked", statusbar_dump_stack, statusbar,
NULL);
button = gtk_widget_new (gtk_button_get_type (),
"GtkButton::label", "test contexts",
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box2,
"GtkObject::signal::clicked", statusbar_contexts, statusbar,
NULL);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
@ -2860,65 +2903,52 @@ GdkBitmap *book_open_mask;
GdkBitmap *book_closed_mask;
static char * book_open_xpm[] = {
"16 16 11 1",
" c None",
". c #28A22CB228A2",
"X c #FFFFFFFFFFFF",
"o c #F7DEF7DEF7DE",
"O c #000000000000",
"+ c #FFFF6DB60000",
"@ c #CF3CCF3CCF3C",
"# c #FFFFDB6C0000",
"$ c #30C234D330C2",
"% c #C71BC30BC71B",
"& c #D75C6DB60000",
"16 16 4 1",
" c None s None",
". c black",
"X c #808080",
"o c white",
" ",
" .. ",
" .X. ",
" .oO ... ",
" .+Xo. ..oX.. ",
" .+oXo..XXoX.@..",
" .+ooX.@ooXo.@#.",
" .+XXo.@XooX.@+.",
" .+XoX.@XoXo.@#.",
" .+oXo.@oXXX.@+.",
" .++Xo$@oOO..%#.",
" ..+&X.@.O@@@@+.",
" .++........#.",
" .+..+++++++&$",
" .+++.......$.",
" ... "};
" .Xo. ... ",
" .Xoo. ..oo. ",
" .Xooo.Xooo... ",
" .Xooo.oooo.X. ",
" .Xooo.Xooo.X. ",
" .Xooo.oooo.X. ",
" .Xooo.Xooo.X. ",
" .Xooo.oooo.X. ",
" .Xoo.Xoo..X. ",
" .Xo.o..ooX. ",
" .X..XXXXX. ",
" ..X....... ",
" .. ",
" "};
static char * book_closed_xpm[] = {
"16 16 12 1",
" c None",
". c #000000000000",
"X c #FFFF6DB60000",
"o c #082008200820",
"O c #AEBA00005144",
"+ c #FFFFDB6C0000",
"@ c #AEBA00000000",
"# c #D75CDB6C0000",
"$ c #28A22CB228A2",
"% c #FFFFFFFFFFFF",
"& c #F7DEF7DEF7DE",
"* c #30C234D330C2",
"16 16 6 1",
" c None s None",
". c black",
"X c red",
"o c yellow",
"O c #808080",
"# c white",
" ",
" .. ",
" ..XX. ",
" ..XXXXX. ",
" o.XXXXXXXX. ",
".O+XXXXXXXXX. ",
"o.@#XXXXXXXXX. ",
".X.O+XXXXXXXXXo ",
".XX.@+XXXXXXXX.$",
"oXXX.O+XXXXX..%$",
" .XXX.@+XX..&&&$",
" .XXX.O..&%&%.*",
" .XX$.&&%&.. ",
" .X$&%&.o ",
" .$%.. ",
" .o "};
" ..XXXXXXXX. ",
".ooXXXXXXXXX. ",
"..ooXXXXXXXXX. ",
".X.ooXXXXXXXXX. ",
".XX.ooXXXXXX.. ",
" .XX.ooXXX..#O ",
" .XX.oo..##OO. ",
" .XX..##OO.. ",
" .X.#OO.. ",
" ..O.. ",
" .. ",
" "};
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)

View File

@ -800,31 +800,64 @@ statusbar_push (GtkWidget *button,
sprintf (text, "something %d", statusbar_counter++);
gtk_statusbar_push (statusbar, text);
gtk_statusbar_push (statusbar, 1, text);
}
static void
statusbar_pop (GtkWidget *button,
GtkStatusbar *statusbar)
{
gtk_statusbar_pop (statusbar);
gtk_statusbar_pop (statusbar, 1);
}
static void
statusbar_steal (GtkWidget *button,
GtkStatusbar *statusbar)
{
gtk_statusbar_steal (statusbar, 4);
gtk_statusbar_remove (statusbar, 1, 4);
}
static void
statusbar_popped (GtkStatusbar *statusbar,
guint context_id,
const gchar *text)
{
if (!statusbar->messages)
statusbar_counter = 1;
}
static void
statusbar_contexts (GtkWidget *button,
GtkStatusbar *statusbar)
{
gchar *string;
string = "any context";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "idle messages";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "some text";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "hit the mouse";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
string = "hit the mouse2";
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
string,
gtk_statusbar_get_context_id (statusbar, string));
}
static void
statusbar_dump_stack (GtkWidget *button,
GtkStatusbar *statusbar)
@ -836,7 +869,10 @@ statusbar_dump_stack (GtkWidget *button,
GtkStatusbarMsg *msg;
msg = list->data;
g_print ("status_id: %d, status_text: \"%s\"\n", msg->status_id, msg->text);
g_print ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
msg->context_id,
msg->message_id,
msg->text);
}
}
@ -911,6 +947,13 @@ create_statusbar ()
"GtkObject::signal::clicked", statusbar_dump_stack, statusbar,
NULL);
button = gtk_widget_new (gtk_button_get_type (),
"GtkButton::label", "test contexts",
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box2,
"GtkObject::signal::clicked", statusbar_contexts, statusbar,
NULL);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
@ -2860,65 +2903,52 @@ GdkBitmap *book_open_mask;
GdkBitmap *book_closed_mask;
static char * book_open_xpm[] = {
"16 16 11 1",
" c None",
". c #28A22CB228A2",
"X c #FFFFFFFFFFFF",
"o c #F7DEF7DEF7DE",
"O c #000000000000",
"+ c #FFFF6DB60000",
"@ c #CF3CCF3CCF3C",
"# c #FFFFDB6C0000",
"$ c #30C234D330C2",
"% c #C71BC30BC71B",
"& c #D75C6DB60000",
"16 16 4 1",
" c None s None",
". c black",
"X c #808080",
"o c white",
" ",
" .. ",
" .X. ",
" .oO ... ",
" .+Xo. ..oX.. ",
" .+oXo..XXoX.@..",
" .+ooX.@ooXo.@#.",
" .+XXo.@XooX.@+.",
" .+XoX.@XoXo.@#.",
" .+oXo.@oXXX.@+.",
" .++Xo$@oOO..%#.",
" ..+&X.@.O@@@@+.",
" .++........#.",
" .+..+++++++&$",
" .+++.......$.",
" ... "};
" .Xo. ... ",
" .Xoo. ..oo. ",
" .Xooo.Xooo... ",
" .Xooo.oooo.X. ",
" .Xooo.Xooo.X. ",
" .Xooo.oooo.X. ",
" .Xooo.Xooo.X. ",
" .Xooo.oooo.X. ",
" .Xoo.Xoo..X. ",
" .Xo.o..ooX. ",
" .X..XXXXX. ",
" ..X....... ",
" .. ",
" "};
static char * book_closed_xpm[] = {
"16 16 12 1",
" c None",
". c #000000000000",
"X c #FFFF6DB60000",
"o c #082008200820",
"O c #AEBA00005144",
"+ c #FFFFDB6C0000",
"@ c #AEBA00000000",
"# c #D75CDB6C0000",
"$ c #28A22CB228A2",
"% c #FFFFFFFFFFFF",
"& c #F7DEF7DEF7DE",
"* c #30C234D330C2",
"16 16 6 1",
" c None s None",
". c black",
"X c red",
"o c yellow",
"O c #808080",
"# c white",
" ",
" .. ",
" ..XX. ",
" ..XXXXX. ",
" o.XXXXXXXX. ",
".O+XXXXXXXXX. ",
"o.@#XXXXXXXXX. ",
".X.O+XXXXXXXXXo ",
".XX.@+XXXXXXXX.$",
"oXXX.O+XXXXX..%$",
" .XXX.@+XX..&&&$",
" .XXX.O..&%&%.*",
" .XX$.&&%&.. ",
" .X$&%&.o ",
" .$%.. ",
" .o "};
" ..XXXXXXXX. ",
".ooXXXXXXXXX. ",
"..ooXXXXXXXXX. ",
".X.ooXXXXXXXXX. ",
".XX.ooXXXXXX.. ",
" .XX.ooXXX..#O ",
" .XX.oo..##OO. ",
" .XX..##OO.. ",
" .X.#OO.. ",
" ..O.. ",
" .. ",
" "};
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)