Deprecation cleanup

Wed Oct  9 15:07:08 2002  Manish Singh  <yosh@gimp.org>

        * gtk/gtkbindings.[ch] gtk/gtkcalendar.[ch] gtk/gtkfilesel.[ch]
        gtk/gtkfontsel.[ch] gtk/gtkitem.[ch] gtk/gtkitemfactory.[ch]:
        Deprecation cleanup
This commit is contained in:
Manish Singh 2002-10-09 22:11:08 +00:00 committed by Manish Singh
parent 7eecad56f8
commit fb6a7df846
12 changed files with 454 additions and 447 deletions

View File

@ -32,7 +32,6 @@
#include <gdkkeysyms.h>
#include "gtkbindings.h"
#include "gtkkeyhash.h"
#include "gtksignal.h"
#include "gtkwidget.h"
#include "gtkrc.h"
@ -80,7 +79,7 @@ binding_signal_free (GtkBindingSignal *sig)
for (i = 0; i < sig->n_args; i++)
{
if (GTK_FUNDAMENTAL_TYPE (sig->args[i].arg_type) == GTK_TYPE_STRING)
if (G_TYPE_FUNDAMENTAL (sig->args[i].arg_type) == G_TYPE_STRING)
g_free (sig->args[i].d.string_data);
}
g_free (sig->args);
@ -362,11 +361,11 @@ binding_compose_params (GtkObject *object,
g_value_init (&tmp_value, G_TYPE_DOUBLE);
g_value_set_double (&tmp_value, args->d.double_data);
break;
case G_TYPE_LONG:
case G_TYPE_LONG:
g_value_init (&tmp_value, G_TYPE_LONG);
g_value_set_long (&tmp_value, args->d.long_data);
break;
case G_TYPE_STRING:
case G_TYPE_STRING:
/* gtk_rc_parse_flags/enum() has fancier parsing for this; we can't call
* that since we don't have a GParamSpec, so just do something simple
*/
@ -505,7 +504,7 @@ gtk_binding_entry_activate (GtkBindingEntry *entry,
sig->signal_name,
g_type_name (G_OBJECT_TYPE (object)));
}
else if (!(query.signal_flags & GTK_RUN_ACTION))
else if (!(query.signal_flags & G_SIGNAL_ACTION))
{
accelerator = gtk_accelerator_name (entry->keyval, entry->modifiers);
g_warning ("gtk_binding_entry_activate(): binding \"%s::%s\": "
@ -587,10 +586,10 @@ gtk_binding_set_by_class (gpointer object_class)
if (binding_set)
return binding_set;
binding_set = gtk_binding_set_new (gtk_type_name (GTK_CLASS_TYPE (class)));
binding_set = gtk_binding_set_new (g_type_name (G_OBJECT_CLASS_TYPE (class)));
gtk_binding_set_add_path (binding_set,
GTK_PATH_CLASS,
gtk_type_name (GTK_CLASS_TYPE (class)),
g_type_name (G_OBJECT_CLASS_TYPE (class)),
GTK_PATH_PRIO_GTK);
g_dataset_id_set_data (class, key_id_class_binding_set, binding_set);
@ -705,19 +704,19 @@ gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
binding_signal_free (signal);
return;
}
switch (GTK_FUNDAMENTAL_TYPE (tmp_arg->arg_type))
switch (G_TYPE_FUNDAMENTAL (tmp_arg->arg_type))
{
case GTK_TYPE_LONG:
arg->arg_type = GTK_TYPE_LONG;
case G_TYPE_LONG:
arg->arg_type = G_TYPE_LONG;
arg->d.long_data = tmp_arg->d.long_data;
break;
case GTK_TYPE_DOUBLE:
arg->arg_type = GTK_TYPE_DOUBLE;
case G_TYPE_DOUBLE:
arg->arg_type = G_TYPE_DOUBLE;
arg->d.double_data = tmp_arg->d.double_data;
break;
case GTK_TYPE_STRING:
case G_TYPE_STRING:
if (tmp_arg->arg_type != GTK_TYPE_IDENTIFIER)
arg->arg_type = GTK_TYPE_STRING;
arg->arg_type = G_TYPE_STRING;
else
arg->arg_type = GTK_TYPE_IDENTIFIER;
arg->d.string_data = g_strdup (tmp_arg->d.string_data);
@ -730,7 +729,7 @@ gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
break;
default:
g_warning ("gtk_binding_entry_add_signall(): unsupported type `%s' for arg[%u]",
gtk_type_name (arg->arg_type), n);
g_type_name (arg->arg_type), n);
binding_signal_free (signal);
return;
}
@ -775,46 +774,46 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
slist = g_slist_prepend (slist, arg);
arg->arg_type = va_arg (args, GtkType);
switch (GTK_FUNDAMENTAL_TYPE (arg->arg_type))
switch (G_TYPE_FUNDAMENTAL (arg->arg_type))
{
/* for elaborated commenting about var args collection, take a look
* at gtk_arg_collect_value() in gtkargcollector.c
*/
case GTK_TYPE_CHAR:
case GTK_TYPE_UCHAR:
case GTK_TYPE_INT:
case GTK_TYPE_UINT:
case GTK_TYPE_BOOL:
case GTK_TYPE_ENUM:
case GTK_TYPE_FLAGS:
arg->arg_type = GTK_TYPE_LONG;
case G_TYPE_CHAR:
case G_TYPE_UCHAR:
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_BOOLEAN:
case G_TYPE_ENUM:
case G_TYPE_FLAGS:
arg->arg_type = G_TYPE_LONG;
arg->d.long_data = va_arg (args, gint);
break;
case GTK_TYPE_LONG:
case GTK_TYPE_ULONG:
arg->arg_type = GTK_TYPE_LONG;
case G_TYPE_LONG:
case G_TYPE_ULONG:
arg->arg_type = G_TYPE_LONG;
arg->d.long_data = va_arg (args, glong);
break;
case GTK_TYPE_FLOAT:
case GTK_TYPE_DOUBLE:
arg->arg_type = GTK_TYPE_DOUBLE;
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
arg->arg_type = G_TYPE_DOUBLE;
arg->d.double_data = va_arg (args, gdouble);
break;
case GTK_TYPE_STRING:
case G_TYPE_STRING:
if (arg->arg_type != GTK_TYPE_IDENTIFIER)
arg->arg_type = GTK_TYPE_STRING;
arg->arg_type = G_TYPE_STRING;
arg->d.string_data = va_arg (args, gchar*);
if (!arg->d.string_data)
{
g_warning ("gtk_binding_entry_add_signal(): type `%s' arg[%u] is `NULL'",
gtk_type_name (arg->arg_type),
g_type_name (arg->arg_type),
i);
i += n_args + 1;
}
break;
default:
g_warning ("gtk_binding_entry_add_signal(): unsupported type `%s' for arg[%u]",
gtk_type_name (arg->arg_type), i);
g_type_name (arg->arg_type), i);
i += n_args + 1;
break;
}
@ -1046,24 +1045,24 @@ gtk_bindings_activate_list (GtkObject *object,
if (!handled)
{
GSList *patterns;
GtkType class_type;
GType class_type;
patterns = gtk_binding_entries_sort_patterns (entries, GTK_PATH_CLASS, is_release);
class_type = GTK_OBJECT_TYPE (object);
class_type = G_TYPE_FROM_INSTANCE (object);
while (class_type && !handled)
{
guint path_length;
const gchar *path;
gchar *path_reversed;
path = gtk_type_name (class_type);
path = g_type_name (class_type);
path_reversed = g_strdup (path);
g_strreverse (path_reversed);
path_length = strlen (path);
handled = binding_match_activate (patterns, object, path_length, path, path_reversed);
g_free (path_reversed);
class_type = gtk_type_parent (class_type);
class_type = g_type_parent (class_type);
}
g_slist_free (patterns);
}
@ -1193,7 +1192,7 @@ gtk_binding_parse_signal (GScanner *scanner,
{
need_arg = FALSE;
arg = g_new (GtkBindingArg, 1);
arg->arg_type = GTK_TYPE_DOUBLE;
arg->arg_type = G_TYPE_DOUBLE;
arg->d.double_data = scanner->value.v_float;
if (negate)
{
@ -1210,7 +1209,7 @@ gtk_binding_parse_signal (GScanner *scanner,
{
need_arg = FALSE;
arg = g_new (GtkBindingArg, 1);
arg->arg_type = GTK_TYPE_LONG;
arg->arg_type = G_TYPE_LONG;
arg->d.long_data = scanner->value.v_int;
if (negate)
{
@ -1227,7 +1226,7 @@ gtk_binding_parse_signal (GScanner *scanner,
{
need_arg = FALSE;
arg = g_new (GtkBindingArg, 1);
arg->arg_type = GTK_TYPE_STRING;
arg->arg_type = G_TYPE_STRING;
arg->d.string_data = g_strdup (scanner->value.v_string);
args = g_slist_prepend (args, arg);
}
@ -1290,7 +1289,7 @@ gtk_binding_parse_signal (GScanner *scanner,
GtkBindingArg *arg;
arg = slist->data;
if (GTK_FUNDAMENTAL_TYPE (arg->arg_type) == GTK_TYPE_STRING)
if (G_TYPE_FUNDAMENTAL (arg->arg_type) == G_TYPE_STRING)
g_free (arg->d.string_data);
g_free (arg);
}

View File

@ -86,7 +86,7 @@ struct _GtkBindingSignal
struct _GtkBindingArg
{
GtkType arg_type;
GType arg_type;
union {
glong long_data;
gdouble double_data;

View File

@ -38,7 +38,9 @@
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include "gtkcalendar.h"
#include "gtkmarshalers.h"
#include "gdk/gdkkeysyms.h"
/***************************************************************************/
@ -307,27 +309,28 @@ static gint top_y_for_row (GtkCalendar *calendar,
static char *default_abbreviated_dayname[7];
static char *default_monthname[12];
GtkType
GType
gtk_calendar_get_type (void)
{
static GtkType calendar_type = 0;
static GType calendar_type = 0;
if (!calendar_type)
{
static const GTypeInfo calendar_info =
{
sizeof (GtkCalendarClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_calendar_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkCalendar),
16, /* n_preallocs */
0, /* n_preallocs */
(GInstanceInitFunc) gtk_calendar_init,
};
calendar_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCalendar", &calendar_info, 0);
calendar_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCalendar",
&calendar_info, 0);
}
return calendar_type;
@ -337,14 +340,12 @@ static void
gtk_calendar_class_init (GtkCalendarClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
gobject_class = (GObjectClass*) class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
parent_class = g_type_class_peek_parent (class);
gobject_class->finalize = gtk_calendar_finalize;
@ -370,40 +371,61 @@ gtk_calendar_class_init (GtkCalendarClass *class)
class->next_year = NULL;
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
gtk_signal_new ("month_changed",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, month_changed),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("month_changed",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, month_changed),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[DAY_SELECTED_SIGNAL] =
gtk_signal_new ("day_selected",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("day_selected",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, day_selected),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] =
gtk_signal_new ("day_selected_double_click",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected_double_click),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("day_selected_double_click",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, day_selected_double_click),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[PREV_MONTH_SIGNAL] =
gtk_signal_new ("prev_month",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_month),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("prev_month",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, prev_month),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[NEXT_MONTH_SIGNAL] =
gtk_signal_new ("next_month",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_month),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("next_month",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, next_month),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[PREV_YEAR_SIGNAL] =
gtk_signal_new ("prev_year",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_year),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("prev_year",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, prev_year),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gtk_calendar_signals[NEXT_YEAR_SIGNAL] =
gtk_signal_new ("next_year",
GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_year),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
g_signal_new ("next_year",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCalendarClass, next_year),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
@ -420,7 +442,7 @@ gtk_calendar_init (GtkCalendar *calendar)
widget = GTK_WIDGET (calendar);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
calendar->private_data = (gpointer) g_malloc (sizeof (GtkCalendarPrivateData));
calendar->private_data = g_malloc (sizeof (GtkCalendarPrivateData));
private_data = GTK_CALENDAR_PRIVATE_DATA (calendar);
if (!default_abbreviated_dayname[0])
@ -483,7 +505,7 @@ gtk_calendar_init (GtkCalendar *calendar)
GtkWidget*
gtk_calendar_new (void)
{
return GTK_WIDGET (gtk_type_new (GTK_TYPE_CALENDAR));
return g_object_new (GTK_TYPE_CALENDAR, NULL);
}
/* column_from_x: returns the column 0-6 that the
@ -645,10 +667,12 @@ gtk_calendar_set_month_prev (GtkCalendar *calendar)
gtk_calendar_freeze (calendar);
gtk_calendar_compute_days (calendar);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[PREV_MONTH_SIGNAL]);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[MONTH_CHANGED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[PREV_MONTH_SIGNAL],
0);
g_signal_emit (calendar,
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
if (month_len < calendar->selected_day)
{
@ -688,10 +712,12 @@ gtk_calendar_set_month_next (GtkCalendar *calendar)
gtk_calendar_freeze (calendar);
gtk_calendar_compute_days (calendar);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[NEXT_MONTH_SIGNAL]);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[MONTH_CHANGED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[NEXT_MONTH_SIGNAL],
0);
g_signal_emit (calendar,
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
month_len = month_length[leap (calendar->year)][calendar->month + 1];
@ -717,10 +743,12 @@ gtk_calendar_set_year_prev (GtkCalendar *calendar)
calendar->year--;
gtk_calendar_freeze (calendar);
gtk_calendar_compute_days (calendar);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[PREV_YEAR_SIGNAL]);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[MONTH_CHANGED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[PREV_YEAR_SIGNAL],
0);
g_signal_emit (calendar,
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
month_len = month_length[leap (calendar->year)][calendar->month + 1];
@ -750,10 +778,12 @@ gtk_calendar_set_year_next (GtkCalendar *calendar)
calendar->year++;
gtk_calendar_compute_days (calendar);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[NEXT_YEAR_SIGNAL]);
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[MONTH_CHANGED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[NEXT_YEAR_SIGNAL],
0);
g_signal_emit (calendar,
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
month_len = month_length[leap (calendar->year)][calendar->month + 1];
@ -811,8 +841,9 @@ gtk_calendar_main_button (GtkWidget *widget,
else if (event->type == GDK_2BUTTON_PRESS)
{
if (day_month == MONTH_CURRENT)
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL],
0);
}
}
@ -1125,9 +1156,9 @@ gtk_calendar_unrealize (GtkWidget *widget)
private_data->day_name_win = NULL;
}
if (calendar->xor_gc)
gdk_gc_unref (calendar->xor_gc);
g_object_unref (calendar->xor_gc);
if (calendar->gc)
gdk_gc_unref (calendar->gc);
g_object_unref (calendar->gc);
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
@ -1294,7 +1325,7 @@ gtk_calendar_size_request (GtkWidget *widget,
requisition->height = height + (widget->style->ythickness + INNER_BORDER) * 2;
g_object_unref (G_OBJECT (layout));
g_object_unref (layout);
}
static void
@ -1459,9 +1490,10 @@ gtk_calendar_paint_header (GtkWidget *widget)
max_year_width = private_data->max_year_width;
gdk_gc_set_foreground (gc, BACKGROUND_COLOR (GTK_WIDGET (calendar)));
gtk_draw_shadow (widget->style, private_data->header_win,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
0, 0, header_width, private_data->header_h);
gtk_paint_shadow (widget->style, private_data->header_win,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, widget, "calendar",
0, 0, header_width, private_data->header_h);
sprintf (buffer, "%d", calendar->year);
@ -1503,7 +1535,7 @@ gtk_calendar_paint_header (GtkWidget *widget)
gtk_calendar_paint_arrow (widget, ARROW_YEAR_LEFT);
gtk_calendar_paint_arrow (widget, ARROW_YEAR_RIGHT);
g_object_unref (G_OBJECT (layout));
g_object_unref (layout);
}
static void
@ -1600,7 +1632,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget)
layout);
}
g_object_unref (G_OBJECT (layout));
g_object_unref (layout);
}
static void
@ -1695,7 +1727,7 @@ gtk_calendar_paint_week_numbers (GtkWidget *widget)
gdk_draw_layout (private_data->week_win, gc, x_loc, y_loc, layout);
}
g_object_unref (G_OBJECT (layout));
g_object_unref (layout);
}
static void
@ -1852,7 +1884,7 @@ gtk_calendar_paint_day (GtkWidget *widget,
day_height);
}
g_object_unref (G_OBJECT (layout));
g_object_unref (layout);
}
@ -2110,8 +2142,9 @@ gtk_calendar_select_month (GtkCalendar *calendar,
gtk_calendar_compute_days (calendar);
gtk_widget_queue_draw (GTK_WIDGET (calendar));
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[MONTH_CHANGED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
return TRUE;
}
@ -2144,8 +2177,9 @@ gtk_calendar_select_day (GtkCalendar *calendar,
gtk_calendar_paint_day_num (GTK_WIDGET (calendar), day);
}
gtk_signal_emit (GTK_OBJECT (calendar),
gtk_calendar_signals[DAY_SELECTED_SIGNAL]);
g_signal_emit (calendar,
gtk_calendar_signals[DAY_SELECTED_SIGNAL],
0);
}
static void
@ -2442,7 +2476,7 @@ gtk_calendar_paint_arrow (GtkWidget *widget,
gdk_window_clear (window);
gdk_window_set_background (window, &(widget)->style->bg[state]);
gdk_window_get_size (window, &width, &height);
gdk_drawable_get_size (window, &width, &height);
gdk_window_clear_area (window,
0,0,
width,height);

View File

@ -30,9 +30,11 @@
#define __GTK_CALENDAR_H__
#include <gdk/gdk.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwidget.h>
/* Not needed, retained for compatibility -Yosh */
#include <gtk/gtksignal.h>
#ifdef __cplusplus
extern "C" {
@ -40,11 +42,11 @@ extern "C" {
#define GTK_TYPE_CALENDAR (gtk_calendar_get_type ())
#define GTK_CALENDAR(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CALENDAR, GtkCalendar))
#define GTK_CALENDAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CALENDAR, GtkCalendarClass))
#define GTK_IS_CALENDAR(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CALENDAR))
#define GTK_IS_CALENDAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CALENDAR))
#define GTK_CALENDAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CALENDAR, GtkCalendarClass))
#define GTK_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CALENDAR, GtkCalendar))
#define GTK_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CALENDAR, GtkCalendarClass))
#define GTK_IS_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CALENDAR))
#define GTK_IS_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CALENDAR))
#define GTK_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CALENDAR, GtkCalendarClass))
typedef struct _GtkCalendar GtkCalendar;
@ -113,7 +115,7 @@ struct _GtkCalendarClass
};
GtkType gtk_calendar_get_type (void) G_GNUC_CONST;
GType gtk_calendar_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_calendar_new (void);
gboolean gtk_calendar_select_month (GtkCalendar *calendar,

View File

@ -69,7 +69,6 @@
#include "gtkmain.h"
#include "gtkscrolledwindow.h"
#include "gtkstock.h"
#include "gtksignal.h"
#include "gtktreeselection.h"
#include "gtktreeview.h"
#include "gtkvbox.h"
@ -465,26 +464,29 @@ translate_win32_path (GtkFileSelection *filesel)
}
#endif
GtkType
GType
gtk_file_selection_get_type (void)
{
static GtkType file_selection_type = 0;
static GType file_selection_type = 0;
if (!file_selection_type)
{
static const GtkTypeInfo filesel_info =
static const GTypeInfo filesel_info =
{
"GtkFileSelection",
sizeof (GtkFileSelection),
sizeof (GtkFileSelectionClass),
(GtkClassInitFunc) gtk_file_selection_class_init,
(GtkObjectInitFunc) gtk_file_selection_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_file_selection_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkFileSelection),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_file_selection_init,
};
file_selection_type = gtk_type_unique (GTK_TYPE_DIALOG, &filesel_info);
file_selection_type =
g_type_register_static (GTK_TYPE_DIALOG, "GtkFileSelection",
&filesel_info, 0);
}
return file_selection_type;
@ -501,7 +503,7 @@ gtk_file_selection_class_init (GtkFileSelectionClass *class)
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
parent_class = gtk_type_class (GTK_TYPE_DIALOG);
parent_class = g_type_class_peek_parent (class);
gobject_class->finalize = gtk_file_selection_finalize;
gobject_class->set_property = gtk_file_selection_set_property;
@ -692,7 +694,8 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->dir_list), column);
gtk_widget_set_usize (filesel->dir_list, DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
gtk_widget_set_size_request (filesel->dir_list,
DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
g_signal_connect (filesel->dir_list, "row_activated",
G_CALLBACK (gtk_file_selection_dir_activate), filesel);
@ -727,7 +730,8 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->file_list), column);
gtk_widget_set_usize (filesel->file_list, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
gtk_widget_set_size_request (filesel->file_list,
FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
g_signal_connect (filesel->file_list, "row_activated",
G_CALLBACK (gtk_file_selection_file_activate), filesel);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list)), "changed",
@ -779,16 +783,16 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_widget_show (eventbox);
filesel->selection_entry = gtk_entry_new ();
gtk_signal_connect (GTK_OBJECT (filesel->selection_entry), "key_press_event",
(GtkSignalFunc) gtk_file_selection_key_press, filesel);
gtk_signal_connect (GTK_OBJECT (filesel->selection_entry), "insert_text",
(GtkSignalFunc) gtk_file_selection_insert_text, NULL);
gtk_signal_connect_object (GTK_OBJECT (filesel->selection_entry), "focus_in_event",
(GtkSignalFunc) grab_default,
GTK_OBJECT (filesel->ok_button));
gtk_signal_connect_object (GTK_OBJECT (filesel->selection_entry), "activate",
(GtkSignalFunc) gtk_button_clicked,
GTK_OBJECT (filesel->ok_button));
g_signal_connect (filesel->selection_entry, "key_press_event",
G_CALLBACK (gtk_file_selection_key_press), filesel);
g_signal_connect (filesel->selection_entry, "insert_text",
G_CALLBACK (gtk_file_selection_insert_text), NULL);
g_signal_connect_swapped (filesel->selection_entry, "focus_in_event",
G_CALLBACK (grab_default),
filesel->ok_button);
g_signal_connect_swapped (filesel->selection_entry, "activate",
G_CALLBACK (gtk_button_clicked),
filesel->ok_button);
gtk_box_pack_start (GTK_BOX (entry_vbox), filesel->selection_entry, TRUE, TRUE, 0);
gtk_widget_show (filesel->selection_entry);
@ -1023,8 +1027,8 @@ file_selection_setup_dnd (GtkFileSelection *filesel)
drop_types, n_drop_types,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT(filesel), "drag_data_received",
GTK_SIGNAL_FUNC(filenames_dropped), NULL);
g_signal_connect (filesel, "drag_data_received",
G_CALLBACK (filenames_dropped), NULL);
eventbox = gtk_widget_get_parent (filesel->selection_text);
gtk_drag_source_set (eventbox,
@ -1032,10 +1036,8 @@ file_selection_setup_dnd (GtkFileSelection *filesel)
drag_types, n_drag_types,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (eventbox),
"drag_data_get",
GTK_SIGNAL_FUNC (filenames_drag_get),
filesel);
g_signal_connect (eventbox, "drag_data_get",
G_CALLBACK (filenames_drag_get), filesel);
}
GtkWidget*
@ -1043,7 +1045,7 @@ gtk_file_selection_new (const gchar *title)
{
GtkFileSelection *filesel;
filesel = gtk_type_new (GTK_TYPE_FILE_SELECTION);
filesel = g_object_new (GTK_TYPE_FILE_SELECTION, NULL);
gtk_window_set_title (GTK_WINDOW (filesel), title);
gtk_dialog_set_has_separator (GTK_DIALOG (filesel), FALSE);
@ -1061,9 +1063,9 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
if (!filesel->fileop_c_dir)
{
filesel->fileop_c_dir = gtk_button_new_with_mnemonic (_("_New Folder"));
gtk_signal_connect (GTK_OBJECT (filesel->fileop_c_dir), "clicked",
(GtkSignalFunc) gtk_file_selection_create_dir,
(gpointer) filesel);
g_signal_connect (filesel->fileop_c_dir, "clicked",
G_CALLBACK (gtk_file_selection_create_dir),
filesel);
gtk_box_pack_start (GTK_BOX (filesel->button_area),
filesel->fileop_c_dir, TRUE, TRUE, 0);
gtk_widget_show (filesel->fileop_c_dir);
@ -1072,9 +1074,9 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
if (!filesel->fileop_del_file)
{
filesel->fileop_del_file = gtk_button_new_with_mnemonic (_("De_lete File"));
gtk_signal_connect (GTK_OBJECT (filesel->fileop_del_file), "clicked",
(GtkSignalFunc) gtk_file_selection_delete_file,
(gpointer) filesel);
g_signal_connect (filesel->fileop_del_file, "clicked",
G_CALLBACK (gtk_file_selection_delete_file),
filesel);
gtk_box_pack_start (GTK_BOX (filesel->button_area),
filesel->fileop_del_file, TRUE, TRUE, 0);
gtk_widget_show (filesel->fileop_del_file);
@ -1083,9 +1085,9 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
if (!filesel->fileop_ren_file)
{
filesel->fileop_ren_file = gtk_button_new_with_mnemonic (_("_Rename File"));
gtk_signal_connect (GTK_OBJECT (filesel->fileop_ren_file), "clicked",
(GtkSignalFunc) gtk_file_selection_rename_file,
(gpointer) filesel);
g_signal_connect (filesel->fileop_ren_file, "clicked",
G_CALLBACK (gtk_file_selection_rename_file),
filesel);
gtk_box_pack_start (GTK_BOX (filesel->button_area),
filesel->fileop_ren_file, TRUE, TRUE, 0);
gtk_widget_show (filesel->fileop_ren_file);
@ -1319,9 +1321,9 @@ gtk_file_selection_fileop_error (GtkFileSelection *fs,
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_signal_connect_object (GTK_OBJECT (dialog), "response",
(GtkSignalFunc) gtk_widget_destroy,
(gpointer) dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
gtk_widget_show (dialog);
}
@ -1404,9 +1406,9 @@ gtk_file_selection_create_dir (GtkWidget *widget,
/* main dialog */
dialog = gtk_dialog_new ();
fs->fileop_dialog = dialog;
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
(GtkSignalFunc) gtk_file_selection_fileop_destroy,
(gpointer) fs);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_file_selection_fileop_destroy),
fs);
gtk_window_set_title (GTK_WINDOW (dialog), _("New Folder"));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
@ -1437,9 +1439,9 @@ gtk_file_selection_create_dir (GtkWidget *widget,
/* buttons */
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
(gpointer) dialog);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
dialog);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
@ -1449,9 +1451,9 @@ gtk_file_selection_create_dir (GtkWidget *widget,
gtk_widget_grab_focus (fs->fileop_entry);
button = gtk_button_new_with_label (_("Create"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_file_selection_create_dir_confirmed,
(gpointer) fs);
g_signal_connect (button, "clicked",
G_CALLBACK (gtk_file_selection_create_dir_confirmed),
fs);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
@ -1548,9 +1550,9 @@ gtk_file_selection_delete_file (GtkWidget *widget,
GTK_BUTTONS_NONE,
_("Really delete file \"%s\" ?"), filename);
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
(GtkSignalFunc) gtk_file_selection_fileop_destroy,
(gpointer) fs);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_file_selection_fileop_destroy),
fs);
gtk_window_set_title (GTK_WINDOW (dialog), _("Delete File"));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
@ -1562,7 +1564,7 @@ gtk_file_selection_delete_file (GtkWidget *widget,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
g_signal_connect (G_OBJECT (dialog), "response",
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_file_selection_delete_file_response),
fs);
@ -1667,9 +1669,9 @@ gtk_file_selection_rename_file (GtkWidget *widget,
/* main dialog */
fs->fileop_dialog = dialog = gtk_dialog_new ();
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
(GtkSignalFunc) gtk_file_selection_fileop_destroy,
(gpointer) fs);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_file_selection_fileop_destroy),
fs);
gtk_window_set_title (GTK_WINDOW (dialog), _("Rename File"));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
@ -1705,9 +1707,9 @@ gtk_file_selection_rename_file (GtkWidget *widget,
/* buttons */
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
(gpointer) dialog);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
dialog);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
@ -1717,9 +1719,9 @@ gtk_file_selection_rename_file (GtkWidget *widget,
gtk_widget_grab_focus (fs->fileop_entry);
button = gtk_button_new_with_label (_("Rename"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_file_selection_rename_file_confirmed,
(gpointer) fs);
g_signal_connect (button, "clicked",
G_CALLBACK (gtk_file_selection_rename_file_confirmed),
fs);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
@ -1742,7 +1744,7 @@ gtk_file_selection_insert_text (GtkWidget *widget,
if (!filename)
{
gdk_display_beep (gtk_widget_get_display (widget));
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "insert_text");
g_signal_stop_emission_by_name (widget, "insert_text");
return FALSE;
}
@ -1874,9 +1876,9 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
fs->history_list = g_list_append (fs->history_list, callback_arg);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
(GtkSignalFunc) gtk_file_selection_history_callback,
(gpointer) fs);
g_signal_connect (menu_item, "activate",
G_CALLBACK (gtk_file_selection_history_callback),
fs);
gtk_menu_shell_append (GTK_MENU_SHELL (fs->history_menu), menu_item);
gtk_widget_show (menu_item);
}
@ -2112,7 +2114,8 @@ gtk_file_selection_populate (GtkFileSelection *fs,
if (!did_recurse)
{
if (fs->selection_entry)
gtk_entry_set_position (GTK_ENTRY (fs->selection_entry), selection_index);
gtk_editable_set_position (GTK_EDITABLE (fs->selection_entry),
selection_index);
if (fs->selection_entry)
{

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_FILE_SELECTION (gtk_file_selection_get_type ())
#define GTK_FILE_SELECTION(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FILE_SELECTION, GtkFileSelection))
#define GTK_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_SELECTION, GtkFileSelectionClass))
#define GTK_IS_FILE_SELECTION(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FILE_SELECTION))
#define GTK_IS_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_SELECTION))
#define GTK_FILE_SELECTION_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_FILE_SELECTION, GtkFileSelectionClass))
#define GTK_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_SELECTION, GtkFileSelection))
#define GTK_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_SELECTION, GtkFileSelectionClass))
#define GTK_IS_FILE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_SELECTION))
#define GTK_IS_FILE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_SELECTION))
#define GTK_FILE_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_SELECTION, GtkFileSelectionClass))
typedef struct _GtkFileSelection GtkFileSelection;
@ -91,7 +91,7 @@ struct _GtkFileSelectionClass
};
GtkType gtk_file_selection_get_type (void) G_GNUC_CONST;
GType gtk_file_selection_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_file_selection_new (const gchar *title);
void gtk_file_selection_set_filename (GtkFileSelection *filesel,
const gchar *filename);

View File

@ -47,7 +47,6 @@
#include "gtklabel.h"
#include "gtkliststore.h"
#include "gtkrc.h"
#include "gtksignal.h"
#include "gtkstock.h"
#include "gtktable.h"
#include "gtktreeselection.h"
@ -151,41 +150,40 @@ static void gtk_font_selection_preview_changed (GtkWidget *entr
GtkFontSelection *fontsel);
/* Misc. utility functions. */
static void gtk_font_selection_load_font (GtkFontSelection *fs);
static void gtk_font_selection_load_font (GtkFontSelection *fs);
static void gtk_font_selection_update_preview (GtkFontSelection *fs);
/* FontSelectionDialog */
static void gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass);
static void gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag);
static gint gtk_font_selection_dialog_on_configure (GtkWidget *widget,
GdkEventConfigure *event,
GtkFontSelectionDialog *fsd);
static GtkVBoxClass *font_selection_parent_class = NULL;
static GtkWindowClass *font_selection_dialog_parent_class = NULL;
static GtkWindowClass *font_selection_parent_class = NULL;
static GtkVBoxClass *font_selection_dialog_parent_class = NULL;
GtkType
gtk_font_selection_get_type ()
GType
gtk_font_selection_get_type (void)
{
static GtkType font_selection_type = 0;
static GType font_selection_type = 0;
if (!font_selection_type)
{
static const GtkTypeInfo fontsel_type_info =
static const GTypeInfo fontsel_type_info =
{
"GtkFontSelection",
sizeof (GtkFontSelection),
sizeof (GtkFontSelectionClass),
(GtkClassInitFunc) gtk_font_selection_class_init,
(GtkObjectInitFunc) gtk_font_selection_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_font_selection_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkFontSelection),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_font_selection_init,
};
font_selection_type = gtk_type_unique (GTK_TYPE_VBOX,
&fontsel_type_info);
font_selection_type =
g_type_register_static (GTK_TYPE_VBOX, "GtkFontSelection",
&fontsel_type_info, 0);
}
return font_selection_type;
@ -197,7 +195,7 @@ gtk_font_selection_class_init (GtkFontSelectionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
font_selection_parent_class = gtk_type_class (GTK_TYPE_VBOX);
font_selection_parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = gtk_font_selection_set_property;
gobject_class->get_property = gtk_font_selection_get_property;
@ -301,33 +299,33 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0);
#ifdef INCLUDE_FONT_ENTRIES
#ifdef INCLUDE_FONT_ENTRIES
fontsel->font_entry = gtk_entry_new ();
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_entry), FALSE);
gtk_widget_set_usize (fontsel->font_entry, 20, -1);
gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_entry), FALSE);
gtk_widget_set_size_request (fontsel->font_entry, 20, -1);
gtk_widget_show (fontsel->font_entry);
gtk_table_attach (GTK_TABLE (table), fontsel->font_entry, 0, 1, 1, 2,
GTK_FILL, 0, 0, 0);
fontsel->font_style_entry = gtk_entry_new ();
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_style_entry), FALSE);
gtk_widget_set_usize (fontsel->font_style_entry, 20, -1);
gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_style_entry), FALSE);
gtk_widget_set_size_request (fontsel->font_style_entry, 20, -1);
gtk_widget_show (fontsel->font_style_entry);
gtk_table_attach (GTK_TABLE (table), fontsel->font_style_entry, 1, 2, 1, 2,
GTK_FILL, 0, 0, 0);
#endif /* INCLUDE_FONT_ENTRIES */
fontsel->size_entry = gtk_entry_new ();
gtk_widget_set_usize (fontsel->size_entry, 20, -1);
gtk_widget_set_size_request (fontsel->size_entry, 20, -1);
gtk_widget_show (fontsel->size_entry);
gtk_table_attach (GTK_TABLE (table), fontsel->size_entry, 2, 3, 1, 2,
GTK_FILL, 0, 0, 0);
gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "activate",
(GtkSignalFunc) gtk_font_selection_size_activate,
fontsel);
gtk_signal_connect_after (GTK_OBJECT (fontsel->size_entry), "focus_out_event",
(GtkSignalFunc) gtk_font_selection_size_focus_out,
fontsel);
g_signal_connect (fontsel->size_entry, "activate",
G_CALLBACK (gtk_font_selection_size_activate),
fontsel);
g_signal_connect_after (fontsel->size_entry, "focus_out_event",
G_CALLBACK (gtk_font_selection_size_focus_out),
fontsel);
font_label = gtk_label_new_with_mnemonic (_("_Family:"));
gtk_misc_set_alignment (GTK_MISC (font_label), 0.0, 0.5);
@ -373,7 +371,8 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
gtk_widget_set_usize (scrolled_win, FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
gtk_widget_set_size_request (scrolled_win,
FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->family_list);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
@ -406,7 +405,8 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
gtk_widget_set_usize (scrolled_win, FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
gtk_widget_set_size_request (scrolled_win,
FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->face_list);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
@ -437,7 +437,7 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->size_list);
gtk_widget_set_usize (scrolled_win, -1, FONT_LIST_HEIGHT);
gtk_widget_set_size_request (scrolled_win, -1, FONT_LIST_HEIGHT);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_widget_show (fontsel->size_list);
@ -453,9 +453,9 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)), "changed",
G_CALLBACK (gtk_font_selection_select_font), fontsel);
gtk_signal_connect_after (GTK_OBJECT (fontsel->family_list), "map",
GTK_SIGNAL_FUNC (gtk_font_selection_scroll_on_map),
fontsel);
g_signal_connect_after (fontsel->family_list, "map",
G_CALLBACK (gtk_font_selection_scroll_on_map),
fontsel);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)), "changed",
G_CALLBACK (gtk_font_selection_select_style), fontsel);
@ -485,10 +485,10 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), fontsel->preview_entry);
gtk_widget_show (fontsel->preview_entry);
gtk_signal_connect (GTK_OBJECT (fontsel->preview_entry), "changed",
(GtkSignalFunc) gtk_font_selection_preview_changed,
fontsel);
gtk_widget_set_usize (fontsel->preview_entry, -1, INITIAL_PREVIEW_HEIGHT);
g_signal_connect (fontsel->preview_entry, "changed",
G_CALLBACK (gtk_font_selection_preview_changed), fontsel);
gtk_widget_set_size_request (fontsel->preview_entry,
-1, INITIAL_PREVIEW_HEIGHT);
gtk_box_pack_start (GTK_BOX (text_box), fontsel->preview_entry,
TRUE, TRUE, 0);
@ -500,7 +500,7 @@ gtk_font_selection_new ()
{
GtkFontSelection *fontsel;
fontsel = gtk_type_new (GTK_TYPE_FONT_SELECTION);
fontsel = g_object_new (GTK_TYPE_FONT_SELECTION, NULL);
return GTK_WIDGET (fontsel);
}
@ -565,7 +565,7 @@ gtk_font_selection_hierarchy_changed (GtkWidget *widget,
if (previous_toplevel)
g_signal_handlers_disconnect_by_func (previous_toplevel,
(gpointer) fontsel_screen_changed,
fontsel_screen_changed,
widget);
toplevel = gtk_widget_get_toplevel (widget);
@ -718,7 +718,7 @@ gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
if (match_family)
{
set_cursor_to_iter (GTK_TREE_VIEW (fontsel->family_list), &match_row);
#ifdef INCLUDE_FONT_ENTRIES
#ifdef INCLUDE_FONT_ENTRIES
gtk_entry_set_text (GTK_ENTRY (fontsel->font_entry),
pango_font_family_get_name (match_family));
#endif /* INCLUDE_FONT_ENTRIES */
@ -833,7 +833,7 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
fontsel->face = match_face;
if (match_face)
{
#ifdef INCLUDE_FONT_ENTRIES
#ifdef INCLUDE_FONT_ENTRIES
const gchar *str = pango_font_face_get_face_name (fontsel->face);
gtk_entry_set_text (GTK_ENTRY (fontsel->font_style_entry), str);
@ -1078,13 +1078,13 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
new_height = CLAMP (preview_entry->requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
gtk_widget_set_usize (preview_entry, -1, new_height);
gtk_widget_set_size_request (preview_entry, -1, new_height);
/* This sets the preview text, if it hasn't been set already. */
text = gtk_entry_get_text (GTK_ENTRY (preview_entry));
if (strlen (text) == 0)
gtk_entry_set_text (GTK_ENTRY (preview_entry), _(PREVIEW_TEXT));
gtk_entry_set_position (GTK_ENTRY (preview_entry), 0);
gtk_editable_set_position (GTK_EDITABLE (preview_entry), 0);
}
/*****************************************************************************
@ -1238,27 +1238,29 @@ gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
* GtkFontSelectionDialog
*****************************************************************************/
GtkType
GType
gtk_font_selection_dialog_get_type (void)
{
static GtkType font_selection_dialog_type = 0;
static GType font_selection_dialog_type = 0;
if (!font_selection_dialog_type)
{
GtkTypeInfo fontsel_diag_info =
static const GTypeInfo fontsel_diag_info =
{
"GtkFontSelectionDialog",
sizeof (GtkFontSelectionDialog),
sizeof (GtkFontSelectionDialogClass),
(GtkClassInitFunc) gtk_font_selection_dialog_class_init,
(GtkObjectInitFunc) gtk_font_selection_dialog_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_font_selection_dialog_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkFontSelectionDialog),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_font_selection_dialog_init,
};
font_selection_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG,
&fontsel_diag_info);
font_selection_dialog_type =
g_type_register_static (GTK_TYPE_DIALOG, "GtkFontSelectionDialog",
&fontsel_diag_info, 0);
}
return font_selection_dialog_type;
@ -1267,11 +1269,7 @@ gtk_font_selection_dialog_get_type (void)
static void
gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) klass;
font_selection_dialog_parent_class = gtk_type_class (GTK_TYPE_DIALOG);
font_selection_dialog_parent_class = g_type_class_peek_parent (klass);
}
static void
@ -1283,16 +1281,8 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
dialog = GTK_DIALOG (fontseldiag);
fontseldiag->dialog_width = -1;
fontseldiag->auto_resize = TRUE;
gtk_widget_set_events (GTK_WIDGET (fontseldiag), GDK_STRUCTURE_MASK);
gtk_signal_connect (GTK_OBJECT (fontseldiag), "configure_event",
(GtkSignalFunc) gtk_font_selection_dialog_on_configure,
fontseldiag);
gtk_container_set_border_width (GTK_CONTAINER (fontseldiag), 4);
gtk_window_set_policy (GTK_WINDOW (fontseldiag), FALSE, TRUE, TRUE);
gtk_window_set_resizable (GTK_WINDOW (fontseldiag), TRUE);
fontseldiag->main_vbox = dialog->vbox;
@ -1332,7 +1322,7 @@ gtk_font_selection_dialog_new (const gchar *title)
{
GtkFontSelectionDialog *fontseldiag;
fontseldiag = gtk_type_new (GTK_TYPE_FONT_SELECTION_DIALOG);
fontseldiag = g_object_new (GTK_TYPE_FONT_SELECTION_DIALOG, NULL);
if (title)
gtk_window_set_title (GTK_WINDOW (fontseldiag), title);
@ -1371,29 +1361,3 @@ gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
{
gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (fsd->fontsel), text);
}
/* This turns auto-shrink off if the user resizes the width of the dialog.
It also turns it back on again if the user resizes it back to its normal
width. */
static gint
gtk_font_selection_dialog_on_configure (GtkWidget *widget,
GdkEventConfigure *event,
GtkFontSelectionDialog *fsd)
{
/* This sets the initial width. */
if (fsd->dialog_width == -1)
fsd->dialog_width = event->width;
else if (fsd->auto_resize && fsd->dialog_width != event->width)
{
fsd->auto_resize = FALSE;
gtk_window_set_policy (GTK_WINDOW (fsd), FALSE, TRUE, FALSE);
}
else if (!fsd->auto_resize && fsd->dialog_width == event->width)
{
fsd->auto_resize = TRUE;
gtk_window_set_policy (GTK_WINDOW (fsd), FALSE, TRUE, TRUE);
}
return FALSE;
}

View File

@ -41,19 +41,19 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_FONT_SELECTION (gtk_font_selection_get_type ())
#define GTK_FONT_SELECTION(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
#define GTK_FONT_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
#define GTK_IS_FONT_SELECTION(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
#define GTK_IS_FONT_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
#define GTK_FONT_SELECTION_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
#define GTK_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
#define GTK_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
#define GTK_IS_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
#define GTK_IS_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
#define GTK_FONT_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
#define GTK_TYPE_FONT_SELECTION_DIALOG (gtk_font_selection_dialog_get_type ())
#define GTK_FONT_SELECTION_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
#define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
#define GTK_IS_FONT_SELECTION_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
#define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
#define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
#define GTK_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
#define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
#define GTK_IS_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
#define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
#define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
typedef struct _GtkFontSelection GtkFontSelection;
@ -114,7 +114,10 @@ struct _GtkFontSelectionDialog
GtkWidget *cancel_button;
/*< private >*/
/* If the user changes the width of the dialog, we turn auto-shrink off. */
/* If the user changes the width of the dialog, we turn auto-shrink off.
* (Unused now, autoshrink doesn't mean anything anymore -Yosh)
*/
gint dialog_width;
gboolean auto_resize;
};
@ -137,7 +140,7 @@ struct _GtkFontSelectionDialogClass
* see the comments in the GtkFontSelectionDialog functions.
*****************************************************************************/
GtkType gtk_font_selection_get_type (void) G_GNUC_CONST;
GType gtk_font_selection_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_font_selection_new (void);
gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
@ -157,7 +160,7 @@ void gtk_font_selection_set_preview_text (GtkFontSelection *fon
* GtkFontSelection.
*****************************************************************************/
GtkType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
GType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_font_selection_dialog_new (const gchar *title);
/* This returns the X Logical Font Description fontname, or NULL if no font

View File

@ -26,7 +26,6 @@
#include "gtkitem.h"
#include "gtkmarshalers.h"
#include "gtksignal.h"
enum {
@ -49,25 +48,25 @@ static gint gtk_item_leave (GtkWidget *widget,
static guint item_signals[LAST_SIGNAL] = { 0 };
GtkType
GType
gtk_item_get_type (void)
{
static GtkType item_type = 0;
static GType item_type = 0;
if (!item_type)
{
static const GTypeInfo item_info =
{
sizeof (GtkItemClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_item_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkItem),
0, /* n_preallocs */
0, /* n_preallocs */
(GInstanceInitFunc) gtk_item_init,
NULL, /* value_table */
NULL, /* value_table */
};
item_type = g_type_register_static (GTK_TYPE_BIN, "GtkItem",
@ -80,13 +79,12 @@ gtk_item_get_type (void)
static void
gtk_item_class_init (GtkItemClass *class)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GtkObjectClass*) class;
object_class = (GObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
widget_class->realize = gtk_item_realize;
widget_class->enter_notify_event = gtk_item_enter;
widget_class->leave_notify_event = gtk_item_leave;
@ -96,26 +94,29 @@ gtk_item_class_init (GtkItemClass *class)
class->toggle = NULL;
item_signals[SELECT] =
gtk_signal_new ("select",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, select),
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
g_signal_new ("select",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkItemClass, select),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
item_signals[DESELECT] =
gtk_signal_new ("deselect",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, deselect),
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
g_signal_new ("deselect",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkItemClass, deselect),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
item_signals[TOGGLE] =
gtk_signal_new ("toggle",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkItemClass, toggle),
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
g_signal_new ("toggle",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkItemClass, toggle),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_class->activate_signal = item_signals[TOGGLE];
}
@ -128,19 +129,19 @@ gtk_item_init (GtkItem *item)
void
gtk_item_select (GtkItem *item)
{
gtk_signal_emit (GTK_OBJECT (item), item_signals[SELECT]);
g_signal_emit (item, item_signals[SELECT], 0);
}
void
gtk_item_deselect (GtkItem *item)
{
gtk_signal_emit (GTK_OBJECT (item), item_signals[DESELECT]);
g_signal_emit (item, item_signals[DESELECT], 0);
}
void
gtk_item_toggle (GtkItem *item)
{
gtk_signal_emit (GTK_OBJECT (item), item_signals[TOGGLE]);
g_signal_emit (item, item_signals[TOGGLE], 0);
}
@ -176,7 +177,7 @@ gtk_item_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
}
static gint

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_ITEM (gtk_item_get_type ())
#define GTK_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ITEM, GtkItem))
#define GTK_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM, GtkItemClass))
#define GTK_IS_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ITEM))
#define GTK_IS_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM))
#define GTK_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ITEM, GtkItemClass))
#define GTK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ITEM, GtkItem))
#define GTK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM, GtkItemClass))
#define GTK_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ITEM))
#define GTK_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM))
#define GTK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ITEM, GtkItemClass))
typedef struct _GtkItem GtkItem;
@ -69,10 +69,10 @@ struct _GtkItemClass
};
GtkType gtk_item_get_type (void) G_GNUC_CONST;
void gtk_item_select (GtkItem *item);
void gtk_item_deselect (GtkItem *item);
void gtk_item_toggle (GtkItem *item);
GType gtk_item_get_type (void) G_GNUC_CONST;
void gtk_item_select (GtkItem *item);
void gtk_item_deselect (GtkItem *item);
void gtk_item_toggle (GtkItem *item);
#ifdef __cplusplus

View File

@ -30,7 +30,6 @@
#include "config.h"
#include "gtkitemfactory.h"
#include "gtk/gtksignal.h"
#include "gtk/gtkoptionmenu.h"
#include "gtk/gtkmenubar.h"
#include "gtk/gtkmenu.h"
@ -102,26 +101,29 @@ static GQuark quark_type_last_branch = 0;
/* --- functions --- */
GtkType
GType
gtk_item_factory_get_type (void)
{
static GtkType item_factory_type = 0;
static GType item_factory_type = 0;
if (!item_factory_type)
{
static const GtkTypeInfo item_factory_info =
static const GTypeInfo item_factory_info =
{
"GtkItemFactory",
sizeof (GtkItemFactory),
sizeof (GtkItemFactoryClass),
(GtkClassInitFunc) gtk_item_factory_class_init,
(GtkObjectInitFunc) gtk_item_factory_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_item_factory_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkItemFactory),
0,
(GInstanceInitFunc) gtk_item_factory_init,
};
item_factory_type = gtk_type_unique (GTK_TYPE_OBJECT, &item_factory_info);
item_factory_type =
g_type_register_static (GTK_TYPE_OBJECT, "GtkItemFactory",
&item_factory_info, 0);
}
return item_factory_type;
@ -200,7 +202,7 @@ gtk_item_factory_init (GtkItemFactory *ifactory)
* Creates a new #GtkItemFactory.
*/
GtkItemFactory*
gtk_item_factory_new (GtkType container_type,
gtk_item_factory_new (GType container_type,
const gchar *path,
GtkAccelGroup *accel_group)
{
@ -208,7 +210,7 @@ gtk_item_factory_new (GtkType container_type,
g_return_val_if_fail (path != NULL, NULL);
ifactory = gtk_type_new (GTK_TYPE_ITEM_FACTORY);
ifactory = g_object_new (GTK_TYPE_ITEM_FACTORY, NULL);
gtk_item_factory_construct (ifactory, container_type, path, accel_group);
return ifactory;
@ -239,8 +241,8 @@ gtk_item_factory_item_remove_widget (GtkWidget *widget,
GtkItemFactoryItem *item)
{
item->widgets = g_slist_remove (item->widgets, widget);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_path);
g_object_set_qdata (G_OBJECT (widget), quark_item_factory, NULL);
g_object_set_qdata (G_OBJECT (widget), quark_item_path, NULL);
}
/**
@ -291,31 +293,29 @@ gtk_item_factory_add_foreign (GtkWidget *accel_widget,
}
item->widgets = g_slist_prepend (item->widgets, accel_widget);
gtk_signal_connect (GTK_OBJECT (accel_widget),
"destroy",
GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_widget),
item);
g_signal_connect (accel_widget,
"destroy",
G_CALLBACK (gtk_item_factory_item_remove_widget),
item);
/* set the item path for the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (accel_widget),
quark_item_path, item->path);
g_object_set_qdata (G_OBJECT (accel_widget), quark_item_path, item->path);
gtk_widget_set_name (accel_widget, item->path);
if (accel_group)
{
gtk_accel_group_ref (accel_group);
gtk_object_set_data_by_id_full (GTK_OBJECT (accel_widget),
quark_accel_group,
accel_group,
(GtkDestroyNotify) gtk_accel_group_unref);
g_object_ref (accel_group);
g_object_set_qdata_full (G_OBJECT (accel_widget),
quark_accel_group,
accel_group,
g_object_unref);
}
else
gtk_object_set_data_by_id (GTK_OBJECT (accel_widget),
quark_accel_group, NULL);
g_object_set_qdata (G_OBJECT (accel_widget), quark_accel_group, NULL);
/* install defined accelerators
*/
if (gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (accel_widget)))
if (g_signal_lookup ("activate", G_TYPE_FROM_INSTANCE (accel_widget)))
{
if (accel_group)
{
@ -370,20 +370,20 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
data->func_data = callback_data;
data->callback_action = callback_action;
gtk_object_weakref (GTK_OBJECT (widget),
ifactory_cb_data_free,
data);
gtk_signal_connect (GTK_OBJECT (widget),
"activate",
GTK_SIGNAL_FUNC (gtk_item_factory_callback_marshal),
data);
g_object_weak_ref (G_OBJECT (widget),
(GWeakNotify) ifactory_cb_data_free,
data);
g_signal_connect (widget,
"activate",
G_CALLBACK (gtk_item_factory_callback_marshal),
data);
}
/* link the widget into its item-entry
* and keep back pointer on both the item factory and the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_action, GUINT_TO_POINTER (callback_action));
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory, ifactory);
g_object_set_qdata (G_OBJECT (widget), quark_action, GUINT_TO_POINTER (callback_action));
g_object_set_qdata (G_OBJECT (widget), quark_item_factory, ifactory);
if (accelerator)
gtk_accelerator_parse (accelerator, &keyval, &mods);
else
@ -416,7 +416,7 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
*/
void
gtk_item_factory_construct (GtkItemFactory *ifactory,
GtkType container_type,
GType container_type,
const gchar *path,
GtkAccelGroup *accel_group)
{
@ -425,8 +425,8 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
g_return_if_fail (ifactory->accel_group == NULL);
g_return_if_fail (path != NULL);
if (!gtk_type_is_a (container_type, GTK_TYPE_OPTION_MENU))
g_return_if_fail (gtk_type_is_a (container_type, GTK_TYPE_MENU_SHELL));
if (!g_type_is_a (container_type, GTK_TYPE_OPTION_MENU))
g_return_if_fail (g_type_is_a (container_type, GTK_TYPE_MENU_SHELL));
len = strlen (path);
@ -439,7 +439,7 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
if (accel_group)
{
ifactory->accel_group = accel_group;
gtk_accel_group_ref (ifactory->accel_group);
g_object_ref (ifactory->accel_group);
}
else
ifactory->accel_group = gtk_accel_group_new ();
@ -448,7 +448,7 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
ifactory->widget = g_object_connect (gtk_widget_new (container_type, NULL),
"signal::destroy", gtk_widget_destroyed, &ifactory->widget,
NULL);
gtk_object_ref (GTK_OBJECT (ifactory));
g_object_ref (ifactory);
gtk_object_sink (GTK_OBJECT (ifactory));
gtk_item_factory_add_item (ifactory,
@ -520,10 +520,10 @@ gtk_item_factory_destroy (GtkObject *object)
dobj = GTK_OBJECT (ifactory->widget);
gtk_object_ref (dobj);
g_object_ref (dobj);
gtk_object_sink (dobj);
gtk_object_destroy (dobj);
gtk_object_unref (dobj);
g_object_unref (dobj);
ifactory->widget = NULL;
}
@ -534,8 +534,8 @@ gtk_item_factory_destroy (GtkObject *object)
GSList *link;
for (link = item->widgets; link; link = link->next)
if (gtk_object_get_data_by_id (link->data, quark_item_factory) == ifactory)
gtk_object_remove_data_by_id (link->data, quark_item_factory);
if (g_object_get_qdata (link->data, quark_item_factory) == ifactory)
g_object_set_qdata (link->data, quark_item_factory, NULL);
}
g_slist_free (ifactory->items);
ifactory->items = NULL;
@ -552,7 +552,7 @@ gtk_item_factory_finalize (GObject *object)
ifactory = GTK_ITEM_FACTORY (object);
gtk_accel_group_unref (ifactory->accel_group);
g_object_unref (ifactory->accel_group);
g_free (ifactory->path);
g_assert (ifactory->widget == NULL);
@ -576,12 +576,13 @@ gtk_item_factory_from_widget (GtkWidget *widget)
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
ifactory = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_factory);
ifactory = g_object_get_qdata (G_OBJECT (widget), quark_item_factory);
if (ifactory == NULL && GTK_IS_MENU_ITEM (widget) &&
GTK_MENU_ITEM (widget)->submenu != NULL)
{
GtkWidget *menu = GTK_MENU_ITEM (widget)->submenu;
ifactory = gtk_object_get_data_by_id (GTK_OBJECT (menu), quark_item_factory);
ifactory = g_object_get_qdata (G_OBJECT (menu), quark_item_factory);
}
return ifactory;
@ -606,13 +607,13 @@ gtk_item_factory_path_from_widget (GtkWidget *widget)
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
path = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_path);
path = g_object_get_qdata (G_OBJECT (widget), quark_item_path);
if (path == NULL && GTK_IS_MENU_ITEM (widget) &&
GTK_MENU_ITEM (widget)->submenu != NULL)
{
GtkWidget *menu = GTK_MENU_ITEM (widget)->submenu;
path = gtk_object_get_data_by_id (GTK_OBJECT (menu), quark_item_path);
path = g_object_get_qdata (G_OBJECT (menu), quark_item_path);
}
return path;
@ -747,8 +748,8 @@ gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
GSList *link;
for (link = item->widgets; link; link = link->next)
if (gtk_object_get_data_by_id (link->data, quark_item_factory) == ifactory &&
gtk_object_get_data_by_id (link->data, quark_action) == GUINT_TO_POINTER (action))
if (g_object_get_qdata (link->data, quark_item_factory) == ifactory &&
g_object_get_qdata (link->data, quark_action) == GUINT_TO_POINTER (action))
return link->data;
}
@ -949,7 +950,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gchar *path;
gchar *accelerator;
guint type_id;
GtkType type;
GType type;
gchar *item_type_path;
GtkStockItem stock_item;
@ -968,7 +969,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
else
{
item_type_path = entry->item_type;
type_id = gtk_object_data_try_key (item_type_path);
type_id = g_quark_try_string (item_type_path);
}
radio_group = NULL;
@ -1002,7 +1003,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (radio_link && GTK_IS_RADIO_MENU_ITEM (radio_link))
{
type = GTK_TYPE_RADIO_MENU_ITEM;
radio_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (radio_link));
radio_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radio_link));
}
else
{
@ -1090,7 +1091,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gtk_widget_show (image);
}
if (pixbuf)
g_object_unref (G_OBJECT (pixbuf));
g_object_unref (pixbuf);
}
if (type_id == quark_type_stock_item)
{
@ -1285,7 +1286,7 @@ gtk_item_factories_path_delete (const gchar *ifactory_path,
widget = slist->data;
widget_list = g_slist_prepend (widget_list, widget);
gtk_widget_ref (widget);
g_object_ref (widget);
}
for (slist = widget_list; slist; slist = slist->next)
@ -1294,7 +1295,7 @@ gtk_item_factories_path_delete (const gchar *ifactory_path,
widget = slist->data;
gtk_widget_destroy (widget);
gtk_widget_unref (widget);
g_object_unref (widget);
}
g_slist_free (widget_list);
}
@ -1426,7 +1427,7 @@ gtk_item_factory_popup_data_from_widget (GtkWidget *widget)
ifactory = gtk_item_factory_from_widget (widget);
if (ifactory)
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
return g_object_get_qdata (G_OBJECT (ifactory), quark_popup_data);
return NULL;
}
@ -1445,17 +1446,17 @@ gtk_item_factory_popup_data (GtkItemFactory *ifactory)
{
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
return g_object_get_qdata (G_OBJECT (ifactory), quark_popup_data);
}
static void
ifactory_delete_popup_data (GtkObject *object,
GtkItemFactory *ifactory)
{
gtk_signal_disconnect_by_func (object,
GTK_SIGNAL_FUNC (ifactory_delete_popup_data),
ifactory);
gtk_object_remove_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
g_signal_handlers_disconnect_by_func (object,
ifactory_delete_popup_data,
ifactory);
g_object_set_qdata (G_OBJECT (ifactory), quark_popup_data, NULL);
}
/**
@ -1507,15 +1508,15 @@ gtk_item_factory_popup_with_data (GtkItemFactory *ifactory,
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
g_return_if_fail (GTK_IS_MENU (ifactory->widget));
mpos = gtk_object_get_data_by_id (GTK_OBJECT (ifactory->widget), quark_if_menu_pos);
mpos = g_object_get_qdata (G_OBJECT (ifactory->widget), quark_if_menu_pos);
if (!mpos)
{
mpos = g_new0 (MenuPos, 1);
gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory->widget),
quark_if_menu_pos,
mpos,
g_free);
g_object_set_qdata_full (G_OBJECT (ifactory->widget),
quark_if_menu_pos,
mpos,
g_free);
}
mpos->x = x;
@ -1523,14 +1524,14 @@ gtk_item_factory_popup_with_data (GtkItemFactory *ifactory,
if (popup_data != NULL)
{
gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory),
quark_popup_data,
popup_data,
destroy);
gtk_signal_connect (GTK_OBJECT (ifactory->widget),
"selection-done",
GTK_SIGNAL_FUNC (ifactory_delete_popup_data),
ifactory);
g_object_set_qdata_full (G_OBJECT (ifactory),
quark_popup_data,
popup_data,
destroy);
g_signal_connect (ifactory->widget,
"selection-done",
G_CALLBACK (ifactory_delete_popup_data),
ifactory);
}
gtk_menu_popup (GTK_MENU (ifactory->widget),

View File

@ -54,11 +54,11 @@ typedef void (*GtkItemFactoryCallback1) (gpointer callback_data,
GtkWidget *widget);
#define GTK_TYPE_ITEM_FACTORY (gtk_item_factory_get_type ())
#define GTK_ITEM_FACTORY(object) (GTK_CHECK_CAST ((object), GTK_TYPE_ITEM_FACTORY, GtkItemFactory))
#define GTK_ITEM_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM_FACTORY, GtkItemFactoryClass))
#define GTK_IS_ITEM_FACTORY(object) (GTK_CHECK_TYPE ((object), GTK_TYPE_ITEM_FACTORY))
#define GTK_IS_ITEM_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM_FACTORY))
#define GTK_ITEM_FACTORY_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ITEM_FACTORY, GtkItemFactoryClass))
#define GTK_ITEM_FACTORY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ITEM_FACTORY, GtkItemFactory))
#define GTK_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM_FACTORY, GtkItemFactoryClass))
#define GTK_IS_ITEM_FACTORY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ITEM_FACTORY))
#define GTK_IS_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM_FACTORY))
#define GTK_ITEM_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ITEM_FACTORY, GtkItemFactoryClass))
typedef struct _GtkItemFactory GtkItemFactory;
@ -133,16 +133,16 @@ struct _GtkItemFactoryItem
};
GtkType gtk_item_factory_get_type (void) G_GNUC_CONST;
GType gtk_item_factory_get_type (void) G_GNUC_CONST;
/* `container_type' must be of GTK_TYPE_MENU_BAR, GTK_TYPE_MENU,
* or GTK_TYPE_OPTION_MENU.
*/
GtkItemFactory* gtk_item_factory_new (GtkType container_type,
GtkItemFactory* gtk_item_factory_new (GType container_type,
const gchar *path,
GtkAccelGroup *accel_group);
void gtk_item_factory_construct (GtkItemFactory *ifactory,
GtkType container_type,
GType container_type,
const gchar *path,
GtkAccelGroup *accel_group);