Re: Deprecated calls in libzvt
- From: Deepa <deepa chacko wipro com>
- To: jacob berkman <jacob ximian com>
- Cc: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Re: Deprecated calls in libzvt
- Date: Mon, 11 Feb 2002 20:38:23 +0530
Jacob,
> > * gdk_input_add() - This in turn calls gdk_input_add_full() which is also
> > deprecated. I was not able to find a replacement for this as yet.
>
> if you look at the implementation of gdk_input_add_full() you will see
> it calls g_io_add_watch_full() which is what you will want to use.
This is not a one-one replacement. In fact you need to rewrite the functionality of
gdk_input_add () into your code.
I have done these changes also. Attached is the updated patch.
Thanks
Deepa
--- libzvt/zvtterm.c Fri Feb 8 06:10:45 2002
+++ libzvt_new/zvtterm.c Mon Feb 11 10:26:26 2002
@@ -55,6 +55,10 @@
#include "zvt-accessible.h"
#include "zvt-accessible-factory.h"
+#define READ_CONDITION (G_IO_IN | G_IO_HUP | G_IO_ERR)
+#define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
+#define EXCEPTION_CONDITION (G_IO_PRI)
+
/* define to 'x' to enable copious debug output */
#define d(x)
@@ -67,7 +71,7 @@
static void zvt_term_init (ZvtTerm *term);
static void zvt_term_class_init (ZvtTermClass *class);
static void zvt_term_init (ZvtTerm *term);
-static void zvt_term_destroy (GtkObject *object);
+static void zvt_term_finalize (GObject *object);
static void zvt_term_realize (GtkWidget *widget);
static void zvt_term_unrealize (GtkWidget *widget);
static void zvt_term_map (GtkWidget *widget);
@@ -112,6 +116,16 @@
void vt_draw_text(void *user_data, struct vt_line *line, int row, int col, int len, int attr);
void vt_scroll_area(void *user_data, int firstrow, int count, int offset, int fill);
static void vt_selection_changed(void *user_data);
+static void zvt_io_destroy (gpointer data);
+static gboolean zvt_io_invoke (GIOChannel *source, GIOCondition condition, gpointer data);
+gint zvt_input_add (gint source, GdkInputCondition condition, GdkInputFunction function, gpointer data);
+
+typedef struct
+{
+ GdkInputFunction function;
+ GdkInputCondition condition;
+ gpointer data;
+} ZvtIOClosure;
/* static data */
@@ -152,6 +166,64 @@
/* GTK parent class */
static GtkWidgetClass *parent_class = NULL;
+static void
+zvt_io_destroy (gpointer data)
+{
+ ZvtIOClosure *closure = data;
+
+ g_free (closure);
+}
+
+static gboolean
+zvt_io_invoke (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ ZvtIOClosure *closure = data;
+ GdkInputCondition gdk_cond = 0;
+
+ if (condition & READ_CONDITION)
+ gdk_cond |= GDK_INPUT_READ;
+ if (condition & WRITE_CONDITION)
+ gdk_cond |= GDK_INPUT_WRITE;
+ if (condition & EXCEPTION_CONDITION)
+ gdk_cond |= GDK_INPUT_EXCEPTION;
+
+ if (closure->condition & gdk_cond)
+ closure->function (closure->data, g_io_channel_unix_get_fd (source), gdk_cond);
+
+ return TRUE;
+}
+
+gint
+zvt_input_add (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data)
+{
+ guint result;
+ ZvtIOClosure *closure = g_new (ZvtIOClosure, 1);
+ GIOChannel *channel;
+ GIOCondition cond = 0;
+
+ closure->function = function;
+ closure->condition = condition;
+ closure->data = data;
+
+ if (condition & GDK_INPUT_READ)
+ cond |= READ_CONDITION;
+ if (condition & GDK_INPUT_WRITE)
+ cond |= WRITE_CONDITION;
+ if (condition & GDK_INPUT_EXCEPTION)
+ cond |= EXCEPTION_CONDITION;
+
+ channel = g_io_channel_unix_new (source);
+ result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
+ zvt_io_invoke, closure, zvt_io_destroy);
+ g_io_channel_unref (channel);
+
+ return result;
+}
guint
zvt_term_get_type (void)
@@ -159,18 +231,23 @@
static guint term_type = 0;
if (!term_type) {
- GtkTypeInfo term_info = {
- "ZvtTerm",
- sizeof (ZvtTerm),
+ GTypeInfo term_info = {
sizeof (ZvtTermClass),
- (GtkClassInitFunc) zvt_term_class_init,
- (GtkObjectInitFunc) zvt_term_init,
- NULL,
+ (GBaseInitFunc)0,
+ (GBaseFinalizeFunc)0,
+ (GClassInitFunc) zvt_term_class_init,
+ (GClassFinalizeFunc)0,
NULL,
+ sizeof (ZvtTerm),
+ 0,
+ (GInstanceInitFunc) zvt_term_init,
NULL
};
- term_type = gtk_type_unique (gtk_widget_get_type (), &term_info);
+ term_type = g_type_register_static (gtk_widget_get_type (),
+ "ZvtTerm",
+ &term_info,
+ 0);
}
return term_type;
@@ -180,85 +257,93 @@
static void
zvt_term_class_init (ZvtTermClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
ZvtTermClass *term_class;
GtkBindingSet *binding_set;
- object_class = (GtkObjectClass*) class;
+ object_class = (GObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
term_class = (ZvtTermClass*) class;
parent_class = gtk_type_class (gtk_widget_get_type ());
term_signals[CHILD_DIED] =
- gtk_signal_new ("child_died",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, child_died),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("child_died",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ZvtTermClass, child_died),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
term_signals[TITLE_CHANGED] =
- gtk_signal_new ("title_changed",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, title_changed),
- /*
- gnome_marshal_VOID__INT_POINTER,
- */
- zvt_marshal_VOID__INT_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER);
+ g_signal_new ("title_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ZvtTermClass, title_changed),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__INT_POINTER,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ G_TYPE_POINTER);
term_signals[GOT_OUTPUT] =
- gtk_signal_new ("got_output",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, got_output),
- /*
- gnome_marshal_VOID__POINTER_INT,
- */
- gtk_marshal_VOID__POINTER_INT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT);
+ g_signal_new ("got_output",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ZvtTermClass, got_output),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__POINTER_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER,
+ G_TYPE_INT);
term_signals[COPY_CLIPBOARD] =
- gtk_signal_new ("copy_clipboard",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, copy_clipboard),
- gtk_marshal_VOID__VOID,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("copy_clipboard",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ZvtTermClass, copy_clipboard),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
term_signals[PASTE_CLIPBOARD] =
- gtk_signal_new ("paste_clipboard",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, paste_clipboard),
- gtk_marshal_VOID__VOID,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("paste_clipboard",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ZvtTermClass, paste_clipboard),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
term_signals[SCROLL] =
- gtk_signal_new ("scroll",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass,scroll),
- gtk_marshal_VOID__INT,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_INT);
+ g_signal_new ("scroll",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ZvtTermClass,scroll),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
term_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ZvtTermClass, selection_changed),
- gtk_marshal_VOID__VOID,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("selection_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ZvtTermClass, selection_changed),
+ NULL,
+ NULL,
+ zvt_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
- object_class->destroy = zvt_term_destroy;
+ object_class->finalize = zvt_term_finalize;
widget_class->realize = zvt_term_realize;
widget_class->unrealize = zvt_term_unrealize;
@@ -391,7 +476,7 @@
zp->queue_green = 0;
zp->queue_blue = 0;
- gtk_object_set_data(GTK_OBJECT (term), "_zvtprivate", zp);
+ g_object_set_data(G_OBJECT (term), "_zvtprivate", zp);
/* charwidth, charheight set here */
zvt_term_set_font_name (term, DEFAULT_FONT);
@@ -399,13 +484,13 @@
/* scrollback position adjustment */
term->adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1.0, 1.0, 1.0, 1.0));
- gtk_object_ref (GTK_OBJECT (term->adjustment));
+ g_object_ref (G_OBJECT (term->adjustment));
gtk_object_sink (GTK_OBJECT (term->adjustment));
- gtk_signal_connect (
- GTK_OBJECT (term->adjustment),
+ g_signal_connect (
+ G_OBJECT (term->adjustment),
"value_changed",
- GTK_SIGNAL_FUNC (zvt_term_scrollbar_moved),
+ G_CALLBACK (zvt_term_scrollbar_moved),
term);
/* selection received */
@@ -584,7 +669,7 @@
zvt_term_new_with_size (int cols, int rows)
{
ZvtTerm *term;
- term = gtk_type_new (zvt_term_get_type ());
+ term = g_object_new (ZVT_TYPE_TERM, NULL);
/* fudge the pixel size, not (really) used anyway */
vt_resize (&term->vx->vt, cols, rows, cols*8, rows*8);
@@ -610,12 +695,12 @@
zvt_term_new (void)
{
ZvtTerm *term;
- term = gtk_type_new (zvt_term_get_type ());
+ term = g_object_new (ZVT_TYPE_TERM, NULL);
return GTK_WIDGET (term);
}
static void
-zvt_term_destroy (GtkObject *object)
+zvt_term_finalize (GObject *object)
{
ZvtTerm *term;
struct _zvtprivate *zp;
@@ -650,8 +735,9 @@
/* release the adjustment */
if (term->adjustment) {
- gtk_signal_disconnect_by_data (GTK_OBJECT (term->adjustment), term);
- gtk_object_unref (GTK_OBJECT (term->adjustment));
+ g_signal_handlers_disconnect_matched (term->adjustment, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, term);
+ g_object_unref (term->adjustment);
term->adjustment = NULL;
}
@@ -668,11 +754,11 @@
if (zp->text_expand)
g_free(zp->text_expand);
if (zp->bold_save)
- gdk_pixmap_unref(zp->bold_save);
+ g_object_unref(zp->bold_save);
if (zp->paste)
g_free(zp->paste);
if (zp->paste_id != -1)
- gdk_input_remove(zp->paste_id);
+ g_source_remove(zp->paste_id);
if (zp->queue_red)
g_free(zp->queue_red);
@@ -682,11 +768,11 @@
g_free(zp->queue_blue);
g_free(zp);
- gtk_object_set_data (GTK_OBJECT (term), "_zvtprivate", 0);
+ g_object_set_data (G_OBJECT (term), "_zvtprivate", 0);
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/**
@@ -908,7 +994,7 @@
&widget->style->bg[GTK_STATE_ACTIVE],
0, 0);
gdk_window_set_cursor(widget->window, term->cursor_bar);
- gdk_pixmap_unref (cursor_dot_pm);
+ g_object_unref (cursor_dot_pm);
zp->cursor_hand = gdk_cursor_new(GDK_HAND2);
term->cursor_current = term->cursor_bar;
@@ -980,13 +1066,13 @@
zp = _ZVT_PRIVATE(term);
/* free resources */
- gdk_cursor_destroy (term->cursor_bar);
+ gdk_cursor_unref (term->cursor_bar);
term->cursor_bar = NULL;
- gdk_cursor_destroy (term->cursor_dot);
+ gdk_cursor_unref (term->cursor_dot);
term->cursor_dot = NULL;
- gdk_cursor_destroy (zp->cursor_hand);
+ gdk_cursor_unref (zp->cursor_hand);
zp->cursor_hand = NULL;
term->cursor_current = NULL;
@@ -996,16 +1082,16 @@
gdk_color_context_free (term->color_ctx);
term->color_ctx = NULL;
*/
- gdk_colormap_unref(term->color_map);
+ g_object_unref(term->color_map);
- gdk_gc_destroy (term->scroll_gc);
+ g_object_unref (term->scroll_gc);
term->scroll_gc = NULL;
- gdk_gc_destroy (term->back_gc);
+ g_object_unref (term->back_gc);
term->back_gc = NULL;
- gdk_gc_destroy (term->fore_gc);
+ g_object_unref (term->fore_gc);
term->fore_gc = NULL;
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
@@ -1248,10 +1334,11 @@
term->in_expose = 0;
if (term->shadow_type != GTK_SHADOW_NONE)
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, term->shadow_type, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
+ gtk_paint_shadow (widget->style, widget->window,
+ GTK_STATE_NORMAL, term->shadow_type,
+ NULL, widget, NULL, 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
}
return FALSE;
@@ -1377,7 +1464,7 @@
int depth;
if (zp->bold_save)
- gdk_pixmap_unref(zp->bold_save);
+ g_object_unref(zp->bold_save);
gdk_window_get_geometry(GTK_WIDGET(term)->window,NULL,NULL,NULL,NULL,&depth);
zp->bold_save = gdk_pixmap_new(GTK_WIDGET(term)->window,
@@ -1464,11 +1551,11 @@
}
if (rest) {
- g_string_sprintf (outname, "%s-medium-r%s", newname->str, rest);
+ g_string_printf (outname, "%s-medium-r%s", newname->str, rest);
font = gdk_font_load (outname->str);
d( printf("loading normal font %s\n", outname->str) );
- g_string_sprintf (outname, "%s-bold-r%s", newname->str, rest);
+ g_string_printf (outname, "%s-bold-r%s", newname->str, rest);
font_bold = gdk_font_load (outname->str);
d( printf("loading bold font %s\n", outname->str) );
@@ -1503,7 +1590,7 @@
GTK_ADJUSTMENT(term->adjustment)->page_size =
term->vx->vt.height - 1;
- gtk_signal_emit_by_name (GTK_OBJECT (term->adjustment), "changed");
+ g_signal_emit_by_name (term->adjustment, "changed");
}
static void
@@ -1643,7 +1730,7 @@
/* 'block' input while we're selecting text */
if (term->input_id!=-1) {
- gdk_input_remove(term->input_id);
+ g_source_remove(term->input_id);
term->input_id=-1;
}
break;
@@ -1695,7 +1782,7 @@
NULL, NULL, 0);
/* 'block' input while we're selecting text */
if (term->input_id!=-1) {
- gdk_input_remove(term->input_id);
+ g_source_remove(term->input_id);
term->input_id=-1;
}
}
@@ -1773,7 +1860,7 @@
/* re-enable input */
if (term->input_id==-1 && term->vx->vt.childfd !=-1) {
term->input_id =
- gdk_input_add(term->vx->vt.childfd, GDK_INPUT_READ, zvt_term_readdata, term);
+ zvt_input_add(term->vx->vt.childfd, GDK_INPUT_READ, zvt_term_readdata, term);
}
if (vx->selectiontype & VT_SELTYPE_MOVED) {
@@ -2104,7 +2191,7 @@
zp->paste_len = len-length;
memcpy(zp->paste, data+length, len-length);
zp->paste_id =
- gdk_input_add(term->vx->vt.keyfd, GDK_INPUT_WRITE, zvt_term_writemore, term);
+ zvt_input_add(term->vx->vt.keyfd, GDK_INPUT_WRITE, zvt_term_writemore, term);
} else {
/* could also drop off offset, but its rarely likely to happen? */
zp->paste = g_realloc(zp->paste, zp->paste_len + len - length);
@@ -2133,7 +2220,7 @@
}
g_free(zp->paste);
zp->paste = 0;
- gdk_input_remove(zp->paste_id);
+ g_source_remove(zp->paste_id);
zp->paste_id = -1;
} else {
zp->paste_offset += length;
@@ -2256,9 +2343,9 @@
pid = vt_forkpty (&term->vx->vt, do_uwtmp_log);
if (pid > 0) {
term->input_id =
- gdk_input_add(term->vx->vt.childfd, GDK_INPUT_READ, zvt_term_readdata, term);
+ zvt_input_add(term->vx->vt.childfd, GDK_INPUT_READ, zvt_term_readdata, term);
term->msg_id =
- gdk_input_add(term->vx->vt.msgfd, GDK_INPUT_READ, zvt_term_readmsg, term);
+ zvt_input_add(term->vx->vt.msgfd, GDK_INPUT_READ, zvt_term_readmsg, term);
}
return pid;
@@ -2303,12 +2390,12 @@
g_return_val_if_fail (ZVT_IS_TERM (term), -1);
if (term->input_id != -1) {
- gdk_input_remove (term->input_id);
+ g_source_remove (term->input_id);
term->input_id = -1;
}
if (term->msg_id != -1) {
- gdk_input_remove (term->msg_id);
+ g_source_remove (term->msg_id);
term->msg_id = -1;
}
@@ -2733,7 +2820,7 @@
g_return_if_fail (term != NULL);
g_return_if_fail (ZVT_IS_TERM (term));
- gtk_signal_emit(GTK_OBJECT(term), term_signals[TITLE_CHANGED], type, str);
+ g_signal_emit(term, term_signals[TITLE_CHANGED], 0, type, str);
}
/* emit the got_output signal */
@@ -2743,7 +2830,7 @@
g_return_if_fail (term != NULL);
g_return_if_fail (ZVT_IS_TERM (term));
- gtk_signal_emit(GTK_OBJECT(term), term_signals[GOT_OUTPUT],
+ g_signal_emit(term, term_signals[GOT_OUTPUT], 0,
buffer, count);
}
@@ -2796,8 +2883,8 @@
saveerrno = errno;
vt_parse_vt (&vx->vt, buffer, count);
- if (gtk_signal_handler_pending(GTK_OBJECT(term),
- term_signals[GOT_OUTPUT], TRUE))
+ if (g_signal_has_handler_pending(G_OBJECT(term),
+ term_signals[GOT_OUTPUT], 0, TRUE))
zvt_term_got_output(term, buffer, count);
}
@@ -2889,14 +2976,14 @@
* it doesn't seem worth the trouble <shrug>
*/
if (term->input_id != -1) {
- gdk_input_remove (term->input_id);
+ g_source_remove (term->input_id);
term->input_id=-1;
}
zvt_term_closepty (term);
/* signal application FIXME: include error/non error code */
- gtk_signal_emit (GTK_OBJECT(term), term_signals[CHILD_DIED]);
+ g_signal_emit (term, term_signals[CHILD_DIED], 0);
}
/**
@@ -2934,7 +3021,7 @@
zvt_term_background_set_pixmap_file(b, pixmap_file);
} else if (transparent) {
b = zvt_term_background_new(terminal);
- zvt_term_background_set_pixmap_atom(b, GDK_ROOT_PARENT(),
+ zvt_term_background_set_pixmap_atom(b, gdk_get_default_root_window(),
gdk_atom_intern("_XROOTPMAP_ID", TRUE));
zvt_term_background_set_translate(b, ZVT_BGTRANSLATE_ROOT, 0, 0);
}
@@ -3056,7 +3143,7 @@
f = term->font;
overstrike = 1;
if (zp && zp->bold_save) {
- gdk_draw_pixmap(zp->bold_save, term->fore_gc, GTK_WIDGET(term)->window,
+ gdk_draw_drawable(zp->bold_save, term->fore_gc, GTK_WIDGET(term)->window,
x + offx + len*term->charwidth, offy + row*term->charheight,
0, 0, 1, term->charheight);
}
@@ -3266,7 +3353,7 @@
}
if (overstrike && zp && zp->bold_save) {
- gdk_draw_pixmap(GTK_WIDGET(term)->window,
+ gdk_draw_drawable(GTK_WIDGET(term)->window,
term->fore_gc,
zp->bold_save,
0, 0,
@@ -3309,7 +3396,7 @@
offy = widget->style->ythickness;
/* "scroll" area */
- gdk_draw_pixmap(widget->window,
+ gdk_draw_drawable(widget->window,
term->scroll_gc, /* must use this to generate expose events */
widget->window,
offx, offy+(firstrow+offset)*term->charheight,
@@ -3377,7 +3464,7 @@
static void
vt_selection_changed (void *user_data)
{
- gtk_signal_emit_by_name (GTK_OBJECT (user_data), "selection_changed");
+ g_signal_emit_by_name (user_data, "selection_changed");
}
--- libzvt/zterm.c Tue Aug 14 22:19:38 2001
+++ libzvt_new/zterm.c Mon Feb 11 10:20:03 2002
@@ -52,7 +52,7 @@
static void
child_died_event (ZvtTerm *term)
{
- gtk_exit(0);
+ exit(0);
}
static void
@@ -79,7 +79,7 @@
str = zvt_term_match_check(term, x/term->charwidth, y/term->charheight,(void *)&data);
if (str) {
- gtk_signal_emit_stop_by_name (GTK_OBJECT (term), "button_press_event");
+ g_signal_stop_emission_by_name (term, "button_press_event");
printf("User clicked on type '%s' -> '%s'\n", data, str);
return TRUE;
}
@@ -216,34 +216,34 @@
zvt_term_match_add (ZVT_TERM (term), "file://[^ ]*[^\\.]", VTATTR_REVERSE, "file");
zvt_term_match_add (ZVT_TERM (term), "[0-9\\.]*", VTATTR_BOLD, "ip #");
- gtk_signal_connect (
- GTK_OBJECT (term),
+ g_signal_connect (
+ G_OBJECT (term),
"button_press_event",
- GTK_SIGNAL_FUNC (button_press_event),
+ G_CALLBACK (button_press_event),
NULL);
- gtk_signal_connect (
- GTK_OBJECT (term),
+ g_signal_connect (
+ G_OBJECT (term),
"child_died",
- GTK_SIGNAL_FUNC (child_died_event),
+ G_CALLBACK (child_died_event),
NULL);
- gtk_signal_connect (
- GTK_OBJECT (term),
+ g_signal_connect (
+ G_OBJECT (term),
"destroy",
- GTK_SIGNAL_FUNC (child_died_event),
+ G_CALLBACK (child_died_event),
NULL);
- gtk_signal_connect (
- GTK_OBJECT (term),
+ g_signal_connect (
+ G_OBJECT (term),
"title_changed",
- GTK_SIGNAL_FUNC (title_changed_event),
+ G_CALLBACK (title_changed_event),
NULL);
- gtk_signal_connect_after (
- GTK_OBJECT (term),
+ g_signal_connect_after (
+ G_OBJECT (term),
"realize",
- GTK_SIGNAL_FUNC (set_hints),
+ G_CALLBACK (set_hints),
term);
gtk_widget_show (term);
@@ -311,8 +311,7 @@
/* main loop */
gtk_main ();
- gtk_exit(0);
- return 0;
+ exit(0);
}
--- libzvt/background.c Mon Jan 14 17:24:03 2002
+++ libzvt_new/background.c Mon Feb 11 10:20:03 2002
@@ -89,15 +89,15 @@
pp = pixmap_from_atom(win, pmap);
if (pp) {
- gdk_window_get_size(pp, &pwidth, &pheight);
+ gdk_drawable_get_size(pp, &pwidth, &pheight);
pb = gdk_pixbuf_get_from_drawable(NULL,
pp,
- gdk_window_get_colormap(win),
+ gdk_drawable_get_colormap(win),
0, 0, 0, 0,
pwidth, pheight);
/* Theoretically this should not destroy the pixmap on X, otherwise
* we'll need another hack like pixmap_free_atom */
- gdk_pixmap_unref(pp);
+ g_object_unref(pp);
return pb;
}
return NULL;
@@ -195,7 +195,7 @@
}
w = g_malloc0(sizeof(*w));
vt_list_new(&w->watchlist);
- gdk_window_ref(win);
+ g_object_ref(win);
w->win = win;
w->propmask = gdk_window_get_events(win);
gdk_window_add_filter(win, zvt_filter_prop_change, w);
@@ -234,7 +234,7 @@
if (vt_list_empty(&w->watchlist)) {
gdk_window_set_events(w->win, w->propmask);
gdk_window_remove_filter(w->win, zvt_filter_prop_change, w);
- gdk_window_unref(w->win);
+ g_object_unref(w->win);
vt_list_remove((struct vt_listnode *)w);
g_free(w);
}
@@ -249,17 +249,17 @@
struct _zvtprivate *zp = _ZVT_PRIVATE(term);
zp->background_watchsig =
- gtk_signal_connect(GTK_OBJECT (gtk_widget_get_toplevel(GTK_WIDGET(term))),
- "configure_event",
- GTK_SIGNAL_FUNC(zvt_configure_window),
- GTK_OBJECT(term));
+ g_signal_connect(G_OBJECT (gtk_widget_get_toplevel(GTK_WIDGET(term))),
+ "configure_event",
+ G_CALLBACK(zvt_configure_window),
+ G_OBJECT(term));
}
static void
zvt_unwatch_move(ZvtTerm *term)
{
struct _zvtprivate *zp = _ZVT_PRIVATE(term);
- gtk_signal_disconnect(GTK_OBJECT (gtk_widget_get_toplevel(GTK_WIDGET(term))), zp->background_watchsig);
+ g_signal_handler_disconnect(G_OBJECT (gtk_widget_get_toplevel(GTK_WIDGET(term))), zp->background_watchsig);
}
/*
@@ -334,27 +334,27 @@
case ZVT_BGTYPE_NONE: /* no background */
break;
case ZVT_BGTYPE_ATOM: /* pixmap id contained in atom */
- gdk_window_unref(b->data.atom.window);
+ g_object_unref(b->data.atom.window);
break;
case ZVT_BGTYPE_PIXMAP: /* normal pixmap */
if (b->data.pixmap.pixmap)
- gdk_pixmap_unref(b->data.pixmap.pixmap);
+ g_object_unref(b->data.pixmap.pixmap);
if (b->data.pixmap.cmap)
- gdk_colormap_unref(b->data.pixmap.cmap);
+ g_object_unref(b->data.pixmap.cmap);
break;
case ZVT_BGTYPE_FILE: /* file */
g_free(b->data.pixmap_file);
break;
case ZVT_BGTYPE_PIXBUF: /* pixbuf */
- gdk_pixbuf_unref(b->data.pixbuf);
+ g_object_unref(b->data.pixbuf);
break;
}
b->data.pixmap.pixmap = p;
if (p)
- gdk_pixmap_ref(p);
+ g_object_ref(p);
b->data.pixmap.cmap = cmap;
if (cmap)
- gdk_colormap_ref(cmap);
+ g_object_ref(cmap);
b->type = ZVT_BGTYPE_PIXMAP;
}
@@ -373,7 +373,7 @@
{
zvt_term_background_set_pixmap(b, 0, 0);
b->data.atom.atom = atom;
- gdk_window_ref(win);
+ g_object_ref(win);
b->data.atom.window = win;
b->type = ZVT_BGTYPE_ATOM;
}
@@ -405,7 +405,7 @@
zvt_term_background_set_pixbuf(struct zvt_background *b, GdkPixbuf *pb)
{
zvt_term_background_set_pixmap(b, 0, 0);
- gdk_pixbuf_ref(pb);
+ g_object_ref(pb);
b->data.pixbuf = pb;
b->type = ZVT_BGTYPE_PIXBUF;
}
@@ -675,7 +675,7 @@
int width, height;
if (pixbuf==NULL && pixmap!=NULL) {
int pwidth, pheight;
- gdk_window_get_size(pixmap, &pwidth, &pheight);
+ gdk_drawable_get_size(pixmap, &pwidth, &pheight);
pixbuf = gdk_pixbuf_get_from_drawable(0, pixmap, cmap, 0, 0, 0, 0, pwidth, pheight);
/* free the pixmap? */
}
@@ -707,7 +707,7 @@
if (b->scale.type != ZVT_BGSCALE_NONE) {
GdkPixbuf *tmp = gdk_pixbuf_scale_simple(pixbuf, width, height,
GDK_INTERP_NEAREST);
- gdk_pixbuf_unref(pixbuf);
+ g_object_unref(pixbuf);
pixbuf = tmp;
}
}
@@ -716,12 +716,6 @@
/* if we have a pixbuf, then we need to convert it to a pixmap to actually
use it ... */
if (pixbuf!=NULL) {
- static int init=0;
-
- if (!init) {
- gdk_rgb_init();
- init=1;
- }
pixmap = gdk_pixmap_new(GTK_WIDGET(term)->window,
gdk_pixbuf_get_width(pixbuf),
@@ -734,7 +728,7 @@
GDK_RGB_DITHER_MAX,
0, 0);
/* free working area */
- gdk_pixbuf_unref(pixbuf);
+ g_object_unref(pixbuf);
}
zp->background_pixmap = pixmap;
@@ -797,7 +791,7 @@
0, 0,
&x, &y,
&childret);
- gdk_window_get_size(GTK_WIDGET(term)->window, &width, &height);
+ gdk_drawable_get_size(GTK_WIDGET(term)->window, &width, &height);
d(printf("configure event, pos %d,%d size %d-%d\n", x, y, width, height));
d(printf("last was at %d,%d %d-%d\n", b->pos.x, b->pos.y, b->pos.w, b->pos.h));
--- libzvt/libzvt.h Mon Jan 21 02:04:12 2002
+++ libzvt_new/libzvt.h Mon Feb 11 10:20:03 2002
@@ -203,7 +203,7 @@
};
/* *** DO NOT USE THIS IN APPS! *** */
-#define _ZVT_PRIVATE(term) ((struct _zvtprivate *)gtk_object_get_data (GTK_OBJECT (term), "_zvtprivate"))
+#define _ZVT_PRIVATE(term) ((struct _zvtprivate *)g_object_get_data (G_OBJECT (term), "_zvtprivate"))
/* options for fork */
#define ZVT_TERM_DO_UTMP_LOG 1
--- libzvt/zvt-marshal.list Mon Jan 21 02:04:12 2002
+++ libzvt_new/zvt-marshal.list Mon Feb 11 10:20:03 2002
@@ -1 +1,4 @@
VOID:INT,POINTER
+VOID:POINTER,INT
+VOID:VOID
+VOID:INT
**************************Disclaimer************************************
Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.
********************************************************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]