Lots of GObject work.
2002-11-16 Chris Toshok <toshok@ximian.com> * gal/e-text/e-completion-test.c: Lots of GObject work. * gal/e-text/e-completion-view.[ch]: same. * gal/e-text/e-completion.[ch]: same. * gal/e-text/e-entry.[ch]: same. * gal/e-text/e-table-text-model.[ch]: same. * gal/e-text/e-text-model-uri.[ch]: same. * gal/e-text/e-text-model.[ch]: same. * gal/e-text/e-text-test.c: same. * gal/e-text/e-text.[ch]: same. svn path=/trunk/; revision=18800
This commit is contained in:
committed by
Chris Toshok
parent
09e8fe2317
commit
d8e4ebebc3
@ -188,28 +188,28 @@ main (int argc, gchar **argv)
|
||||
read_dict ();
|
||||
|
||||
complete = e_completion_new ();
|
||||
gtk_signal_connect (GTK_OBJECT (complete),
|
||||
"request_completion",
|
||||
GTK_SIGNAL_FUNC (request_dict_search),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (complete),
|
||||
"end_completion",
|
||||
GTK_SIGNAL_FUNC (end_dict_search),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (complete),
|
||||
"cancel_completion",
|
||||
GTK_SIGNAL_FUNC (end_dict_search),
|
||||
NULL);
|
||||
g_signal_connect (complete,
|
||||
"request_completion",
|
||||
G_CALLBACK (request_dict_search),
|
||||
NULL);
|
||||
g_signal_connect (complete,
|
||||
"end_completion",
|
||||
G_CALLBACK (end_dict_search),
|
||||
NULL);
|
||||
g_signal_connect (complete,
|
||||
"cancel_completion",
|
||||
G_CALLBACK (end_dict_search),
|
||||
NULL);
|
||||
|
||||
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
entry = e_entry_new ();
|
||||
e_entry_enable_completion_full (E_ENTRY (entry), complete, 0, NULL);
|
||||
e_entry_set_editable (E_ENTRY (entry), TRUE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (entry),
|
||||
"popup",
|
||||
GTK_SIGNAL_FUNC (popup_cb),
|
||||
NULL);
|
||||
g_signal_connect (entry,
|
||||
"popup",
|
||||
G_CALLBACK (popup_cb),
|
||||
NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (win), entry);
|
||||
gtk_widget_show_all (win);
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include <gal/e-table/e-table-simple.h>
|
||||
#include <gal/e-table/e-table-scrolled.h>
|
||||
#include <gal/util/e-i18n.h>
|
||||
#include "gal/util/e-marshal.h"
|
||||
|
||||
enum {
|
||||
E_COMPLETION_VIEW_NONEMPTY,
|
||||
@ -54,8 +55,9 @@ static gint e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *k
|
||||
|
||||
static void e_completion_view_class_init (ECompletionViewClass *klass);
|
||||
static void e_completion_view_init (ECompletionView *completion);
|
||||
static void e_completion_view_destroy (GtkObject *object);
|
||||
static void e_completion_view_dispose (GObject *object);
|
||||
|
||||
#define PARENT_TYPE GTK_TYPE_EVENT_BOX
|
||||
static GtkObjectClass *parent_class;
|
||||
|
||||
|
||||
@ -193,89 +195,78 @@ e_completion_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
|
||||
}
|
||||
}
|
||||
|
||||
GtkType
|
||||
e_completion_view_get_type (void)
|
||||
{
|
||||
static GtkType completion_view_type = 0;
|
||||
|
||||
if (!completion_view_type) {
|
||||
GtkTypeInfo completion_view_info = {
|
||||
"ECompletionView",
|
||||
sizeof (ECompletionView),
|
||||
sizeof (ECompletionViewClass),
|
||||
(GtkClassInitFunc) e_completion_view_class_init,
|
||||
(GtkObjectInitFunc) e_completion_view_init,
|
||||
NULL, NULL, /* reserved */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
completion_view_type = gtk_type_unique (gtk_event_box_get_type (), &completion_view_info);
|
||||
}
|
||||
|
||||
return completion_view_type;
|
||||
}
|
||||
|
||||
E_MAKE_TYPE (e_completion_view,
|
||||
"ECompletionView",
|
||||
ECompletionView,
|
||||
e_completion_view_class_init,
|
||||
e_completion_view_init,
|
||||
PARENT_TYPE)
|
||||
|
||||
static void
|
||||
e_completion_view_class_init (ECompletionViewClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class = (GtkObjectClass *) klass;
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
|
||||
parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] =
|
||||
gtk_signal_new ("nonempty",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, nonempty),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("nonempty",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, nonempty),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_ADDED] =
|
||||
gtk_signal_new ("added",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, added),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("added",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, added),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_FULL] =
|
||||
gtk_signal_new ("full",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, full),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("full",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, full),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_BROWSE] =
|
||||
gtk_signal_new ("browse",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, browse),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
g_signal_new ("browse",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, browse),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] =
|
||||
gtk_signal_new ("unbrowse",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, unbrowse),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("unbrowse",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, unbrowse),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE] =
|
||||
gtk_signal_new ("activate",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionViewClass, activate),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
g_signal_new ("activate",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionViewClass, activate),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_view_signals, E_COMPLETION_VIEW_LAST_SIGNAL);
|
||||
|
||||
object_class->destroy = e_completion_view_destroy;
|
||||
object_class->dispose = e_completion_view_dispose;
|
||||
|
||||
widget_class->key_press_event = e_completion_view_local_key_press_handler;
|
||||
widget_class->expose_event = e_completion_view_expose_event;
|
||||
@ -291,7 +282,7 @@ e_completion_view_init (ECompletionView *completion)
|
||||
}
|
||||
|
||||
static void
|
||||
e_completion_view_destroy (GtkObject *object)
|
||||
e_completion_view_dispose (GObject *object)
|
||||
{
|
||||
ECompletionView *cv = E_COMPLETION_VIEW (object);
|
||||
|
||||
@ -305,17 +296,17 @@ e_completion_view_destroy (GtkObject *object)
|
||||
}
|
||||
|
||||
if (cv->key_widget) {
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
|
||||
gtk_object_unref (GTK_OBJECT (cv->key_widget));
|
||||
g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
|
||||
g_object_unref (cv->key_widget);
|
||||
cv->key_widget = NULL;
|
||||
}
|
||||
|
||||
if (cv->completion)
|
||||
gtk_object_unref (GTK_OBJECT (cv->completion));
|
||||
g_object_unref (cv->completion);
|
||||
cv->completion = NULL;
|
||||
|
||||
if (parent_class->destroy)
|
||||
(parent_class->destroy) (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
(G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -325,19 +316,19 @@ e_completion_view_disconnect (ECompletionView *cv)
|
||||
g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
|
||||
|
||||
if (cv->begin_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->begin_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->begin_signal_id);
|
||||
if (cv->comp_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->comp_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->comp_signal_id);
|
||||
if (cv->restart_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->restart_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->restart_signal_id);
|
||||
if (cv->cancel_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->cancel_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->cancel_signal_id);
|
||||
if (cv->end_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->end_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->end_signal_id);
|
||||
if (cv->clear_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->clear_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->clear_signal_id);
|
||||
if (cv->lost_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->lost_signal_id);
|
||||
g_signal_handler_disconnect (cv->completion, cv->lost_signal_id);
|
||||
|
||||
cv->begin_signal_id = 0;
|
||||
cv->comp_signal_id = 0;
|
||||
@ -450,7 +441,7 @@ e_completion_view_select (ECompletionView *cv, gint r)
|
||||
|
||||
cv->selection = r;
|
||||
e_completion_view_set_cursor_row (cv, r);
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], match);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], 0, match);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -474,14 +465,14 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
|
||||
|
||||
/* Start up a completion.*/
|
||||
if (complete_key && !cv->editable) {
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], NULL);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0, NULL);
|
||||
goto stop_emission;
|
||||
}
|
||||
|
||||
/* Stop our completion. */
|
||||
if (uncomplete_key && cv->editable && cv->selection < 0) {
|
||||
e_completion_view_set_cursor_row (cv, -1);
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
|
||||
goto stop_emission;
|
||||
}
|
||||
|
||||
@ -577,15 +568,15 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
|
||||
e_completion_view_set_cursor_row (cv, cv->selection);
|
||||
|
||||
if (cv->selection >= 0)
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE],
|
||||
g_ptr_array_index (cv->choices, cv->selection));
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0,
|
||||
g_ptr_array_index (cv->choices, cv->selection));
|
||||
else
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
|
||||
|
||||
stop_emission:
|
||||
|
||||
if (key_handled)
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (w), "key_press_event");
|
||||
g_signal_stop_emission_by_name (w, "key_press_event");
|
||||
|
||||
return key_handled;
|
||||
}
|
||||
@ -619,7 +610,7 @@ cancel_completion_cb (ECompletion *completion, gpointer user_data)
|
||||
e_completion_view_set_cursor_row (cv, -1);
|
||||
e_table_model_changed (cv->model);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] ,0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -635,9 +626,9 @@ completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_d
|
||||
e_table_model_row_inserted (cv->model, r);
|
||||
|
||||
if (first)
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY], 0);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ADDED]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ADDED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -649,7 +640,7 @@ end_completion_cb (ECompletion *completion, gpointer user_data)
|
||||
e_table_model_changed (cv->model);
|
||||
|
||||
cv->have_all_choices = TRUE;
|
||||
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_FULL]);
|
||||
g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_FULL], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -755,36 +746,36 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
|
||||
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (cv), GTK_CAN_FOCUS);
|
||||
|
||||
cv->completion = completion;
|
||||
gtk_object_ref (GTK_OBJECT (completion));
|
||||
g_object_ref (completion);
|
||||
|
||||
cv->begin_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"begin_completion",
|
||||
GTK_SIGNAL_FUNC (begin_completion_cb),
|
||||
cv);
|
||||
cv->comp_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"completion",
|
||||
GTK_SIGNAL_FUNC (completion_cb),
|
||||
cv);
|
||||
cv->restart_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"restart_completion",
|
||||
GTK_SIGNAL_FUNC (restart_completion_cb),
|
||||
cv);
|
||||
cv->cancel_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"cancel_completion",
|
||||
GTK_SIGNAL_FUNC (cancel_completion_cb),
|
||||
cv);
|
||||
cv->end_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"end_completion",
|
||||
GTK_SIGNAL_FUNC (end_completion_cb),
|
||||
cv);
|
||||
cv->clear_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"clear_completion",
|
||||
GTK_SIGNAL_FUNC (clear_completion_cb),
|
||||
cv);
|
||||
cv->lost_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
|
||||
"lost_completion",
|
||||
GTK_SIGNAL_FUNC (lost_completion_cb),
|
||||
cv);
|
||||
cv->begin_signal_id = g_signal_connect (completion,
|
||||
"begin_completion",
|
||||
G_CALLBACK (begin_completion_cb),
|
||||
cv);
|
||||
cv->comp_signal_id = g_signal_connect (completion,
|
||||
"completion",
|
||||
G_CALLBACK (completion_cb),
|
||||
cv);
|
||||
cv->restart_signal_id = g_signal_connect (completion,
|
||||
"restart_completion",
|
||||
G_CALLBACK (restart_completion_cb),
|
||||
cv);
|
||||
cv->cancel_signal_id = g_signal_connect (completion,
|
||||
"cancel_completion",
|
||||
G_CALLBACK (cancel_completion_cb),
|
||||
cv);
|
||||
cv->end_signal_id = g_signal_connect (completion,
|
||||
"end_completion",
|
||||
G_CALLBACK (end_completion_cb),
|
||||
cv);
|
||||
cv->clear_signal_id = g_signal_connect (completion,
|
||||
"clear_completion",
|
||||
G_CALLBACK (clear_completion_cb),
|
||||
cv);
|
||||
cv->lost_signal_id = g_signal_connect (completion,
|
||||
"lost_completion",
|
||||
G_CALLBACK (lost_completion_cb),
|
||||
cv);
|
||||
|
||||
cv->model = e_table_simple_new (table_col_count,
|
||||
table_row_count,
|
||||
@ -801,7 +792,7 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
|
||||
cv);
|
||||
|
||||
cv->table = e_table_scrolled_new (cv->model, NULL, simple_spec, NULL);
|
||||
gtk_object_unref (GTK_OBJECT (cv->model));
|
||||
g_object_unref (cv->model);
|
||||
|
||||
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (cv->table), GTK_SHADOW_NONE);
|
||||
e_scroll_frame_set_scrollbar_spacing (E_SCROLL_FRAME (cv->table), 0);
|
||||
@ -810,10 +801,10 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
|
||||
gtk_container_add (GTK_CONTAINER (cv), cv->table);
|
||||
gtk_widget_show_all (cv->table);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (e_completion_view_table (cv)),
|
||||
"click",
|
||||
GTK_SIGNAL_FUNC (table_click_cb),
|
||||
cv);
|
||||
g_signal_connect (e_completion_view_table (cv),
|
||||
"click",
|
||||
G_CALLBACK (table_click_cb),
|
||||
cv);
|
||||
|
||||
cv->selection = -1;
|
||||
}
|
||||
@ -826,7 +817,7 @@ e_completion_view_new (ECompletion *completion)
|
||||
g_return_val_if_fail (completion != NULL, NULL);
|
||||
g_return_val_if_fail (E_IS_COMPLETION (completion), NULL);
|
||||
|
||||
p = gtk_type_new (e_completion_view_get_type ());
|
||||
p = g_object_new (E_COMPLETION_VIEW_TYPE, NULL);
|
||||
|
||||
e_completion_view_construct (E_COMPLETION_VIEW (p), completion);
|
||||
|
||||
@ -841,18 +832,18 @@ e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w)
|
||||
g_return_if_fail (w == NULL || GTK_IS_WIDGET (w));
|
||||
|
||||
if (cv->key_widget) {
|
||||
gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
|
||||
gtk_object_unref (GTK_OBJECT (cv->key_widget));
|
||||
g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
|
||||
g_object_unref (cv->key_widget);
|
||||
}
|
||||
|
||||
if (w) {
|
||||
cv->key_widget = w;
|
||||
gtk_object_ref (GTK_OBJECT (w));
|
||||
g_object_ref (w);
|
||||
|
||||
cv->key_signal_id = gtk_signal_connect (GTK_OBJECT (w),
|
||||
"key_press_event",
|
||||
GTK_SIGNAL_FUNC (e_completion_view_key_press_handler),
|
||||
cv);
|
||||
cv->key_signal_id = g_signal_connect (w,
|
||||
"key_press_event",
|
||||
G_CALLBACK (e_completion_view_key_press_handler),
|
||||
cv);
|
||||
} else {
|
||||
cv->key_widget = NULL;
|
||||
cv->key_signal_id = 0;
|
||||
|
||||
@ -32,10 +32,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ())
|
||||
#define E_COMPLETION_VIEW(o) (GTK_CHECK_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
|
||||
#define E_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
|
||||
#define E_IS_COMPLETION_VIEW(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_VIEW_TYPE))
|
||||
#define E_IS_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE))
|
||||
#define E_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
|
||||
#define E_COMPLETION_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
|
||||
#define E_IS_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_VIEW_TYPE))
|
||||
#define E_IS_COMPLETION_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE))
|
||||
|
||||
typedef struct _ECompletionView ECompletionView;
|
||||
typedef struct _ECompletionViewClass ECompletionViewClass;
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gal/util/e-util.h>
|
||||
#include "e-completion.h"
|
||||
#include "gal/util/e-util.h"
|
||||
#include "gal/util/e-marshal.h"
|
||||
|
||||
enum {
|
||||
E_COMPLETION_REQUEST_COMPLETION,
|
||||
@ -65,7 +65,7 @@ typedef struct {
|
||||
|
||||
static void e_completion_class_init (ECompletionClass *klass);
|
||||
static void e_completion_init (ECompletion *complete);
|
||||
static void e_completion_destroy (GtkObject *object);
|
||||
static void e_completion_dispose (GObject *object);
|
||||
|
||||
static void e_completion_add_match (ECompletion *complete, ECompletionMatch *);
|
||||
static void e_completion_clear_search_stack (ECompletion *complete);
|
||||
@ -73,109 +73,101 @@ static void e_completion_clear_matches (ECompletion *complete);
|
||||
static gboolean e_completion_sort (ECompletion *complete);
|
||||
static void e_completion_restart (ECompletion *complete);
|
||||
|
||||
#define PARENT_TYPE GTK_TYPE_OBJECT
|
||||
static GtkObjectClass *parent_class;
|
||||
|
||||
|
||||
|
||||
GtkType
|
||||
e_completion_get_type (void)
|
||||
{
|
||||
static GtkType complete_type = 0;
|
||||
|
||||
if (!complete_type) {
|
||||
GtkTypeInfo complete_info = {
|
||||
"ECompletion",
|
||||
sizeof (ECompletion),
|
||||
sizeof (ECompletionClass),
|
||||
(GtkClassInitFunc) e_completion_class_init,
|
||||
(GtkObjectInitFunc) e_completion_init,
|
||||
NULL, NULL, /* reserved */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
complete_type = gtk_type_unique (gtk_object_get_type (), &complete_info);
|
||||
}
|
||||
|
||||
return complete_type;
|
||||
}
|
||||
E_MAKE_TYPE (e_completion,
|
||||
"ECompletion",
|
||||
ECompletion,
|
||||
e_completion_class_init,
|
||||
e_completion_init,
|
||||
PARENT_TYPE)
|
||||
|
||||
static void
|
||||
e_completion_class_init (ECompletionClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class = (GtkObjectClass *) klass;
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_object_get_type ()));
|
||||
parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
|
||||
e_completion_signals[E_COMPLETION_REQUEST_COMPLETION] =
|
||||
gtk_signal_new ("request_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, request_completion),
|
||||
e_marshal_NONE__POINTER_INT_INT,
|
||||
GTK_TYPE_NONE, 3,
|
||||
GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
|
||||
g_signal_new ("request_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, request_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER_INT_INT,
|
||||
G_TYPE_NONE, 3,
|
||||
G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
e_completion_signals[E_COMPLETION_BEGIN_COMPLETION] =
|
||||
gtk_signal_new ("begin_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, begin_completion),
|
||||
e_marshal_NONE__POINTER_INT_INT,
|
||||
GTK_TYPE_NONE, 3,
|
||||
GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
|
||||
g_signal_new ("begin_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, begin_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER_INT_INT,
|
||||
G_TYPE_NONE, 3,
|
||||
G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
e_completion_signals[E_COMPLETION_COMPLETION] =
|
||||
gtk_signal_new ("completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, completion),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
g_signal_new ("completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
e_completion_signals[E_COMPLETION_RESTART_COMPLETION] =
|
||||
gtk_signal_new ("restart_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, restart_completion),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
g_signal_new ("restart_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, restart_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_signals[E_COMPLETION_CANCEL_COMPLETION] =
|
||||
gtk_signal_new ("cancel_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, cancel_completion),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
g_signal_new ("cancel_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, cancel_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_signals[E_COMPLETION_END_COMPLETION] =
|
||||
gtk_signal_new ("end_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, end_completion),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("end_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, end_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_signals[E_COMPLETION_CLEAR_COMPLETION] =
|
||||
gtk_signal_new ("clear_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, clear_completion),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("clear_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, clear_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_completion_signals[E_COMPLETION_LOST_COMPLETION] =
|
||||
gtk_signal_new ("lost_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ECompletionClass, lost_completion),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
|
||||
g_signal_new ("lost_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ECompletionClass, lost_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER,
|
||||
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
||||
|
||||
E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_signals, E_COMPLETION_LAST_SIGNAL);
|
||||
|
||||
object_class->destroy = e_completion_destroy;
|
||||
object_class->dispose = e_completion_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -186,7 +178,7 @@ e_completion_init (ECompletion *complete)
|
||||
}
|
||||
|
||||
static void
|
||||
e_completion_destroy (GtkObject *object)
|
||||
e_completion_dispose (GObject *object)
|
||||
{
|
||||
ECompletion *complete = E_COMPLETION (object);
|
||||
|
||||
@ -204,8 +196,8 @@ e_completion_destroy (GtkObject *object)
|
||||
complete->priv = NULL;
|
||||
}
|
||||
|
||||
if (parent_class->destroy)
|
||||
(parent_class->destroy) (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
(G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -262,7 +254,7 @@ e_completion_clear (ECompletion *complete)
|
||||
e_completion_clear_search_stack (complete);
|
||||
complete->priv->refinement_count = 0;
|
||||
complete->priv->match_count = 0;
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CLEAR_COMPLETION]);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_CLEAR_COMPLETION], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -328,7 +320,7 @@ e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECom
|
||||
|
||||
e_completion_push_search (comp, text, pos);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, comp->priv->limit);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, comp->priv->limit);
|
||||
|
||||
comp->priv->match_count = 0;
|
||||
|
||||
@ -340,14 +332,14 @@ e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECom
|
||||
if (comp->priv->refinement_count == match->hit_count
|
||||
&& refine_fn (comp, match, text, pos)) {
|
||||
++match->hit_count;
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
|
||||
++comp->priv->match_count;
|
||||
}
|
||||
}
|
||||
|
||||
++comp->priv->refinement_count;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
|
||||
|
||||
comp->priv->searching = FALSE;
|
||||
comp->priv->refining = FALSE;
|
||||
@ -363,7 +355,8 @@ e_completion_unrefine_search (ECompletion *comp)
|
||||
|
||||
e_completion_pop_search (comp);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], comp->priv->search_text, comp->priv->pos, comp->priv->limit);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0,
|
||||
comp->priv->search_text, comp->priv->pos, comp->priv->limit);
|
||||
|
||||
comp->priv->match_count = 0;
|
||||
--comp->priv->refinement_count;
|
||||
@ -375,12 +368,12 @@ e_completion_unrefine_search (ECompletion *comp)
|
||||
ECompletionMatch *match = g_ptr_array_index (m, i);
|
||||
if (comp->priv->refinement_count <= match->hit_count) {
|
||||
match->hit_count = comp->priv->refinement_count;
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
|
||||
++comp->priv->match_count;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
|
||||
g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
|
||||
|
||||
comp->priv->searching = FALSE;
|
||||
comp->priv->refining = FALSE;
|
||||
@ -439,8 +432,8 @@ e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, g
|
||||
complete->priv->limit = limit > 0 ? limit : G_MAXINT;
|
||||
complete->priv->refinement_count = 0;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, limit);
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], text, pos, limit);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, limit);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], 0, text, pos, limit);
|
||||
}
|
||||
|
||||
void
|
||||
@ -453,7 +446,7 @@ e_completion_cancel_search (ECompletion *complete)
|
||||
if (!complete->priv->searching)
|
||||
return;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CANCEL_COMPLETION]);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_CANCEL_COMPLETION], 0);
|
||||
|
||||
complete->priv->searching = FALSE;
|
||||
}
|
||||
@ -527,7 +520,7 @@ e_completion_foreach_match (ECompletion *complete, ECompletionMatchFn fn, gpoint
|
||||
ECompletion *
|
||||
e_completion_new (void)
|
||||
{
|
||||
return E_COMPLETION (gtk_type_new (e_completion_get_type ()));
|
||||
return E_COMPLETION (g_object_new (E_COMPLETION_TYPE, NULL));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -568,15 +561,15 @@ e_completion_restart (ECompletion *complete)
|
||||
GPtrArray *m;
|
||||
gint i, count;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_RESTART_COMPLETION]);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_RESTART_COMPLETION], 0);
|
||||
|
||||
m = complete->priv->matches;
|
||||
for (i = count = 0;
|
||||
i < m->len && count < complete->priv->limit;
|
||||
i++, count++) {
|
||||
gtk_signal_emit (GTK_OBJECT (complete),
|
||||
e_completion_signals[E_COMPLETION_COMPLETION],
|
||||
g_ptr_array_index (m, i));
|
||||
g_signal_emit (complete,
|
||||
e_completion_signals[E_COMPLETION_COMPLETION], 0,
|
||||
g_ptr_array_index (m, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +594,7 @@ e_completion_found_match (ECompletion *complete, ECompletionMatch *match)
|
||||
|
||||
e_completion_add_match (complete, match);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_COMPLETION], match);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
|
||||
}
|
||||
|
||||
/* to optimize this, make the match a hash table */
|
||||
@ -620,7 +613,7 @@ e_completion_lost_match (ECompletion *complete, ECompletionMatch *match)
|
||||
/* maybe just return here? */
|
||||
g_return_if_fail (removed);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_LOST_COMPLETION], match);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_LOST_COMPLETION], 0, match);
|
||||
|
||||
e_completion_match_unref (match);
|
||||
}
|
||||
@ -639,7 +632,7 @@ e_completion_end_search (ECompletion *complete)
|
||||
if (e_completion_sort (complete))
|
||||
e_completion_restart (complete);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_END_COMPLETION]);
|
||||
g_signal_emit (complete, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
|
||||
|
||||
complete->priv->searching = FALSE;
|
||||
complete->priv->done_search = TRUE;
|
||||
|
||||
@ -31,10 +31,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_COMPLETION_TYPE (e_completion_get_type ())
|
||||
#define E_COMPLETION(o) (GTK_CHECK_CAST ((o), E_COMPLETION_TYPE, ECompletion))
|
||||
#define E_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
|
||||
#define E_IS_COMPLETION(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_TYPE))
|
||||
#define E_IS_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE))
|
||||
#define E_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_TYPE, ECompletion))
|
||||
#define E_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
|
||||
#define E_IS_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_TYPE))
|
||||
#define E_IS_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE))
|
||||
|
||||
typedef struct _ECompletion ECompletion;
|
||||
typedef struct _ECompletionClass ECompletionClass;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "e-entry.h"
|
||||
#include <gal/util/e-i18n.h>
|
||||
|
||||
static void destroy_callback(GtkWidget *app, gpointer data)
|
||||
static void destroy_callback(gpointer data, GObject *where_object_was)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
@ -64,16 +64,15 @@ int main( int argc, char *argv[] )
|
||||
app = gnome_app_new("EEntry Test", NULL);
|
||||
|
||||
entry = e_entry_new();
|
||||
gtk_object_set(GTK_OBJECT(entry),
|
||||
"editable", TRUE,
|
||||
"use_ellipsis", TRUE,
|
||||
NULL);
|
||||
g_object_set(entry,
|
||||
"editable", TRUE,
|
||||
"use_ellipsis", TRUE,
|
||||
NULL);
|
||||
gnome_app_set_contents( GNOME_APP( app ), entry );
|
||||
|
||||
/* Connect the signals */
|
||||
gtk_signal_connect( GTK_OBJECT( app ), "destroy",
|
||||
GTK_SIGNAL_FUNC( destroy_callback ),
|
||||
( gpointer ) app );
|
||||
g_object_weak_ref (G_OBJECT (app),
|
||||
destroy_callback, app);
|
||||
|
||||
gtk_widget_show_all( app );
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,10 +34,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_ENTRY_TYPE (e_entry_get_type ())
|
||||
#define E_ENTRY(o) (GTK_CHECK_CAST ((o), E_ENTRY_TYPE, EEntry))
|
||||
#define E_ENTRY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
|
||||
#define E_IS_ENTRY(o) (GTK_CHECK_TYPE ((o), E_ENTRY_TYPE))
|
||||
#define E_IS_ENTRY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
|
||||
#define E_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_ENTRY_TYPE, EEntry))
|
||||
#define E_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
|
||||
#define E_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_ENTRY_TYPE))
|
||||
#define E_IS_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
|
||||
|
||||
typedef struct _EEntry EEntry;
|
||||
typedef struct _EEntryClass EEntryClass;
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
static void e_table_text_model_class_init (ETableTextModelClass *class);
|
||||
static void e_table_text_model_init (ETableTextModel *model);
|
||||
static void e_table_text_model_destroy (GtkObject *object);
|
||||
static void e_table_text_model_dispose (GObject *object);
|
||||
|
||||
static const gchar *e_table_text_model_get_text (ETextModel *model);
|
||||
static void e_table_text_model_set_text (ETextModel *model, const gchar *text);
|
||||
@ -37,6 +37,7 @@ static void e_table_text_model_insert (ETextModel *model, gint postion, const gc
|
||||
static void e_table_text_model_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
|
||||
static void e_table_text_model_delete (ETextModel *model, gint postion, gint length);
|
||||
|
||||
#define PARENT_TYPE E_TYPE_TEXT_MODEL
|
||||
static GtkObject *parent_class;
|
||||
|
||||
|
||||
@ -50,40 +51,24 @@ static GtkObject *parent_class;
|
||||
*
|
||||
* Return value: The type ID of the &ETableTextModel class.
|
||||
**/
|
||||
GtkType
|
||||
e_table_text_model_get_type (void)
|
||||
{
|
||||
static GtkType model_type = 0;
|
||||
|
||||
if (!model_type) {
|
||||
GtkTypeInfo model_info = {
|
||||
"ETableTextModel",
|
||||
sizeof (ETableTextModel),
|
||||
sizeof (ETableTextModelClass),
|
||||
(GtkClassInitFunc) e_table_text_model_class_init,
|
||||
(GtkObjectInitFunc) e_table_text_model_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
model_type = gtk_type_unique (e_text_model_get_type (), &model_info);
|
||||
}
|
||||
|
||||
return model_type;
|
||||
}
|
||||
|
||||
E_MAKE_TYPE (e_table_text_model,
|
||||
"ETableTextModel",
|
||||
ETableTextModel,
|
||||
e_table_text_model_class_init,
|
||||
e_table_text_model_init,
|
||||
PARENT_TYPE)
|
||||
|
||||
/* Class initialization function for the text item */
|
||||
static void
|
||||
e_table_text_model_class_init (ETableTextModelClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
ETextModelClass *model_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GObjectClass *) klass;
|
||||
model_class = (ETextModelClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (e_text_model_get_type ());
|
||||
parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
|
||||
model_class->get_text = e_table_text_model_get_text;
|
||||
model_class->set_text = e_table_text_model_set_text;
|
||||
@ -91,7 +76,7 @@ e_table_text_model_class_init (ETableTextModelClass *klass)
|
||||
model_class->insert_length = e_table_text_model_insert_length;
|
||||
model_class->delete = e_table_text_model_delete;
|
||||
|
||||
object_class->destroy = e_table_text_model_destroy;
|
||||
object_class->dispose = e_table_text_model_dispose;
|
||||
}
|
||||
|
||||
/* Object initialization function for the text item */
|
||||
@ -105,9 +90,9 @@ e_table_text_model_init (ETableTextModel *model)
|
||||
model->row_changed_signal_id = 0;
|
||||
}
|
||||
|
||||
/* Destroy handler for the text item */
|
||||
/* Dispose handler for the text item */
|
||||
static void
|
||||
e_table_text_model_destroy (GtkObject *object)
|
||||
e_table_text_model_dispose (GObject *object)
|
||||
{
|
||||
ETableTextModel *model;
|
||||
|
||||
@ -120,21 +105,21 @@ e_table_text_model_destroy (GtkObject *object)
|
||||
g_assert (GTK_IS_OBJECT (model->model));
|
||||
|
||||
if (model->cell_changed_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT(model->model),
|
||||
model->cell_changed_signal_id);
|
||||
g_signal_handler_disconnect (model->model,
|
||||
model->cell_changed_signal_id);
|
||||
model->cell_changed_signal_id = 0;
|
||||
|
||||
if (model->row_changed_signal_id)
|
||||
gtk_signal_disconnect (GTK_OBJECT(model->model),
|
||||
model->row_changed_signal_id);
|
||||
g_signal_handler_disconnect (model->model,
|
||||
model->row_changed_signal_id);
|
||||
model->row_changed_signal_id = 0;
|
||||
|
||||
if (model->model)
|
||||
gtk_object_unref (GTK_OBJECT(model->model));
|
||||
g_object_unref (model->model);
|
||||
model->model = NULL;
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||
}
|
||||
static const gchar *
|
||||
e_table_text_model_get_text (ETextModel *text_model)
|
||||
@ -227,20 +212,20 @@ e_table_text_model_new (ETableModel *table_model, int row, int model_col)
|
||||
g_return_val_if_fail(table_model != NULL, NULL);
|
||||
g_return_val_if_fail(E_IS_TABLE_MODEL(table_model), NULL);
|
||||
|
||||
model = gtk_type_new (e_table_text_model_get_type ());
|
||||
model = g_object_new (E_TYPE_TABLE_TEXT_MODEL, NULL);
|
||||
model->model = table_model;
|
||||
if (model->model){
|
||||
gtk_object_ref (GTK_OBJECT(model->model));
|
||||
g_object_ref (model->model);
|
||||
model->cell_changed_signal_id =
|
||||
gtk_signal_connect (GTK_OBJECT(model->model),
|
||||
"model_cell_changed",
|
||||
GTK_SIGNAL_FUNC(cell_changed),
|
||||
model);
|
||||
g_signal_connect (model->model,
|
||||
"model_cell_changed",
|
||||
G_CALLBACK(cell_changed),
|
||||
model);
|
||||
model->row_changed_signal_id =
|
||||
gtk_signal_connect (GTK_OBJECT(model->model),
|
||||
"model_row_changed",
|
||||
GTK_SIGNAL_FUNC(row_changed),
|
||||
model);
|
||||
g_signal_connect (model->model,
|
||||
"model_row_changed",
|
||||
G_CALLBACK(row_changed),
|
||||
model);
|
||||
}
|
||||
model->row = row;
|
||||
model->model_col = model_col;
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ())
|
||||
#define E_TABLE_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
|
||||
#define E_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
|
||||
#define E_IS_TABLE_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
|
||||
#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL))
|
||||
#define E_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
|
||||
#define E_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
|
||||
#define E_IS_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
|
||||
#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL))
|
||||
|
||||
typedef struct _ETableTextModel ETableTextModel;
|
||||
typedef struct _ETableTextModelClass ETableTextModelClass;
|
||||
|
||||
@ -30,10 +30,11 @@
|
||||
#include <regex.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <libgnome/gnome-url.h>
|
||||
#include <gal/util/e-util.h>
|
||||
|
||||
static void e_text_model_uri_class_init (ETextModelURIClass *class);
|
||||
static void e_text_model_uri_init (ETextModelURI *model);
|
||||
static void e_text_model_uri_destroy (GtkObject *object);
|
||||
static void e_text_model_uri_dispose (GObject *object);
|
||||
|
||||
static void objectify_uris (ETextModelURI *model);
|
||||
|
||||
@ -48,43 +49,28 @@ struct _ObjInfo {
|
||||
gint offset, len;
|
||||
};
|
||||
|
||||
#define PARENT_TYPE E_TYPE_TEXT_MODEL
|
||||
static GtkObject *parent_class;
|
||||
|
||||
GtkType
|
||||
e_text_model_uri_get_type (void)
|
||||
{
|
||||
static GtkType model_uri_type = 0;
|
||||
|
||||
if (!model_uri_type) {
|
||||
GtkTypeInfo model_uri_info = {
|
||||
"ETextModelURI",
|
||||
sizeof (ETextModelURI),
|
||||
sizeof (ETextModelURIClass),
|
||||
(GtkClassInitFunc) e_text_model_uri_class_init,
|
||||
(GtkObjectInitFunc) e_text_model_uri_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
model_uri_type = gtk_type_unique (e_text_model_get_type (), &model_uri_info);
|
||||
}
|
||||
|
||||
return model_uri_type;
|
||||
}
|
||||
|
||||
E_MAKE_TYPE (e_text_model_uri,
|
||||
"ETextModelURI",
|
||||
ETextModelURI,
|
||||
e_text_model_uri_class_init,
|
||||
e_text_model_uri_init,
|
||||
PARENT_TYPE)
|
||||
|
||||
static void
|
||||
e_text_model_uri_class_init (ETextModelURIClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
ETextModelClass *model_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GObjectClass *) klass;
|
||||
model_class = E_TEXT_MODEL_CLASS (klass);
|
||||
|
||||
parent_class = gtk_type_class (e_text_model_get_type ());
|
||||
parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
|
||||
object_class->destroy = e_text_model_uri_destroy;
|
||||
object_class->dispose = e_text_model_uri_dispose;
|
||||
|
||||
model_class->object_activated = e_text_model_uri_activate_nth_object;
|
||||
|
||||
@ -102,7 +88,7 @@ e_text_model_uri_init (ETextModelURI *model)
|
||||
}
|
||||
|
||||
static void
|
||||
e_text_model_uri_destroy (GtkObject *object)
|
||||
e_text_model_uri_dispose (GObject *object)
|
||||
{
|
||||
ETextModelURI *model_uri = E_TEXT_MODEL_URI (object);
|
||||
GList *iter;
|
||||
@ -117,8 +103,8 @@ e_text_model_uri_destroy (GtkObject *object)
|
||||
g_list_free (model_uri->uris);
|
||||
model_uri->uris = NULL;
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||
|
||||
}
|
||||
|
||||
@ -351,7 +337,7 @@ e_text_model_uri_activate_nth_object (ETextModel *model, gint i)
|
||||
ETextModel *
|
||||
e_text_model_uri_new (void)
|
||||
{
|
||||
return E_TEXT_MODEL (gtk_type_new (e_text_model_uri_get_type ()));
|
||||
return E_TEXT_MODEL (g_object_new (E_TYPE_TEXT_MODEL_URI, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,10 +29,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_TYPE_TEXT_MODEL_URI (e_text_model_get_type ())
|
||||
#define E_TEXT_MODEL_URI(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
|
||||
#define E_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
|
||||
#define E_IS_TEXT_MODEL_URI(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
|
||||
#define E_IS_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI))
|
||||
#define E_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
|
||||
#define E_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
|
||||
#define E_IS_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
|
||||
#define E_IS_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI))
|
||||
|
||||
typedef struct _ETextModelURI ETextModelURI;
|
||||
typedef struct _ETextModelURIClass ETextModelURIClass;
|
||||
|
||||
@ -53,7 +53,7 @@ struct _ETextModelPrivate {
|
||||
|
||||
static void e_text_model_class_init (ETextModelClass *class);
|
||||
static void e_text_model_init (ETextModel *model);
|
||||
static void e_text_model_destroy (GtkObject *object);
|
||||
static void e_text_model_dispose (GObject *object);
|
||||
|
||||
static gint e_text_model_real_validate_position (ETextModel *, gint pos);
|
||||
static const gchar *e_text_model_real_get_text (ETextModel *model);
|
||||
@ -63,6 +63,7 @@ static void e_text_model_real_insert (ETextModel *model, gint
|
||||
static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
|
||||
static void e_text_model_real_delete (ETextModel *model, gint postion, gint length);
|
||||
|
||||
#define PARENT_TYPE GTK_TYPE_OBJECT
|
||||
static GtkObject *parent_class;
|
||||
|
||||
|
||||
@ -76,74 +77,60 @@ static GtkObject *parent_class;
|
||||
*
|
||||
* Return value: The type ID of the &ETextModel class.
|
||||
**/
|
||||
GtkType
|
||||
e_text_model_get_type (void)
|
||||
{
|
||||
static GtkType model_type = 0;
|
||||
|
||||
if (!model_type) {
|
||||
GtkTypeInfo model_info = {
|
||||
"ETextModel",
|
||||
sizeof (ETextModel),
|
||||
sizeof (ETextModelClass),
|
||||
(GtkClassInitFunc) e_text_model_class_init,
|
||||
(GtkObjectInitFunc) e_text_model_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
model_type = gtk_type_unique (gtk_object_get_type (), &model_info);
|
||||
}
|
||||
|
||||
return model_type;
|
||||
}
|
||||
E_MAKE_TYPE (e_text_model,
|
||||
"ETextModel",
|
||||
ETextModel,
|
||||
e_text_model_class_init,
|
||||
e_text_model_init,
|
||||
PARENT_TYPE)
|
||||
|
||||
/* Class initialization function for the text item */
|
||||
static void
|
||||
e_text_model_class_init (ETextModelClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (gtk_object_get_type ());
|
||||
parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
|
||||
e_text_model_signals[E_TEXT_MODEL_CHANGED] =
|
||||
gtk_signal_new ("changed",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ETextModelClass, changed),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
g_signal_new ("changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ETextModelClass, changed),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
e_text_model_signals[E_TEXT_MODEL_REPOSITION] =
|
||||
gtk_signal_new ("reposition",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ETextModelClass, reposition),
|
||||
e_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER, GTK_TYPE_POINTER);
|
||||
g_signal_new ("reposition",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ETextModelClass, reposition),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__POINTER_POINTER,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_POINTER, G_TYPE_POINTER);
|
||||
|
||||
e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
|
||||
gtk_signal_new ("object_activated",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ETextModelClass, object_activated),
|
||||
gtk_marshal_NONE__INT,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_INT);
|
||||
g_signal_new ("object_activated",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ETextModelClass, object_activated),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
|
||||
e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
|
||||
gtk_signal_new ("cancel_completion",
|
||||
GTK_RUN_LAST,
|
||||
E_OBJECT_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (ETextModelClass, cancel_completion),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL);
|
||||
g_signal_new ("cancel_completion",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ETextModelClass, cancel_completion),
|
||||
NULL, NULL,
|
||||
e_marshal_NONE__NONE,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/* No default signal handlers. */
|
||||
klass->changed = NULL;
|
||||
@ -164,7 +151,7 @@ e_text_model_class_init (ETextModelClass *klass)
|
||||
klass->obj_count = NULL;
|
||||
klass->get_nth_obj = NULL;
|
||||
|
||||
object_class->destroy = e_text_model_destroy;
|
||||
object_class->dispose = e_text_model_dispose;
|
||||
}
|
||||
|
||||
/* Object initialization function for the text item */
|
||||
@ -176,9 +163,9 @@ e_text_model_init (ETextModel *model)
|
||||
model->priv->len = 0;
|
||||
}
|
||||
|
||||
/* Destroy handler for the text item */
|
||||
/* Dispose handler for the text item */
|
||||
static void
|
||||
e_text_model_destroy (GtkObject *object)
|
||||
e_text_model_dispose (GObject *object)
|
||||
{
|
||||
ETextModel *model;
|
||||
|
||||
@ -194,8 +181,8 @@ e_text_model_destroy (GtkObject *object)
|
||||
model->priv = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -370,8 +357,8 @@ e_text_model_changed (ETextModel *model)
|
||||
if (CLASS (model)->objectify)
|
||||
CLASS (model)->objectify (model);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (model),
|
||||
e_text_model_signals[E_TEXT_MODEL_CHANGED]);
|
||||
g_signal_emit (model,
|
||||
e_text_model_signals[E_TEXT_MODEL_CHANGED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -379,7 +366,7 @@ e_text_model_cancel_completion (ETextModel *model)
|
||||
{
|
||||
g_return_if_fail (E_IS_TEXT_MODEL (model));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION]);
|
||||
g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION], 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -389,9 +376,9 @@ e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos
|
||||
g_return_if_fail (E_IS_TEXT_MODEL (model));
|
||||
g_return_if_fail (fn != NULL);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (model),
|
||||
e_text_model_signals[E_TEXT_MODEL_REPOSITION],
|
||||
fn, repos_data);
|
||||
g_signal_emit (model,
|
||||
e_text_model_signals[E_TEXT_MODEL_REPOSITION], 0,
|
||||
fn, repos_data);
|
||||
}
|
||||
|
||||
gint
|
||||
@ -637,12 +624,12 @@ e_text_model_activate_nth_object (ETextModel *model, gint n)
|
||||
g_return_if_fail (n >= 0);
|
||||
g_return_if_fail (n < e_text_model_object_count (model));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], n);
|
||||
g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], 0, n);
|
||||
}
|
||||
|
||||
ETextModel *
|
||||
e_text_model_new (void)
|
||||
{
|
||||
ETextModel *model = gtk_type_new (e_text_model_get_type ());
|
||||
ETextModel *model = g_object_new (E_TYPE_TEXT_MODEL, NULL);
|
||||
return model;
|
||||
}
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define E_TYPE_TEXT_MODEL (e_text_model_get_type ())
|
||||
#define E_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
|
||||
#define E_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
|
||||
#define E_IS_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL))
|
||||
#define E_IS_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
|
||||
#define E_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
|
||||
#define E_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
|
||||
#define E_IS_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL))
|
||||
#define E_IS_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
|
||||
|
||||
typedef struct _ETextModel ETextModel;
|
||||
typedef struct _ETextModelClass ETextModelClass;
|
||||
|
||||
@ -34,9 +34,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, Gnom
|
||||
gnome_canvas_item_set( item,
|
||||
"width", (double) allocation->width,
|
||||
NULL );
|
||||
gtk_object_get(GTK_OBJECT(item),
|
||||
"height", &height,
|
||||
NULL);
|
||||
g_object_get(item,
|
||||
"height", &height,
|
||||
NULL);
|
||||
height = MAX(height, allocation->height);
|
||||
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, height );
|
||||
gnome_canvas_item_set( rect,
|
||||
@ -49,9 +49,9 @@ static void
|
||||
reflow (GtkWidget *canvas, GnomeCanvasItem *item)
|
||||
{
|
||||
double height;
|
||||
gtk_object_get(GTK_OBJECT(item),
|
||||
"height", &height,
|
||||
NULL);
|
||||
g_object_get(item,
|
||||
"height", &height,
|
||||
NULL);
|
||||
height = MAX(height, canvas->allocation.height);
|
||||
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, canvas->allocation.width, height );
|
||||
gnome_canvas_item_set( rect,
|
||||
@ -61,8 +61,7 @@ reflow (GtkWidget *canvas, GnomeCanvasItem *item)
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer data)
|
||||
quit_cb (gpointer data, GObject *where_object_was)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
@ -102,8 +101,8 @@ main (int argc,
|
||||
gnome_init ("ETextTest", "0.0.1", argc, argv);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "EText Test");
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (quit_cb), NULL);
|
||||
g_object_weak_ref (G_OBJECT (window),
|
||||
quit_cb, NULL);
|
||||
|
||||
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
|
||||
canvas = e_canvas_new ();
|
||||
@ -150,17 +149,17 @@ main (int argc,
|
||||
"width", 150.0,
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (text), "activate",
|
||||
GTK_SIGNAL_FUNC (change_text_cb), item);
|
||||
gtk_signal_connect (GTK_OBJECT (font), "activate",
|
||||
GTK_SIGNAL_FUNC (change_font_cb), item);
|
||||
g_signal_connect (text, "activate",
|
||||
G_CALLBACK (change_text_cb), item);
|
||||
g_signal_connect (font, "activate",
|
||||
G_CALLBACK (change_font_cb), item);
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
|
||||
GTK_SIGNAL_FUNC( allocate_callback ),
|
||||
item );
|
||||
gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
|
||||
GTK_SIGNAL_FUNC( reflow ),
|
||||
item );
|
||||
g_signal_connect (canvas , "size_allocate",
|
||||
G_CALLBACK (allocate_callback),
|
||||
item );
|
||||
g_signal_connect (canvas , "reflow",
|
||||
G_CALLBACK (reflow),
|
||||
item );
|
||||
gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0);
|
||||
gtk_widget_show_all (window);
|
||||
gtk_main ();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -95,10 +95,10 @@ G_BEGIN_DECLS
|
||||
*/
|
||||
|
||||
#define E_TYPE_TEXT (e_text_get_type ())
|
||||
#define E_TEXT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT, EText))
|
||||
#define E_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass))
|
||||
#define E_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT))
|
||||
#define E_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT))
|
||||
#define E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT, EText))
|
||||
#define E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass))
|
||||
#define E_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT))
|
||||
#define E_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT))
|
||||
|
||||
|
||||
typedef struct _EText EText;
|
||||
|
||||
Reference in New Issue
Block a user