Merge branch 'master' into open-with-dialog

Conflicts:
	docs/reference/gtk/gtk3-sections.txt
	gtk/gtk.symbols
This commit is contained in:
Cosimo Cecchi 2010-11-30 16:27:28 +01:00
commit cb916f2746
106 changed files with 9088 additions and 10666 deletions

47
NEWS
View File

@ -1,3 +1,50 @@
Overview of Changes from GTK+ 2.91.4 to 2.91.5
==============================================
* GtkSwitch: a new widget that provides switch-like on/off functionality
* Deprecations and cleanups:
- GtkCallbackMarshal and GtkFunction have been deprecated
- gtk_init_add has been removed
- The ::size-request signal has been removed
- GtkRuler has been removed
* The default value for the GtkBox::fill property has been changed
back to TRUE
* Bugs fixed:
613942 Deprecate GtkRuler, GtkVruler and GtkHRuler
629955 Deprecate / remove gtk_main and gtk_init_add / remove* API
633324 Stop invoking size-request completely
633896 Printing: Use XDG_DOCUMENTS_DIR as the default location...
634474 infinite loop in gtk_icon_view_accessible_set_adjustment
634558 Selecting "Search" should focus text box for keyboard entry
634592 GtkNotebook doesn't expand (in a typical GtkDialog)
634697 gdk: Add XSetting for "gtk-cursor-blink-timeout"
634821 Fix a BadMatch when create an icon pixmap for an ARGB visual
634987 add a switch widget
635175 Leak in gtk_plug_realize
635253 GtkRadioButton constructors don't mark group as "allow-none"
635307 iconcache: Ensure we don't lose data on power loss
635380 gdk_event_apply_filters is unsafe against changes in filter list
635588 clicking URL to be opened freezes the application for 3-5 seconds
635693 Bad pointer grab bug with GtkMenu/GtkComboBox
635879 Change the gdk_rgba_parse() function to be usable from bindings
* Updated translations:
Arabic
British English
Catalan
Czech
German
Hungarian
Indonesian
Norwegian bokmål
Romanian
Thai
Uyghur
Overview of Changes from GTK+ 2.91.3 to 2.91.4
==============================================

View File

@ -10,7 +10,7 @@
m4_define([gtk_major_version], [2])
m4_define([gtk_minor_version], [91])
m4_define([gtk_micro_version], [5])
m4_define([gtk_micro_version], [6])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@ -61,8 +61,8 @@ cflags_set=${CFLAGS+set}
AM_INIT_AUTOMAKE([1.10 no-define -Wno-portability dist-bzip2])
AM_MAINTAINER_MODE([enable])
# Support silent build rules, requires at least automake-1.11. Enable
# by either passing --enable-silent-rules to configure or passing V=0
# Support silent build rules, requires at least automake-1.11. Disable
# by either passing --disable-silent-rules to configure or passing V=1
# to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

View File

@ -437,7 +437,26 @@ do_combobox (GtkWidget *do_widget)
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry);
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible");
gtk_container_add (GTK_CONTAINER (box), combo);
entry = gtk_entry_new ();
g_object_bind_property (combo, "active-id",
entry, "text",
G_BINDING_BIDIRECTIONAL);
gtk_container_add (GTK_CONTAINER (box), entry);
}
if (!gtk_widget_get_visible (window))

View File

@ -322,7 +322,8 @@ HTML_IMAGES = \
$(srcdir)/images/layout-tblr.png \
$(srcdir)/images/layout-tbrl.png \
$(srcdir)/images/window-default.png \
$(srcdir)/images/hello-world.png
$(srcdir)/images/hello-world.png \
$(srcdir)/images/switch.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=--extra-dir=../gdk/html \

View File

@ -97,6 +97,7 @@
<xi:include href="xml/gtklinkbutton.xml" />
<xi:include href="xml/gtkscalebutton.xml" />
<xi:include href="xml/gtkvolumebutton.xml" />
<xi:include href="xml/gtkswitch.xml" />
</chapter>
<chapter id="NumericEntry">
@ -287,13 +288,6 @@
<xi:include href="xml/gtksocket.xml" />
</chapter>
<chapter id="SpecialObjects">
<title>Special-purpose features</title>
<xi:include href="xml/gtkruler.xml" />
<xi:include href="xml/gtkhruler.xml" />
<xi:include href="xml/gtkvruler.xml" />
</chapter>
<chapter id="RecentDocuments">
<title>Recently Used Documents</title>
<xi:include href="xml/gtkrecentmanager.xml" />

View File

@ -371,6 +371,8 @@ gtk_assistant_add_action_widget
gtk_assistant_remove_action_widget
gtk_assistant_update_buttons_state
gtk_assistant_commit
gtk_assistant_next_page
gtk_assistant_previous_page
<SUBSECTION Standard>
GtkAssistantClass
@ -417,6 +419,7 @@ GTK_ASPECT_FRAME_CLASS
GTK_IS_ASPECT_FRAME_CLASS
GTK_ASPECT_FRAME_GET_CLASS
<SUBSECTION Private>
GtkAspectFramePrivate
gtk_aspect_frame_get_type
</SECTION>
@ -437,6 +440,7 @@ GTK_BUTTON_BOX_CLASS
GTK_IS_BUTTON_BOX_CLASS
GTK_BUTTON_BOX_GET_CLASS
<SUBSECTION Private>
GtkButtonBoxPrivate
gtk_button_box_get_type
</SECTION>
@ -453,6 +457,7 @@ GTK_BIN_CLASS
GTK_IS_BIN_CLASS
GTK_BIN_GET_CLASS
<SUBSECTION Private>
GtkBinPrivate
gtk_bin_get_type
</SECTION>
@ -478,6 +483,7 @@ GTK_BOX_CLASS
GTK_IS_BOX_CLASS
GTK_BOX_GET_CLASS
<SUBSECTION Private>
GtkBoxPrivate
gtk_box_get_type
</SECTION>
@ -663,6 +669,7 @@ GTK_CHECK_MENU_ITEM_CLASS
GTK_IS_CHECK_MENU_ITEM_CLASS
GTK_CHECK_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkCheckMenuItemPrivate
gtk_check_menu_item_get_type
</SECTION>
@ -715,6 +722,7 @@ GTK_IS_HSV
GTK_IS_HSV_CLASS
GTK_HSV_GET_CLASS
<SUBSECTION Private>
GtkHSVPrivate
gtk_hsv_get_type
</SECTION>
@ -753,6 +761,7 @@ GTK_COLOR_SELECTION_CLASS
GTK_IS_COLOR_SELECTION_CLASS
GTK_COLOR_SELECTION_GET_CLASS
<SUBSECTION Private>
GtkColorSelectionPrivate
gtk_color_selection_get_type
</SECTION>
@ -770,6 +779,7 @@ GTK_COLOR_SELECTION_DIALOG_CLASS
GTK_IS_COLOR_SELECTION_DIALOG_CLASS
GTK_COLOR_SELECTION_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkColorSelectionDialogPrivate
gtk_color_selection_dialog_get_type
</SECTION>
@ -791,6 +801,10 @@ gtk_combo_box_get_active
gtk_combo_box_set_active
gtk_combo_box_get_active_iter
gtk_combo_box_set_active_iter
gtk_combo_box_get_id_column
gtk_combo_box_set_id_column
gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup_for_device
@ -830,9 +844,12 @@ gtk_combo_box_get_type
GtkComboBoxText
gtk_combo_box_text_new
gtk_combo_box_text_new_with_entry
gtk_combo_box_text_append
gtk_combo_box_text_prepend
gtk_combo_box_text_insert
gtk_combo_box_text_append_text
gtk_combo_box_text_insert_text
gtk_combo_box_text_prepend_text
gtk_combo_box_text_insert_text
gtk_combo_box_text_remove
gtk_combo_box_text_remove_all
gtk_combo_box_text_get_active_text
@ -899,6 +916,7 @@ GTK_CONTAINER_CLASS
GTK_IS_CONTAINER_CLASS
GTK_CONTAINER_GET_CLASS
<SUBSECTION Private>
GtkContainerPrivate
gtk_container_get_type
</SECTION>
@ -934,6 +952,7 @@ GTK_DIALOG_CLASS
GTK_IS_DIALOG_CLASS
GTK_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkDialogPrivate
gtk_dialog_get_type
</SECTION>
@ -1359,6 +1378,7 @@ GTK_FIXED_CLASS
GTK_IS_FIXED_CLASS
GTK_FIXED_GET_CLASS
<SUBSECTION Private>
GtkFixedPrivate
GtkFixedChild
gtk_fixed_get_type
</SECTION>
@ -1419,6 +1439,7 @@ GTK_FONT_SELECTION_CLASS
GTK_IS_FONT_SELECTION_CLASS
GTK_FONT_SELECTION_GET_CLASS
<SUBSECTION Private>
GtkFontSelectionPrivate
gtk_font_selection_get_type
</SECTION>
@ -1443,6 +1464,7 @@ GTK_FONT_SELECTION_DIALOG_CLASS
GTK_IS_FONT_SELECTION_DIALOG_CLASS
GTK_FONT_SELECTION_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkFontSelectionDialogPrivate
gtk_font_selection_dialog_get_type
</SECTION>
@ -1467,6 +1489,7 @@ GTK_FRAME_CLASS
GTK_IS_FRAME_CLASS
GTK_FRAME_GET_CLASS
<SUBSECTION Private>
GtkFramePrivate
gtk_frame_get_type
</SECTION>
@ -1490,6 +1513,7 @@ GTK_HANDLE_BOX_CLASS
GTK_IS_HANDLE_BOX_CLASS
GTK_HANDLE_BOX_GET_CLASS
<SUBSECTION Private>
GtkHandleBoxPrivate
gtk_handle_box_get_type
</SECTION>
@ -1541,22 +1565,6 @@ GTK_HPANED_GET_CLASS
gtk_hpaned_get_type
</SECTION>
<SECTION>
<FILE>gtkhruler</FILE>
<TITLE>GtkHRuler</TITLE>
GtkHRuler
gtk_hruler_new
<SUBSECTION Standard>
GTK_HRULER
GTK_IS_HRULER
GTK_TYPE_HRULER
GTK_HRULER_CLASS
GTK_IS_HRULER_CLASS
GTK_HRULER_GET_CLASS
<SUBSECTION Private>
gtk_hruler_get_type
</SECTION>
<SECTION>
<FILE>gtkhscale</FILE>
<TITLE>GtkHScale</TITLE>
@ -1724,6 +1732,7 @@ GTK_IMAGE_CLASS
GTK_IS_IMAGE_CLASS
GTK_IMAGE_GET_CLASS
<SUBSECTION Private>
GtkImagePrivate
gtk_image_get_type
GtkImageIconSetData
GtkImageImageData
@ -1759,6 +1768,7 @@ GTK_IS_IMAGE_MENU_ITEM
GTK_IS_IMAGE_MENU_ITEM_CLASS
GTK_TYPE_IMAGE_MENU_ITEM
<SUBSECTION Private>
GtkImageMenuItemPrivate
gtk_image_menu_item_get_type
</SECTION>
@ -1805,6 +1815,7 @@ GTK_IM_CONTEXT_SIMPLE_CLASS
GTK_IS_IM_CONTEXT_SIMPLE_CLASS
GTK_IM_CONTEXT_SIMPLE_GET_CLASS
<SUBSECTION Private>
GtkIMContextSimplePrivate
gtk_im_context_simple_get_type
</SECTION>
@ -1845,6 +1856,7 @@ GTK_IS_INVISIBLE_CLASS
GTK_INVISIBLE_GET_CLASS
<SUBSECTION Private>
gtk_invisible_get_type
GtkInvisiblePrivate
</SECTION>
<SECTION>
@ -1904,6 +1916,7 @@ GTK_IS_LABEL_CLASS
GTK_LABEL_GET_CLASS
<SUBSECTION Private>
gtk_label_get_type
GtkLabelPrivate
GtkLabelSelectionInfo
</SECTION>
@ -1929,6 +1942,7 @@ GTK_LAYOUT_CLASS
GTK_IS_LAYOUT_CLASS
GTK_LAYOUT_GET_CLASS
<SUBSECTION Private>
GtkLayoutPrivate
gtk_layout_get_type
</SECTION>
@ -2466,6 +2480,7 @@ GTK_IS_RANGE_CLASS
GTK_RANGE_GET_CLASS
<SUBSECTION Private>
gtk_range_get_type
GtkRangePrivate
GtkRangeLayout
GtkRangeStepTimer
</SECTION>
@ -2687,28 +2702,6 @@ GtkRecentActionPrivate
gtk_recent_action_get_type
</SECTION>
<SECTION>
<FILE>gtkruler</FILE>
<TITLE>GtkRuler</TITLE>
GtkRuler
GtkRulerMetric
gtk_ruler_new
gtk_ruler_set_metric
gtk_ruler_set_range
gtk_ruler_get_metric
gtk_ruler_get_range
<SUBSECTION Standard>
GTK_RULER
GTK_IS_RULER
GTK_TYPE_RULER
GTK_RULER_CLASS
GTK_IS_RULER_CLASS
GTK_RULER_GET_CLASS
<SUBSECTION Private>
GtkRulerPrivate
gtk_ruler_get_type
</SECTION>
<SECTION>
<FILE>gtkscale</FILE>
<TITLE>GtkScale</TITLE>
@ -2770,6 +2763,12 @@ gtk_scrollable_get_hadjustment
gtk_scrollable_set_hadjustment
gtk_scrollable_get_vadjustment
gtk_scrollable_set_vadjustment
GtkScrollablePolicy
gtk_scrollable_get_hscroll_policy
gtk_scrollable_set_hscroll_policy
gtk_scrollable_get_vscroll_policy
gtk_scrollable_set_vscroll_policy
<SUBSECTION Standard>
GtkScrollableIface
@ -2833,6 +2832,7 @@ GTK_IS_SCROLLED_WINDOW_CLASS
GTK_SCROLLED_WINDOW_GET_CLASS
<SUBSECTION Private>
gtk_scrolled_window_get_type
GtkScrolledWindowPrivate
</SECTION>
<SECTION>
@ -2849,6 +2849,7 @@ GTK_IS_SEPARATOR_CLASS
GTK_SEPARATOR_GET_CLASS
<SUBSECTION Private>
gtk_separator_get_type
GtkSeparatorPrivate
</SECTION>
<SECTION>
@ -3546,6 +3547,7 @@ GTK_IS_TOGGLE_BUTTON_CLASS
GTK_TOGGLE_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_toggle_button_get_type
GtkToggleButtonPrivate
</SECTION>
<SECTION>
@ -4418,6 +4420,7 @@ GTK_CELL_RENDERER_CLASS
GTK_IS_CELL_RENDERER_CLASS
GTK_CELL_RENDERER_GET_CLASS
<SUBSECTION Private>
GtkCellRendererPrivate
gtk_cell_renderer_get_type
</SECTION>
@ -4453,6 +4456,7 @@ GTK_IS_CELL_RENDERER_COMBO_CLASS
GTK_CELL_RENDERER_COMBO_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_combo_get_type
GtkCellRendererComboPrivate
</SECTION>
<SECTION>
@ -4503,6 +4507,7 @@ GTK_IS_CELL_RENDERER_PIXBUF_CLASS
GTK_CELL_RENDERER_PIXBUF_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_pixbuf_get_type
GtkCellRendererPixbufPrivate
</SECTION>
<SECTION>
@ -4520,6 +4525,7 @@ GTK_IS_CELL_RENDERER_TEXT_CLASS
GTK_CELL_RENDERER_TEXT_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_text_get_type
GtkCellRendererTextPrivate
</SECTION>
<SECTION>
@ -4543,6 +4549,7 @@ GTK_IS_CELL_RENDERER_TOGGLE_CLASS
GTK_CELL_RENDERER_TOGGLE_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_toggle_get_type
GtkCellRendererTogglePrivate
</SECTION>
<SECTION>
@ -4578,6 +4585,7 @@ GTK_IS_CELL_RENDERER_ACCEL_CLASS
GTK_CELL_RENDERER_ACCEL_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_accel_get_type
GtkCellRendererAccelPrivate
</SECTION>
<SECTION>
@ -4707,22 +4715,6 @@ gtk_vpaned_get_type
GtkPanedPrivate
</SECTION>
<SECTION>
<FILE>gtkvruler</FILE>
<TITLE>GtkVRuler</TITLE>
GtkVRuler
gtk_vruler_new
<SUBSECTION Standard>
GTK_VRULER
GTK_IS_VRULER
GTK_TYPE_VRULER
GTK_VRULER_CLASS
GTK_IS_VRULER_CLASS
GTK_VRULER_GET_CLASS
<SUBSECTION Private>
gtk_vruler_get_type
</SECTION>
<SECTION>
<FILE>gtkvscale</FILE>
<TITLE>GtkVScale</TITLE>
@ -5550,7 +5542,6 @@ GtkExpanderStyle
GtkIMPreeditStyle
GtkIMStatusStyle
GtkJustification
GtkMetricType
GtkMovementStep
GtkOrientation
GtkPackType
@ -5811,6 +5802,7 @@ GTK_IS_ICON_FACTORY_CLASS
GTK_TYPE_ICON_SET
GTK_TYPE_ICON_SOURCE
<SUBSECTION Private>
GtkIconFactoryPrivate
gtk_icon_factory_get_type
gtk_icon_set_get_type
gtk_icon_source_get_type
@ -6399,29 +6391,76 @@ gtk_grid_get_type
</SECTION>
<SECTION>
<FILE>gtkopenwithdialog</FILE>
<TITLE>GtkOpenWithDialog</TITLE>
GtkOpenWithDialog
GtkOpenWithDialogMode
gtk_open_with_dialog_new
gtk_open_with_dialog_new_for_content_type
gtk_open_with_dialog_get_mode
gtk_open_with_dialog_get_selected_application
gtk_open_with_dialog_set_show_set_as_default_button
gtk_open_with_dialog_get_show_set_as_default_button
gtk_open_with_dialog_set_show_other_applications
gtk_open_with_dialog_get_show_other_applications
<FILE>gtkswitch</FILE>
GtkSwitch
gtk_switch_new
gtk_switch_set_active
gtk_switch_get_active
<SUBSECTION Standard>
GtkOpenWithDialogClass
GTK_TYPE_OPEN_WITH_DIALOG
GTK_OPEN_WITH_DIALOG
GTK_OPEN_WITH_DIALOG_CLASS
GTK_IS_OPEN_WITH_DIALOG
GTK_IS_OPEN_WITH_DIALOG_CLASS
GTK_OPEN_WITH_DIALOG_GET_CLASS
GtkSwitchClass
GTK_TYPE_SWITCH
GTK_SWITCH
GTK_SWITCH_CLASS
GTK_IS_SWITCH
GTK_IS_SWITCH_CLASS
GTK_SWITCH_GET_CLASS
<SUBSECTION Private>
GtkOpenWithDialogPrivate
gtk_open_with_dialog_get_type
GtkSwitchPrivate
gtk_switch_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooserdialog</FILE>
<TITLE>GtkAppChooserDialog</TITLE>
GtkAppChooserDialog
gtk_app_chooser_dialog_new
gtk_app_chooser_dialog_new_for_content_type
gtk_app_chooser_dialog_get_widget
<SUBSECTION Standard>
GtkAppChooserDialogClass
GTK_TYPE_APP_CHOOSER_DIALOG
GTK_APP_CHOOSER_DIALOG
GTK_APP_CHOOSER_DIALOG_CLASS
GTK_IS_APP_CHOOSER_DIALOG
GTK_IS_APP_CHOOSER_DIALOG_CLASS
GTK_APP_CHOOSER_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkAppChooserDialogPrivate
gtk_app_chooser_dialog_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooserwidget</FILE>
<TITLE>GtkAppChooserWidget</TITLE>
GtkAppChooserWidget
gtk_app_chooser_widget_new
gtk_app_chooser_widget_set_show_default
gtk_app_chooser_widget_get_show_default
gtk_app_chooser_widget_set_show_recommended
gtk_app_chooser_widget_get_show_recommended
gtk_app_chooser_widget_set_show_fallback
gtk_app_chooser_widget_get_show_fallback
gtk_app_chooser_widget_set_show_other
gtk_app_chooser_widget_get_show_other
gtk_app_chooser_widget_set_show_all
gtk_app_chooser_widget_get_show_all
gtk_app_chooser_widget_set_default_text
gtk_app_chooser_widget_get_default_text
<SUBSECTION Standard>
GtkAppChooserWidgetClass
GTK_TYPE_APP_CHOOSER_WIDGET
GTK_APP_CHOOSER_WIDGET
GTK_APP_CHOOSER_WIDGET_CLASS
GTK_IS_APP_CHOOSER_WIDGET
GTK_IS_APP_CHOOSER_WIDGET_CLASS
GTK_APP_CHOOSER_WIDGET_GET_CLASS
<SUBSECTION Private>
GtkAppChooserWidgetPrivate
gtk_app_chooser_widget_get_type
</SECTION>

View File

@ -66,7 +66,6 @@ gtk_handle_box_get_type
gtk_hbox_get_type
gtk_hbutton_box_get_type
gtk_hpaned_get_type
gtk_hruler_get_type
gtk_hscale_get_type
gtk_hscrollbar_get_type
gtk_hseparator_get_type
@ -122,7 +121,6 @@ gtk_recent_chooser_dialog_get_type
gtk_recent_chooser_menu_get_type
gtk_recent_chooser_widget_get_type
gtk_recent_manager_get_type
gtk_ruler_get_type
gtk_scale_button_get_type
gtk_scale_get_type
gtk_scrollable_get_type
@ -138,6 +136,7 @@ gtk_spin_button_get_type
gtk_spinner_get_type
gtk_statusbar_get_type
gtk_status_icon_get_type
gtk_switch_get_type
gtk_style_get_type
gtk_table_get_type
gtk_tearoff_menu_item_get_type
@ -172,7 +171,6 @@ gtk_vbutton_box_get_type
gtk_viewport_get_type
gtk_volume_button_get_type
gtk_vpaned_get_type
gtk_vruler_get_type
gtk_vscale_get_type
gtk_vscrollbar_get_type
gtk_vseparator_get_type

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -155,15 +155,6 @@ Used for justifying the text inside a #GtkLabel widget. (See also
@GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
@GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
<!-- ##### ENUM GtkMetricType ##### -->
<para>
Used to indicate which metric is used by a #GtkRuler.
</para>
@GTK_PIXELS: Pixels.
@GTK_INCHES: Inches.
@GTK_CENTIMETERS: Centimeters.
<!-- ##### ENUM GtkMovementStep ##### -->
<para>

View File

@ -123,4 +123,7 @@
<link linkend="GtkFileChooserDialog">
<inlinegraphic fileref="filechooser.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkSwitch">
<inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
</link>
</para>

View File

@ -115,6 +115,7 @@ new_widget_info (const char *name,
else
{
info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_has_resize_grip (GTK_WINDOW (info->window), FALSE);
info->include_decorations = FALSE;
gtk_widget_show_all (widget);
gtk_container_add (GTK_CONTAINER (info->window), widget);
@ -159,6 +160,26 @@ create_button (void)
return new_widget_info ("button", align, SMALL);
}
static WidgetInfo *
create_switch (void)
{
GtkWidget *widget;
GtkWidget *align;
GtkWidget *sw;
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
sw = gtk_switch_new ();
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget);
return new_widget_info ("switch", align, SMALL);
}
static WidgetInfo *
create_toggle_button (void)
{
@ -1095,6 +1116,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_page_setup_dialog ());
retval = g_list_prepend (retval, create_print_dialog ());
retval = g_list_prepend (retval, create_volume_button ());
retval = g_list_prepend (retval, create_switch ());
return retval;
}

View File

@ -278,7 +278,7 @@ endif
# This places the generated .def file in srcdir, since it is expected to be there.
# (The one from a tarball is)
gdk.def: gdk.symbols
(echo -e EXPORTS; $(CPP) -P -DALL_FILES -DGDK_WINDOWING_WIN32 -DINCLUDE_VARIABLES - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
(echo -e EXPORTS; $(CPP) -P -DGDK_WINDOWING_WIN32 - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
TESTS_ENVIRONMENT = srcdir="$(srcdir)"
if OS_LINUX

View File

@ -1,5 +1,5 @@
#! /bin/sh
cpp -DINCLUDE_VARIABLES -P -DALL_FILES -DGDK_ENABLE_BROKEN -include ../config.h -include ./gdkconfig.h ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
cpp -P -DGDK_ENABLE_BROKEN -include ../config.h -include ./gdkconfig.h ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
nm -D -g --defined-only .libs/libgdk-x11-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
diff -u expected-abi actual-abi && rm -f expected-abi actual-abi

View File

@ -316,8 +316,8 @@ gdk_get_display_arg_name (void)
* display has previously been set, simply returns that. An internal
* function that should not be used by applications.
*
* Return value: the default display, if it could be opened,
* otherwise %NULL.
* Return value: (transfer none): the default display, if it could be
* opened, otherwise %NULL.
**/
GdkDisplay *
gdk_display_open_default_libgtk_only (void)

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,14 @@
#include "gdkinternals.h"
typedef struct _GdkDeviceKey GdkDeviceKey;
struct _GdkDeviceKey
{
guint keyval;
GdkModifierType modifiers;
};
typedef struct _GdkAxisInfo GdkAxisInfo;
struct _GdkAxisInfo
@ -43,6 +51,12 @@ struct _GdkAxisInfo
struct _GdkDevicePrivate
{
gchar *name;
GdkInputSource source;
GdkInputMode mode;
gboolean has_cursor;
gint num_keys;
GdkDeviceKey *keys;
GdkDeviceManager *device_manager;
GdkDisplay *display;
GdkDevice *associated;
@ -261,13 +275,11 @@ gdk_device_dispose (GObject *object)
priv->axes = NULL;
}
g_free (device->name);
g_free (device->keys);
g_free (device->axes);
g_free (priv->name);
g_free (priv->keys);
device->name = NULL;
device->keys = NULL;
device->axes = NULL;
priv->name = NULL;
priv->keys = NULL;
G_OBJECT_CLASS (gdk_device_parent_class)->dispose (object);
}
@ -290,22 +302,22 @@ gdk_device_set_property (GObject *object,
priv->device_manager = g_value_get_object (value);
break;
case PROP_NAME:
if (device->name)
g_free (device->name);
if (priv->name)
g_free (priv->name);
device->name = g_value_dup_string (value);
priv->name = g_value_dup_string (value);
break;
case PROP_TYPE:
priv->type = g_value_get_enum (value);
break;
case PROP_INPUT_SOURCE:
device->source = g_value_get_enum (value);
priv->source = g_value_get_enum (value);
break;
case PROP_INPUT_MODE:
gdk_device_set_mode (device, g_value_get_enum (value));
break;
case PROP_HAS_CURSOR:
device->has_cursor = g_value_get_boolean (value);
priv->has_cursor = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -334,21 +346,19 @@ gdk_device_get_property (GObject *object,
g_value_set_object (value, priv->associated);
break;
case PROP_NAME:
g_value_set_string (value,
device->name);
g_value_set_string (value, priv->name);
break;
case PROP_TYPE:
g_value_set_enum (value, priv->type);
break;
case PROP_INPUT_SOURCE:
g_value_set_enum (value, device->source);
g_value_set_enum (value, priv->source);
break;
case PROP_INPUT_MODE:
g_value_set_enum (value, device->mode);
g_value_set_enum (value, priv->mode);
break;
case PROP_HAS_CURSOR:
g_value_set_boolean (value,
device->has_cursor);
g_value_set_boolean (value, priv->has_cursor);
break;
case PROP_N_AXES:
g_value_set_uint (value, priv->axes->len);
@ -438,7 +448,7 @@ _gdk_device_allocate_history (GdkDevice *device,
for (i = 0; i < n_events; i++)
result[i] = g_malloc (sizeof (GdkTimeCoord) -
sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->num_axes));
sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->priv->axes->len));
return result;
}
@ -476,7 +486,7 @@ gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->name;
return device->priv->name;
}
/**
@ -494,7 +504,7 @@ gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
return device->has_cursor;
return device->priv->has_cursor;
}
/**
@ -512,7 +522,7 @@ gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->source;
return device->priv->source;
}
/**
@ -528,7 +538,8 @@ gdk_device_set_source (GdkDevice *device,
{
g_return_if_fail (GDK_IS_DEVICE (device));
device->source = source;
device->priv->source = source;
g_object_notify (G_OBJECT (device), "input-source");
}
/**
@ -546,7 +557,7 @@ gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
return device->priv->mode;
}
/**
@ -566,7 +577,7 @@ gdk_device_set_mode (GdkDevice *device,
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
if (device->mode == mode)
if (device->priv->mode == mode)
return TRUE;
if (mode == GDK_MODE_DISABLED &&
@ -575,7 +586,7 @@ gdk_device_set_mode (GdkDevice *device,
/* FIXME: setting has_cursor when mode is window? */
device->mode = mode;
device->priv->mode = mode;
g_object_notify (G_OBJECT (device), "input-mode");
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
@ -584,6 +595,24 @@ gdk_device_set_mode (GdkDevice *device,
return TRUE;
}
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
*
* Returns the number of keys the device currently has.
*
* Returns: the number of keys.
*
* Since: 2.24
**/
gint
gdk_device_get_n_keys (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->priv->num_keys;
}
/**
* gdk_device_get_key:
* @device: a #GdkDevice.
@ -605,17 +634,17 @@ gdk_device_get_key (GdkDevice *device,
GdkModifierType *modifiers)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (index_ < device->num_keys, FALSE);
g_return_val_if_fail (index_ < device->priv->num_keys, FALSE);
if (!device->keys[index_].keyval &&
!device->keys[index_].modifiers)
if (!device->priv->keys[index_].keyval &&
!device->priv->keys[index_].modifiers)
return FALSE;
if (keyval)
*keyval = device->keys[index_].keyval;
*keyval = device->priv->keys[index_].keyval;
if (modifiers)
*modifiers = device->keys[index_].modifiers;
*modifiers = device->priv->keys[index_].modifiers;
return TRUE;
}
@ -637,10 +666,10 @@ gdk_device_set_key (GdkDevice *device,
GdkModifierType modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index_ < device->num_keys);
g_return_if_fail (index_ < device->priv->num_keys);
device->keys[index_].keyval = keyval;
device->keys[index_].modifiers = modifiers;
device->priv->keys[index_].keyval = keyval;
device->priv->keys[index_].modifiers = modifiers;
}
/**
@ -658,10 +687,14 @@ GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
guint index_)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->num_axes, GDK_AXIS_IGNORE);
GdkAxisInfo *info;
return device->axes[index_].use;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->priv->axes->len, GDK_AXIS_IGNORE);
info = &g_array_index (device->priv->axes, GdkAxisInfo, index_);
return info->use;
}
/**
@ -681,29 +714,27 @@ gdk_device_set_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index_ < device->num_axes);
g_return_if_fail (index_ < device->priv->axes->len);
priv = device->priv;
info = &g_array_index (priv->axes, GdkAxisInfo, index_);
info->use = use;
device->axes[index_].use = use;
switch (use)
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
device->axes[index_].min = info->min_axis = 0;
device->axes[index_].max = info->max_axis = 0;
info->min_axis = 0;
info->max_axis = 0;
break;
case GDK_AXIS_XTILT:
case GDK_AXIS_YTILT:
device->axes[index_].min = info->min_axis = -1;
device->axes[index_].max = info->max_axis = 1;
info->min_axis = -1;
info->max_axis = 1;
break;
default:
device->axes[index_].min = info->min_axis = 0;
device->axes[index_].max = info->max_axis = 1;
info->min_axis = 0;
info->max_axis = 1;
break;
}
}
@ -714,8 +745,8 @@ gdk_device_set_axis_use (GdkDevice *device,
*
* Returns the #GdkDisplay to which @device pertains.
*
* Returns: a #GdkDisplay. This memory is owned by GTK+,
* and must not be freed or unreffed.
* Returns: (transfer none): a #GdkDisplay. This memory is owned
* by GTK+, and must not be freed or unreffed.
*
* Since: 3.0
**/
@ -745,7 +776,7 @@ gdk_device_get_display (GdkDevice *device)
* If @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
* returned, as there is no associated device.
*
* Returns: The associated device, or %NULL
* Returns: (transfer none): The associated device, or %NULL
*
* Since: 3.0
**/
@ -817,12 +848,12 @@ gdk_device_get_device_type (GdkDevice *device)
*
* Since: 3.0
**/
guint
gint
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->num_axes;
return device->priv->axes->len;
}
/**
@ -1093,10 +1124,6 @@ _gdk_device_reset_axes (GdkDevice *device)
g_array_remove_index (priv->axes, i);
g_object_notify (G_OBJECT (device), "n-axes");
/* This is done for backwards compatibility */
g_free (device->axes);
device->axes = NULL;
}
guint
@ -1138,16 +1165,7 @@ _gdk_device_add_axis (GdkDevice *device,
}
priv->axes = g_array_append_val (priv->axes, axis_info);
device->num_axes = priv->axes->len;
pos = device->num_axes - 1;
/* This is done for backwards compatibility, since the public
* struct doesn't actually store the device data.
*/
device->axes = g_realloc (device->axes, sizeof (GdkDeviceAxis) * priv->axes->len);
device->axes[pos].use = axis_info.use;
device->axes[pos].min = axis_info.min_axis;
device->axes[pos].max = axis_info.max_axis;
pos = device->priv->axes->len - 1;
g_object_notify (G_OBJECT (device), "n-axes");
@ -1158,11 +1176,11 @@ void
_gdk_device_set_keys (GdkDevice *device,
guint num_keys)
{
if (device->keys)
g_free (device->keys);
if (device->priv->keys)
g_free (device->priv->keys);
device->num_keys = num_keys;
device->keys = g_new0 (GdkDeviceKey, num_keys);
device->priv->num_keys = num_keys;
device->priv->keys = g_new0 (GdkDeviceKey, num_keys);
}
static GdkAxisInfo *
@ -1321,16 +1339,14 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
gdouble value,
gdouble *axis_value)
{
GdkDevicePrivate *priv;
GdkDevicePrivate *priv = device->priv;
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
GdkWindowObject *window_private;
if (device->mode != GDK_MODE_SCREEN)
if (priv->mode != GDK_MODE_SCREEN)
return FALSE;
priv = device->priv;
if (index_ >= priv->axes->len)
return FALSE;

View File

@ -35,9 +35,6 @@ G_BEGIN_DECLS
typedef struct _GdkDevice GdkDevice;
typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceAxis GdkDeviceAxis;
typedef struct _GdkTimeCoord GdkTimeCoord;
/**
@ -141,37 +138,6 @@ typedef enum {
GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;
/**
* GdkDeviceKey:
* @keyval: the keyval to generate when the macro button is pressed.
* If this is 0, no keypress will be generated.
* @modifiers: the modifiers set for the generated key event.
*
* The <structname>GdkDeviceKey</structname> structure contains information
* about the mapping of one device macro button onto a normal X key event.
*/
struct _GdkDeviceKey
{
guint keyval;
GdkModifierType modifiers;
};
/**
* GdkDeviceAxis:
* @use: specifies how the axis is used.
* @min: the minimal value that will be reported by this axis.
* @max: the maximal value that will be reported by this axis.
*
* The <structname>GdkDeviceAxis</structname> structure contains information
* about the range and mapping of a device axis.
*/
struct _GdkDeviceAxis
{
GdkAxisUse use;
gdouble min;
gdouble max;
};
/* We don't allocate each coordinate this big, but we use it to
* be ANSI compliant and avoid accessing past the defined limits.
*/
@ -194,18 +160,6 @@ struct _GdkDevice
{
GObject parent_instance;
/* All fields are read-only */
gchar *GSEAL (name);
GdkInputSource GSEAL (source);
GdkInputMode GSEAL (mode);
gboolean GSEAL (has_cursor); /* TRUE if a X pointer follows device motion */
gint GSEAL (num_axes);
GdkDeviceAxis *GSEAL (axes);
gint GSEAL (num_keys);
GdkDeviceKey *GSEAL (keys);
/*< private >*/
GdkDevicePrivate *priv;
};
@ -224,6 +178,7 @@ GdkInputMode gdk_device_get_mode (GdkDevice *device);
gboolean gdk_device_set_mode (GdkDevice *device,
GdkInputMode mode);
gint gdk_device_get_n_keys (GdkDevice *device);
gboolean gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
@ -253,7 +208,7 @@ gboolean gdk_device_get_history (GdkDevice *device,
void gdk_device_free_history (GdkTimeCoord **events,
gint n_events);
guint gdk_device_get_n_axes (GdkDevice *device);
gint gdk_device_get_n_axes (GdkDevice *device);
GList * gdk_device_list_axes (GdkDevice *device);
gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes,

View File

@ -260,8 +260,9 @@ gdk_device_manager_get_property (GObject *object,
*
* Gets the #GdkDisplay associated to @device_manager.
*
* Returns: the #GdkDisplay to which @device_manager is
* associated to, or #NULL.
* Returns: (transfer none): the #GdkDisplay to which @device_manager is
* associated to, or #NULL. This memory is owned by GDK and
* must not be freed or unreferenced.
*
* Since: 3.0
**/
@ -312,7 +313,8 @@ gdk_device_manager_list_devices (GdkDeviceManager *device_manager,
* You should use this function sheldomly, only in code that isn't triggered by a #GdkEvent
* and there aren't other means to get a meaningful #GdkDevice to operate on.
*
* Returns: The client pointer.
* Returns: (transfer none): The client pointer. This memory is
* owned by GDK and must not be freed or unreferenced.
*
* Since: 3.0
**/

View File

@ -494,7 +494,7 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
{
device = dev->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
gdk_device_ungrab (device, time_);
@ -570,7 +570,7 @@ gdk_display_keyboard_ungrab (GdkDisplay *display,
{
device = dev->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
gdk_device_ungrab (device, time);
@ -654,8 +654,8 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
*
* Returns the core pointer device for the default display.
*
* Return value: the core pointer device; this is owned by the
* display and should not be freed.
* Return value: (transfer none): the core pointer device; this is owned
* by the display and should not be freed.
*
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with pointer device
@ -673,7 +673,7 @@ gdk_device_get_core_pointer (void)
*
* Returns the core pointer device for the given display
*
* Return value: the core pointer device; this is owned by the
* Return value: (transfer none): the core pointer device; this is owned by the
* display and should not be freed.
*
* Since: 2.2
@ -810,7 +810,7 @@ gdk_display_get_device_state (GdkDisplay *display,
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
*
* Returns: the #GdkWindow under the device position, or %NULL.
* Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
*
* Since: 3.0
**/
@ -846,7 +846,7 @@ gdk_display_get_window_at_device_position (GdkDisplay *display,
* #GdkDevice on a particular #GdkDisplay. This is only useful for such low-level tools as
* an event recorder. Applications should never have any reason to use this facility.
*
* Returns: The previous device hook table.
* Returns: (transfer none): The previous device hook table.
*
* Since: 3.0
**/
@ -1067,7 +1067,7 @@ multihead_default_window_at_pointer (GdkDisplay *display,
* event recorder. Applications should never have any
* reason to use this facility.
*
* Return value: the previous pointer hook table
* Return value: (transfer none): the previous pointer hook table
*
* Since: 2.2
*
@ -1209,7 +1209,7 @@ generate_grab_broken_event (GdkWindow *window,
event->grab_broken.implicit = implicit;
event->grab_broken.grab_window = grab_window;
gdk_event_set_device (event, device);
event->grab_broken.keyboard = (device->source == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
event->grab_broken.keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
gdk_event_put (event);
gdk_event_free (event);
@ -1538,7 +1538,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
if (!current_grab->activated)
{
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
}
@ -1566,7 +1566,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
grabs = g_list_delete_link (grabs, grabs);
g_hash_table_insert (display->device_grabs, device, grabs);
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device,
next_grab, current_grab,
time, current_serial);
@ -1663,7 +1663,7 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
g_hash_table_iter_init (&iter, display->device_grabs);
higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
device_is_keyboard = (device->source == GDK_SOURCE_KEYBOARD);
device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
while (g_hash_table_iter_next (&iter, &key, &value))
{
@ -1679,8 +1679,8 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
continue;
/* Discard device if it's not of the same type */
if ((device_is_keyboard && dev->source != GDK_SOURCE_KEYBOARD) ||
(!device_is_keyboard && dev->source == GDK_SOURCE_KEYBOARD))
if ((device_is_keyboard && gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) ||
(!device_is_keyboard && gdk_device_get_source (dev) == GDK_SOURCE_KEYBOARD))
continue;
grab = grabs->data;
@ -1813,7 +1813,7 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
{
device = dev->data;
if (device->source == GDK_SOURCE_MOUSE &&
if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE &&
gdk_display_device_is_grabbed (display, device))
return TRUE;
}
@ -1853,7 +1853,7 @@ gdk_display_device_is_grabbed (GdkDisplay *display,
*
* Returns the #GdkDeviceManager associated to @display.
*
* Returns: A #GdkDeviceManager, or %NULL. This memory is
* Returns: (transfer none): A #GdkDeviceManager, or %NULL. This memory is
* owned by GDK and must not be freed or unreferenced.
*
* Since: 3.0

View File

@ -499,17 +499,16 @@ gdk_event_copy (const GdkEvent *event)
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.axes)
new_event->button.axes = g_memdup (event->button.axes,
sizeof (gdouble) * event->button.device->num_axes);
new_event->button.axes = g_memdup (event->button.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->button.device));
break;
case GDK_MOTION_NOTIFY:
if (event->motion.axes)
new_event->motion.axes = g_memdup (event->motion.axes,
sizeof (gdouble) * event->motion.device->num_axes);
new_event->motion.axes = g_memdup (event->motion.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
break;
default:
break;
}
@ -1278,7 +1277,7 @@ gdk_event_set_screen (GdkEvent *event,
* to which <literal>event->motion.x_root</literal> and
* <literal>event->motion.y_root</literal> are relative.
*
* Return value: the screen for the event
* Return value: (transfer none): the screen for the event
*
* Since: 2.2
**/

View File

@ -59,9 +59,15 @@ struct _GdkColorInfo
guint ref_count;
};
typedef enum {
GDK_EVENT_FILTER_REMOVED = 1 << 0
} GdkEventFilterFlags;
struct _GdkEventFilter {
GdkFilterFunc function;
gpointer data;
GdkEventFilterFlags flags;
guint ref_count;
};
struct _GdkClientFilter {

View File

@ -412,7 +412,7 @@ gdk_keyval_is_lower (guint keyval)
*
* Returns the #GdkKeymap attached to the default display.
*
* Returns: the #GdkKeymap attached to the default display.
* Returns: (transfer none): the #GdkKeymap attached to the default display.
*/
GdkKeymap*
gdk_keymap_get_default (void)

View File

@ -703,8 +703,8 @@ gdk_offscreen_window_set_embedder (GdkWindow *window,
*
* Gets the window that @window is embedded in.
*
* Returns: the embedding #GdkWindow, or %NULL if @window is not an
* embedded offscreen window
* Returns: (transfer none): the embedding #GdkWindow, or %NULL
* if @window is not an mbedded offscreen window
*
* Since: 2.18
*/

View File

@ -317,7 +317,7 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
* is more convenient if you want to keep a context around and track
* changes to the screen's font rendering settings.
*
* Return value: a new #PangoContext for the default display
* Return value: (transfer full): a new #PangoContext for the default display
**/
PangoContext *
gdk_pango_context_get (void)
@ -343,7 +343,7 @@ gdk_pango_context_get (void)
* is more convenient if you want to keep a context around and track
* changes to the screen's font rendering settings.
*
* Return value: a new #PangoContext for @screen
* Return value: (transfer full): a new #PangoContext for @screen
*
* Since: 2.2
**/

View File

@ -115,8 +115,8 @@ parse_rgb_value (const char *str,
/**
* gdk_rgba_parse:
* @spec: the string specifying the color
* @rgba: the #GdkRGBA struct to fill in
* @spec: the string specifying the color
*
* Parses a textual representation of a color, filling in
* the <structfield>red</structfield>, <structfield>green</structfield>,
@ -150,8 +150,8 @@ parse_rgb_value (const char *str,
* Since: 3.0
**/
gboolean
gdk_rgba_parse (const gchar *spec,
GdkRGBA *rgba)
gdk_rgba_parse (GdkRGBA *rgba,
const gchar *spec)
{
gboolean has_alpha;
gdouble r, g, b, a;

View File

@ -48,8 +48,8 @@ struct _GdkRGBA
GdkRGBA * gdk_rgba_copy (GdkRGBA *rgba);
void gdk_rgba_free (GdkRGBA *rgba);
gboolean gdk_rgba_parse (const gchar *spec,
GdkRGBA *rgba);
gboolean gdk_rgba_parse (GdkRGBA *rgba,
const gchar *spec);
guint gdk_rgba_hash (gconstpointer p);
gboolean gdk_rgba_equal (gconstpointer p1,

View File

@ -97,9 +97,9 @@ gdk_selection_owner_set (GdkWindow *owner,
*
* Determines the owner of the given selection.
*
* Returns: if there is a selection owner for this window,
* and it is a window known to the current process,
* the #GdkWindow that owns the selection, otherwise
* Returns: (transfer none): if there is a selection owner for
* this window, and it is a window known to the current
* process, the #GdkWindow that owns the selection, otherwise
* %NULL. Note that the return value may be owned
* by a different process if a foreign window
* was previously created for that window, but

View File

@ -2212,7 +2212,7 @@ gdk_window_get_window_type (GdkWindow *window)
*
* Gets the #GdkVisual describing the pixel format of @window.
*
* Return value: a #GdkVisual
* Return value: (transfer none): a #GdkVisual
*
* Since: 2.24
**/
@ -2234,7 +2234,7 @@ gdk_window_get_visual (GdkWindow *window)
*
* Gets the #GdkScreen associated with a #GdkWindow.
*
* Return value: the #GdkScreen associated with @window
* Return value: (transfer none): the #GdkScreen associated with @window
*
* Since: 2.24
**/
@ -2256,7 +2256,7 @@ gdk_window_get_screen (GdkWindow *window)
*
* Gets the #GdkDisplay associated with a #GdkWindow.
*
* Return value: the #GdkDisplay associated with @window
* Return value: (transfer none): the #GdkDisplay associated with @window
*
* Since: 2.24
**/
@ -2577,13 +2577,18 @@ gdk_window_add_filter (GdkWindow *window,
{
filter = (GdkEventFilter *)tmp_list->data;
if ((filter->function == function) && (filter->data == data))
return;
{
filter->ref_count++;
return;
}
tmp_list = tmp_list->next;
}
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
filter->ref_count = 1;
filter->flags = 0;
if (private)
private->filters = g_list_append (private->filters, filter);
@ -2626,6 +2631,11 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
filter->flags |= GDK_EVENT_FILTER_REMOVED;
filter->ref_count--;
if (filter->ref_count != 0)
return;
if (private)
private->filters = g_list_remove_link (private->filters, node);
else
@ -5120,7 +5130,7 @@ gdk_window_at_pointer (gint *win_x,
* Obtains the root window (parent all other windows are inside)
* for the default display and screen.
*
* Return value: the default root window
* Return value: (transfer none): the default root window
**/
GdkWindow *
gdk_get_default_root_window (void)
@ -5138,8 +5148,8 @@ gdk_get_default_root_window (void)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the newly-created #GdkWindow wrapper for the
* native window or %NULL if the window has been destroyed.
* Return value: (transfer full): the newly-created #GdkWindow wrapper
* for the native window, or %NULL if the window has been destroyed.
**/
GdkWindow *
gdk_window_foreign_new (GdkNativeWindow anid)
@ -8579,7 +8589,7 @@ send_crossing_event (GdkDisplay *display,
}
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER &&
device->mode != GDK_MODE_DISABLED &&
gdk_device_get_mode (device) != GDK_MODE_DISABLED &&
!g_list_find (window->devices_inside, device))
window->devices_inside = g_list_prepend (window->devices_inside, device);
}
@ -8945,7 +8955,7 @@ gdk_pointer_grab (GdkWindow * window,
{
device = dev->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
res = _gdk_windowing_device_grab (device,
@ -9050,7 +9060,7 @@ gdk_keyboard_grab (GdkWindow *window,
{
device = dev->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
res = _gdk_windowing_device_grab (device,
@ -9438,7 +9448,7 @@ proxy_pointer_event (GdkDisplay *display,
event->motion.is_hint = is_hint;
event->motion.device = source_event->motion.device;
event->motion.axes = g_memdup (source_event->motion.axes,
sizeof (gdouble) * source_event->motion.device->num_axes);
sizeof (gdouble) * gdk_device_get_n_axes (source_event->motion.device));
}
}
@ -9547,7 +9557,7 @@ proxy_button_event (GdkEvent *source_event,
event->button.state = state;
event->button.device = source_event->button.device;
event->button.axes = g_memdup (source_event->button.axes,
sizeof (gdouble) * source_event->button.device->num_axes);
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);

View File

@ -132,7 +132,7 @@ gdkconfig.h : gdkconfig.h.win32
gdk.def: gdk.symbols
echo EXPORTS > gdk.def
cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 -DALL_FILES \
cl /EP -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 \
-DG_GNUC_CONST= \
gdk.symbols >> gdk.def

View File

@ -171,19 +171,40 @@ append_event (GdkEvent *event,
static gint
gdk_event_apply_filters (NSEvent *nsevent,
GdkEvent *event,
GList *filters)
GList **filters)
{
GList *tmp_list;
GdkFilterReturn result;
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
tmp_list = tmp_list->next;
GList *node;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (nsevent, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
return result;
}
@ -550,7 +571,7 @@ find_toplevel_for_keyboard_event (NSEvent *nsevent)
GdkDeviceGrabInfo *grab;
GdkDevice *device = l->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source(device) != GDK_SOURCE_KEYBOARD)
continue;
grab = _gdk_display_get_last_device_grab (display, device);
@ -1165,7 +1186,7 @@ gdk_event_translate (GdkEvent *event,
/* Apply global filters */
GdkFilterReturn result;
result = gdk_event_apply_filters (nsevent, event, _gdk_default_filters);
result = gdk_event_apply_filters (nsevent, event, &_gdk_default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
@ -1206,7 +1227,7 @@ gdk_event_translate (GdkEvent *event,
{
g_object_ref (window);
result = gdk_event_apply_filters (nsevent, event, filter_private->filters);
result = gdk_event_apply_filters (nsevent, event, &filter_private->filters);
g_object_unref (window);

View File

@ -228,7 +228,7 @@ _gdk_input_init (void)
{
GdkDevice *device = l->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source(device) == GDK_SOURCE_KEYBOARD)
continue;
_gdk_input_devices = g_list_prepend (_gdk_input_devices, l->data);
@ -245,7 +245,7 @@ _gdk_input_init (void)
{
GdkDevice *device = list->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source(device) != GDK_SOURCE_MOUSE)
continue;
_gdk_display->core_pointer = device;
@ -273,11 +273,7 @@ _gdk_input_exit (void)
if (gdkdev != (GdkDevicePrivate *)_gdk_core_pointer)
{
gdk_device_set_mode ((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
g_free (gdkdev->info.name);
g_free (gdkdev->info.axes);
g_free (gdkdev->info.keys);
g_free (gdkdev);
g_object_unref(gdkdev);
}
}

View File

@ -8,17 +8,17 @@ test_color_parse (void)
GdkRGBA expected;
gboolean res;
res = gdk_rgba_parse ("foo", &color);
res = gdk_rgba_parse (&color, "foo");
g_assert (!res);
res = gdk_rgba_parse ("", &color);
res = gdk_rgba_parse (&color, "");
g_assert (!res);
expected.red = 100/255.;
expected.green = 90/255.;
expected.blue = 80/255.;
expected.alpha = 0.1;
res = gdk_rgba_parse ("rgba(100,90,80,0.1)", &color);
res = gdk_rgba_parse (&color, "rgba(100,90,80,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -26,11 +26,11 @@ test_color_parse (void)
expected.green = 0.3;
expected.blue = 0.2;
expected.alpha = 0.1;
res = gdk_rgba_parse ("rgba(40%,30%,20%,0.1)", &color);
res = gdk_rgba_parse (&color, "rgba(40%,30%,20%,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
res = gdk_rgba_parse ("rgba( 40 % , 30 % , 20 % , 0.1 )", &color);
res = gdk_rgba_parse (&color, "rgba( 40 % , 30 % , 20 % , 0.1 )");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -38,7 +38,7 @@ test_color_parse (void)
expected.green = 0.0;
expected.blue = 0.0;
expected.alpha = 1.0;
res = gdk_rgba_parse ("red", &color);
res = gdk_rgba_parse (&color, "red");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -46,7 +46,7 @@ test_color_parse (void)
expected.green = 0x8080 / 65535.;
expected.blue = 1.0;
expected.alpha = 1.0;
res = gdk_rgba_parse ("#0080ff", &color);
res = gdk_rgba_parse (&color, "#0080ff");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
}
@ -71,7 +71,7 @@ test_color_to_string (void)
orig = g_strdup (setlocale (LC_ALL, NULL));
res = gdk_rgba_to_string (&rgba);
gdk_rgba_parse (res, &out);
gdk_rgba_parse (&out, res);
g_assert (gdk_rgba_equal (&rgba, &out));
setlocale (LC_ALL, "de_DE.utf-8");

View File

@ -319,7 +319,7 @@ gdk_device_win32_grab (GdkDevice *device,
GdkCursor *cursor,
guint32 time_)
{
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
SetCapture (GDK_WINDOW_HWND (window));
return GDK_GRAB_SUCCESS;
@ -333,7 +333,7 @@ gdk_device_win32_ungrab (GdkDevice *device,
display = gdk_device_get_display (device);
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
ReleaseCapture ();
}

View File

@ -322,7 +322,7 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
if (!_gdk_device_wintab_get_window_coords (impl_window, &root_x, &root_y))
return;
for (i = 0; i < device->num_axes; i++)
for (i = 0; i < gdk_device_get_n_axes (device); i++)
{
GdkAxisUse use;

View File

@ -1025,7 +1025,7 @@ fill_key_event_string (GdkEvent *event)
static GdkFilterReturn
apply_event_filters (GdkWindow *window,
MSG *msg,
GList *filters)
GList **filters)
{
GdkFilterReturn result = GDK_FILTER_CONTINUE;
GdkEvent *event;
@ -1043,13 +1043,34 @@ apply_event_filters (GdkWindow *window,
*/
node = _gdk_event_queue_append (_gdk_display, event);
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter *) tmp_list->data;
tmp_list = tmp_list->next;
GList *node;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (msg, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
break;
}
@ -1756,7 +1777,7 @@ gdk_event_translate (MSG *msg,
{
/* Apply global filters */
GdkFilterReturn result = apply_event_filters (NULL, msg, _gdk_default_filters);
GdkFilterReturn result = apply_event_filters (NULL, msg, &_gdk_default_filters);
/* If result is GDK_FILTER_CONTINUE, we continue as if nothing
* happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
@ -1822,7 +1843,7 @@ gdk_event_translate (MSG *msg,
{
/* Apply per-window filters */
GdkFilterReturn result = apply_event_filters (window, msg, ((GdkWindowObject *) window)->filters);
GdkFilterReturn result = apply_event_filters (window, msg, &((GdkWindowObject *) window)->filters);
if (result == GDK_FILTER_REMOVE || result == GDK_FILTER_TRANSLATE)
{

View File

@ -36,54 +36,43 @@
#include <unistd.h>
static char *
get_display_name (GFile *file)
get_display_name (GFile *file,
GFileInfo *info)
{
GFileInfo *info;
char *name, *tmp;
/* This does sync I/O, which isn't ideal.
* It should probably use the NautilusFile machinery
*/
name = NULL;
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, 0, NULL, NULL);
if (info)
{
name = g_strdup (g_file_info_get_display_name (info));
g_object_unref (info);
}
name = g_strdup (g_file_info_get_display_name (info));
if (name == NULL)
{
name = g_file_get_basename (file);
if (!g_utf8_validate (name, -1, NULL))
{
tmp = name;
name =
g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH,
TRUE);
g_free (tmp);
}
{
tmp = name;
name =
g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
g_free (tmp);
}
}
return name;
}
static GIcon *
get_icon (GFile *file)
get_icon (GFile *file,
GFileInfo *info)
{
GFileInfo *info;
GIcon *icon;
icon = NULL;
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_ICON, 0, NULL, NULL);
if (info)
{
icon = g_file_info_get_icon (info);
if (icon)
g_object_ref (icon);
g_object_unref (info);
g_object_ref (icon);
}
return icon;
@ -99,13 +88,13 @@ gicon_to_string (GIcon *icon)
{
file = g_file_icon_get_file (G_FILE_ICON (icon));
if (file)
return g_file_get_path (file);
return g_file_get_path (file);
}
else if (G_IS_THEMED_ICON (icon))
{
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names)
return g_strdup (names[0]);
return g_strdup (names[0]);
}
else if (G_IS_EMBLEMED_ICON (icon))
{
@ -121,11 +110,11 @@ gicon_to_string (GIcon *icon)
static void
end_startup_notification (GdkDisplay *display,
const char *startup_id)
const char *startup_id)
{
gdk_x11_display_broadcast_startup_message (display, "remove",
"ID", startup_id,
NULL);
"ID", startup_id,
NULL);
}
@ -210,19 +199,19 @@ startup_timeout (void *data)
next = tmp->next;
elapsed =
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
if (elapsed >= STARTUP_TIMEOUT_LENGTH)
{
std->contexts = g_slist_remove (std->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
}
{
std->contexts = g_slist_remove (std->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
}
else
{
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
{
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
tmp = next;
}
@ -239,7 +228,7 @@ startup_timeout (void *data)
static void
add_startup_timeout (GdkScreen *screen,
const char *startup_id)
const char *startup_id)
{
StartupTimeoutData *data;
StartupNotificationData *sn_data;
@ -253,7 +242,7 @@ add_startup_timeout (GdkScreen *screen,
data->timeout_id = 0;
g_object_set_data_full (G_OBJECT (screen), "appinfo-startup-data",
data, free_startup_timeout);
data, free_startup_timeout);
}
sn_data = g_new (StartupNotificationData, 1);
@ -265,14 +254,14 @@ add_startup_timeout (GdkScreen *screen,
if (data->timeout_id == 0)
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
startup_timeout, data);
}
char *
_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
GAppInfo *info,
GList *files)
{
static int sequence = 0;
GdkAppLaunchContextPrivate *priv;
@ -288,6 +277,7 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
GIcon *icon;
guint32 timestamp;
char *startup_id;
GFileInfo *fileinfo;
priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
@ -307,20 +297,32 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
screen = gdk_display_get_default_screen (display);
}
fileinfo = NULL;
files_count = g_list_length (files);
if (files_count == 0)
description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info));
{
description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info));
}
else if (files_count == 1)
{
gchar *display_name = get_display_name (files->data);
gchar *display_name;
if (g_file_is_native (files->data))
fileinfo = g_file_query_info (files->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_ICON,
0, NULL, NULL);
display_name = get_display_name (files->data, fileinfo);
description = g_strdup_printf (_("Opening %s"), display_name);
g_free (display_name);
}
else
description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
"Opening %d Item",
"Opening %d Items",
files_count), files_count);
"Opening %d Item",
"Opening %d Items",
files_count), files_count);
icon_name = NULL;
if (priv->icon_name)
@ -330,18 +332,18 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
icon = NULL;
if (priv->icon != NULL)
icon = g_object_ref (priv->icon);
icon = g_object_ref (priv->icon);
else if (files_count == 1)
icon = get_icon (files->data);
icon = get_icon (files->data, fileinfo);
if (icon == NULL)
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);
}
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);
}
if (icon)
icon_name = gicon_to_string (icon);
icon_name = gicon_to_string (icon);
g_object_unref (icon);
}
@ -353,7 +355,7 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
timestamp = gdk_x11_display_get_user_time (display);
screen_str = g_strdup_printf ("%d", gdk_screen_get_number (screen));
if (priv->workspace > -1)
if (priv->workspace > -1)
workspace_str = g_strdup_printf ("%d", priv->workspace);
else
workspace_str = NULL;
@ -364,30 +366,31 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
application_id = NULL;
startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
g_get_prgname (),
(unsigned long)getpid (),
g_get_host_name (),
binary_name,
sequence++,
(unsigned long)timestamp);
g_get_prgname (),
(unsigned long)getpid (),
g_get_host_name (),
binary_name,
sequence++,
(unsigned long)timestamp);
gdk_x11_display_broadcast_startup_message (display, "new",
"ID", startup_id,
"NAME", g_app_info_get_name (info),
"SCREEN", screen_str,
"BIN", binary_name,
"ICON", icon_name,
"DESKTOP", workspace_str,
"DESCRIPTION", description,
"WMCLASS", NULL, /* FIXME */
"APPLICATION_ID", application_id,
NULL);
"ID", startup_id,
"NAME", g_app_info_get_name (info),
"SCREEN", screen_str,
"BIN", binary_name,
"ICON", icon_name,
"DESKTOP", workspace_str,
"DESCRIPTION", description,
"WMCLASS", NULL, /* FIXME */
"APPLICATION_ID", application_id,
NULL);
g_free (description);
g_free (screen_str);
g_free (workspace_str);
g_free (icon_name);
if (fileinfo)
g_object_unref (fileinfo);
add_startup_timeout (screen, startup_id);
@ -396,8 +399,8 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
void
_gdk_windowing_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
_gdk_windowing_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
{
GdkAppLaunchContextPrivate *priv;
GdkScreen *screen;
@ -419,22 +422,22 @@ _gdk_windowing_launch_failed (GAppLaunchContext *context,
if (data)
{
for (l = data->contexts; l != NULL; l = l->next)
{
sn_data = l->data;
if (strcmp (startup_notify_id, sn_data->startup_id) == 0)
{
data->contexts = g_slist_remove (data->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
break;
}
}
{
sn_data = l->data;
if (strcmp (startup_notify_id, sn_data->startup_id) == 0)
{
data->contexts = g_slist_remove (data->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
break;
}
}
if (data->contexts == NULL)
{
g_source_remove (data->timeout_id);
data->timeout_id = 0;
}
{
g_source_remove (data->timeout_id);
data->timeout_id = 0;
}
}
}

View File

@ -362,7 +362,7 @@ gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
*
* Returns the display on which the #GdkCursor is defined.
*
* Returns: the #GdkDisplay associated to @cursor
* Returns: (transfer none): the #GdkDisplay associated to @cursor
*
* Since: 2.2
*/
@ -387,7 +387,7 @@ gdk_cursor_get_display (GdkCursor *cursor)
* on the cursor, GDK may not be able to obtain the image data. In this
* case, %NULL is returned.
*
* Returns: a #GdkPixbuf representing @cursor, or %NULL
* Returns: (transfer full): a #GdkPixbuf representing @cursor, or %NULL
*
* Since: 2.8
*/

View File

@ -313,7 +313,7 @@ gdk_device_core_grab (GdkDevice *device,
else
xconfine_to = GDK_WINDOW_XID (confine_to);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
/* Device is a keyboard */
status = XGrabKeyboard (GDK_DISPLAY_XDISPLAY (display),
@ -371,7 +371,7 @@ gdk_device_core_ungrab (GdkDevice *device,
display = gdk_device_get_display (device);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
XUngrabKeyboard (GDK_DISPLAY_XDISPLAY (display), time_);
else
XUngrabPointer (GDK_DISPLAY_XDISPLAY (display), time_);

View File

@ -155,7 +155,8 @@ gdk_device_xi_constructed (GObject *object)
device->device_id);
if (gdk_error_trap_pop ())
g_warning ("Device %s can't be opened", GDK_DEVICE (device)->name);
g_warning ("Device %s can't be opened",
gdk_device_get_name (GDK_DEVICE (device)));
if (G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed)
G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed (object);
@ -556,10 +557,11 @@ gdk_device_xi_update_axes (GdkDevice *device,
int i;
device_xi = GDK_DEVICE_XI (device);
g_return_if_fail (first_axis >= 0 && first_axis + axes_count <= device->num_axes);
g_return_if_fail (first_axis >= 0 &&
first_axis + axes_count <= gdk_device_get_n_axes (device));
if (!device_xi->axis_data)
device_xi->axis_data = g_new0 (gint, device->num_axes);
device_xi->axis_data = g_new0 (gint, gdk_device_get_n_axes (device));
for (i = 0; i < axes_count; i++)
device_xi->axis_data[first_axis + i] = axis_data[i];
@ -577,6 +579,7 @@ gdk_device_xi_translate_axes (GdkDevice *device,
GdkWindow *impl_window;
gdouble root_x, root_y;
gdouble temp_x, temp_y;
gint n_axes;
gint i;
device_xi = GDK_DEVICE_XI (device);
@ -586,7 +589,9 @@ gdk_device_xi_translate_axes (GdkDevice *device,
if (!gdk_device_xi_get_window_info (impl_window, &root_x, &root_y))
return;
for (i = 0; i < device->num_axes; i++)
n_axes = gdk_device_get_n_axes (device);
for (i = 0; i < n_axes; i++)
{
GdkAxisUse use;
@ -596,7 +601,7 @@ gdk_device_xi_translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window,
i, axis_data[i],
&axes[i]);

View File

@ -205,7 +205,7 @@ gdk_device_xi2_get_state (GdkDevice *device,
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window, j, value, &axes[j]);
else
{

View File

@ -441,7 +441,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->button.x_root = (gdouble) xdbe->x_root;
event->button.y_root = (gdouble) xdbe->y_root;
event->button.axes = g_new0 (gdouble, device->num_axes);
event->button.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
gdk_device_xi_update_axes (device, xdbe->axes_count,
xdbe->first_axis, xdbe->axis_data);
gdk_device_xi_translate_axes (device, window,
@ -487,13 +487,15 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
xdke->keycode));
if (xdke->keycode < device_xi->min_keycode ||
xdke->keycode >= device_xi->min_keycode + device->num_keys)
xdke->keycode >= device_xi->min_keycode + gdk_device_get_n_keys (device))
{
g_warning ("Invalid device key code received");
return FALSE;
}
event->key.keyval = device->keys[xdke->keycode - device_xi->min_keycode].keyval;
gdk_device_get_key (device, xdke->keycode - device_xi->min_keycode,
&event->key.keyval,
&event->key.state);
if (event->key.keyval == 0)
{
@ -509,8 +511,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->key.window = g_object_ref (window);
event->key.time = xdke->time;
event->key.state = translate_state (xdke->state, xdke->device_state)
| device->keys[xdke->keycode - device_xi->min_keycode].modifiers;
event->key.state |= translate_state (xdke->state, xdke->device_state);
/* Add a string translation for the key event */
if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))
@ -552,7 +553,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->motion.x_root = (gdouble) xdme->x_root;
event->motion.y_root = (gdouble) xdme->y_root;
event->motion.axes = g_new0 (gdouble, device->num_axes);
event->motion.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
gdk_device_xi_update_axes (device, xdme->axes_count,
xdme->first_axis, xdme->axis_data);
gdk_device_xi_translate_axes (device, window,
@ -626,7 +627,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
for (i = 0; i < xdse->num_classes; i++)
{
if (input_class->class == ValuatorClass)
gdk_device_xi_update_axes (device, device->num_axes, 0,
gdk_device_xi_update_axes (device, gdk_device_get_n_axes (device), 0,
((XValuatorState *)input_class)->valuators);
input_class = (XInputClass *)(((char *)input_class)+input_class->length);

View File

@ -268,7 +268,7 @@ add_device (GdkDeviceManagerXI2 *device_manager,
else if (dev->use == XIFloatingSlave)
device_manager->floating_devices = g_list_append (device_manager->floating_devices, device);
else
g_warning ("Unhandled device: %s\n", device->name);
g_warning ("Unhandled device: %s\n", gdk_device_get_name (device));
if (emit_signal)
g_signal_emit_by_name (device_manager, "device-added", device);
@ -755,7 +755,7 @@ translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window, i, val, &axes[i]);
else
{
@ -1010,7 +1010,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->button.window,
&xev->valuators);
if (event->button.device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (event->button.device) == GDK_MODE_WINDOW)
{
GdkDevice *device = event->button.device;
@ -1061,7 +1061,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->motion.window,
&xev->valuators);
if (event->motion.device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (event->motion.device) == GDK_MODE_WINDOW)
{
GdkDevice *device = event->motion.device;

View File

@ -1152,7 +1152,7 @@ _gdk_input_init (GdkDisplay *display)
{
device = l->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
continue;
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
@ -1170,7 +1170,7 @@ _gdk_input_init (GdkDisplay *display)
{
device = list->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
display->core_pointer = device;
@ -1187,11 +1187,12 @@ _gdk_input_init (GdkDisplay *display)
/**
* gdk_display_open:
* @display_name: the name of the display to open
* @returns: a #GdkDisplay, or %NULL if the display
* could not be opened.
*
* Opens a display.
*
* Return value: (transfer none): a #GdkDisplay, or %NULL if the display
* could not be opened.
*
* Since: 2.2
*/
GdkDisplay *
@ -1581,7 +1582,7 @@ gdk_display_get_n_screens (GdkDisplay *display)
*
* Returns a screen object for one of the screens of the display.
*
* Returns: the #GdkScreen object
* Returns: (transfer none): the #GdkScreen object
*
* Since: 2.2
*/
@ -1601,7 +1602,7 @@ gdk_display_get_screen (GdkDisplay *display,
*
* Get the default #GdkScreen for @display.
*
* Returns: the default #GdkScreen object for @display
* Returns: (transfer none): the default #GdkScreen object for @display
*
* Since: 2.2
*/
@ -1771,7 +1772,8 @@ gdk_display_flush (GdkDisplay *display)
* on @display. This window is implicitly created by GDK.
* See gdk_window_set_group().
*
* Return value: The default group leader window for @display
* Return value: (transfer none): The default group leader window
* for @display
*
* Since: 2.4
**/
@ -1935,7 +1937,7 @@ gdk_display_x11_finalize (GObject *object)
*
* Find the #GdkDisplay corresponding to @display, if any exists.
*
* Return value: the #GdkDisplay, if found, otherwise %NULL.
* Return value: (transfer none): the #GdkDisplay, if found, otherwise %NULL.
*
* Since: 2.2
**/

View File

@ -257,7 +257,7 @@ gdk_drag_context_set_device (GdkDragContext *context,
*
* Returns the #GdkDevice associated to the drag context.
*
* Returns: The #GdkDevice associated to @context.
* Returns: (transfer none): The #GdkDevice associated to @context.
**/
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context)
@ -3162,7 +3162,7 @@ gdk_drag_do_leave (GdkDragContext *context, guint32 time)
*
* This function is called by the drag source.
*
* Return value: a newly created #GdkDragContext.
* Return value: (transfer full): a newly created #GdkDragContext.
**/
GdkDragContext *
gdk_drag_begin (GdkWindow *window,

View File

@ -57,20 +57,40 @@ static GList *event_sources = NULL;
static gint
gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
GList *filters)
GList **filters)
{
GList *tmp_list;
GdkFilterReturn result;
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
GList *node;
tmp_list = tmp_list->next;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (xevent, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
return result;
}
@ -143,7 +163,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
/* Apply global filters */
result = gdk_event_apply_filters (xevent, event,
_gdk_default_filters);
&_gdk_default_filters);
if (result == GDK_FILTER_REMOVE)
{
@ -167,7 +187,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
if (filter_private->filters)
{
result = gdk_event_apply_filters (xevent, event,
filter_private->filters);
&filter_private->filters);
if (result == GDK_FILTER_REMOVE)
{

View File

@ -289,10 +289,11 @@ get_xkb (GdkKeymapX11 *keymap_x11)
/**
* gdk_keymap_get_for_display:
* @display: the #GdkDisplay.
* @returns: the #GdkKeymap attached to @display.
*
* Returns the #GdkKeymap attached to @display.
*
* Return value: (transfer none): the #GdkKeymap attached to @display.
*
* Since: 2.2
**/
GdkKeymap*

View File

@ -117,7 +117,7 @@ _gdk_screen_x11_init (GdkScreenX11 *screen)
*
* Gets the display to which the @screen belongs.
*
* Returns: the display to which @screen belongs
* Returns: (transfer none): the display to which @screen belongs
*
* Since: 2.2
**/
@ -1229,7 +1229,7 @@ gdk_screen_make_display_name (GdkScreen *screen)
}
/**
* gdk_screen_get_active_window
* gdk_screen_get_active_window:
* @screen: a #GdkScreen
*
* Returns the screen's currently active window.
@ -1247,7 +1247,7 @@ gdk_screen_make_display_name (GdkScreen *screen)
* The returned window should be unrefed using g_object_unref() when
* no longer needed.
*
* Return value: the currently active window, or %NULL.
* Return value: (transfer full): the currently active window, or %NULL.
*
* Since: 2.10
**/

View File

@ -197,9 +197,9 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
* process if a foreign window was previously created for that
* window, but a new foreign window will never be created by this call.
*
* Returns: if there is a selection owner for this window, and it is a
* window known to the current process, the #GdkWindow that owns the
* selection, otherwise %NULL.
* Returns: (transfer none): if there is a selection owner for this window,
* and it is a window known to the current process, the #GdkWindow that
* owns the selection, otherwise %NULL.
*
* Since: 2.2
*/

View File

@ -841,9 +841,9 @@ x_event_mask_to_gdk_event_mask (long mask)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: a #GdkWindow wrapper for the native window or
* %NULL if the window has been destroyed. The wrapper will be
* newly created, if one doesn't exist already.
* Return value: (transfer full): a #GdkWindow wrapper for the native
* window, or %NULL if the window has been destroyed. The wrapper
* will be newly created, if one doesn't exist already.
*
* Since: 2.2
**/
@ -945,8 +945,8 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the #GdkWindow wrapper for the native window,
* or %NULL if there is none.
* Return value: (transfer none): the #GdkWindow wrapper for the native
* window, or %NULL if there is none.
*
* Since: 2.2
**/
@ -965,8 +965,8 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the #GdkWindow wrapper for the native window,
* or %NULL if there is none.
* Return value: (transfer none): the #GdkWindow wrapper for the native
* window, or %NULL if there is none.
**/
GdkWindow *
gdk_window_lookup (GdkNativeWindow anid)

View File

@ -80,8 +80,8 @@ _gdk_xid_table_remove (GdkDisplay *display,
*
* Returns the GDK object associated with the given X id.
*
* Return value: the associated #GdkWindow or %NULL if no
* object is associated with the X id.
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* of no object is associated with the X id.
*
* Since: 2.2
*/
@ -110,8 +110,8 @@ gdk_xid_table_lookup_for_display (GdkDisplay *display,
* Returns the Gdk object associated with the given X id for the default
* display.
*
* Return value: the associated #GdkWindow or %NULL if no
* object is associated with the X id.
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* if no object is associated with the X id.
*/
gpointer
gdk_xid_table_lookup (XID xid)

View File

@ -101,7 +101,7 @@ endif
# This places the generated .def file in srcdir, since it is expected to be there.
# (The one from a tarball is)
gtk.def: gtk.symbols
(echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gtk.symbols | $(SED) -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gtk.def
(echo -e EXPORTS; $(CPP) -P -DG_OS_WIN32 - <$(srcdir)/gtk.symbols | $(SED) -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gtk.def
TESTS_ENVIRONMENT = srcdir="$(srcdir)" gtk_all_c_sources="$(gtk_all_c_sources)"
if OS_LINUX
@ -218,7 +218,6 @@ gtk_public_h_sources = \
gtkhbbox.h \
gtkhbox.h \
gtkhpaned.h \
gtkhruler.h \
gtkhscale.h \
gtkhscrollbar.h \
gtkhseparator.h \
@ -273,7 +272,6 @@ gtk_public_h_sources = \
gtkrecentchooserwidget.h \
gtkrecentfilter.h \
gtkrecentmanager.h \
gtkruler.h \
gtkscale.h \
gtkscalebutton.h \
gtkscrollable.h \
@ -294,6 +292,7 @@ gtk_public_h_sources = \
gtkstatusicon.h \
gtkstock.h \
gtkstyle.h \
gtkswitch.h \
gtktable.h \
gtktearoffmenuitem.h \
gtktestutils.h \
@ -332,7 +331,6 @@ gtk_public_h_sources = \
gtkviewport.h \
gtkvolumebutton.h \
gtkvpaned.h \
gtkvruler.h \
gtkvscale.h \
gtkvscrollbar.h \
gtkvseparator.h \
@ -505,7 +503,6 @@ gtk_base_c_sources = \
gtkhbbox.c \
gtkhbox.c \
gtkhpaned.c \
gtkhruler.c \
gtkhscale.c \
gtkhscrollbar.c \
gtkhseparator.c \
@ -571,7 +568,6 @@ gtk_base_c_sources = \
gtkrecentchooser.c \
gtkrecentfilter.c \
gtkrecentmanager.c \
gtkruler.c \
gtkscale.c \
gtkscalebutton.c \
gtkscrollable.c \
@ -592,6 +588,7 @@ gtk_base_c_sources = \
gtkstatusicon.c \
gtkstock.c \
gtkstyle.c \
gtkswitch.c \
gtktable.c \
gtktearoffmenuitem.c \
gtktestutils.c \
@ -639,7 +636,6 @@ gtk_base_c_sources = \
gtkvolumebutton.c \
gtkviewport.c \
gtkvpaned.c \
gtkvruler.c \
gtkvscale.c \
gtkvscrollbar.c \
gtkvseparator.c \

View File

@ -1,5 +1,5 @@
#! /bin/sh
cpp -DINCLUDE_VARIABLES -P -DG_OS_UNIX -DGTK_WINDOWING_X11 -DALL_FILES ${srcdir:-.}/gtk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi
cpp -P -DG_OS_UNIX -DGDK_WINDOWING_X11 ${srcdir:-.}/gtk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi
nm -D -g --defined-only .libs/libgtk-x11-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
diff -u expected-abi actual-abi && rm -f expected-abi actual-abi

View File

@ -102,7 +102,6 @@
#include <gtk/gtkhbbox.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkhpaned.h>
#include <gtk/gtkhruler.h>
#include <gtk/gtkhscale.h>
#include <gtk/gtkhscrollbar.h>
#include <gtk/gtkhseparator.h>
@ -156,7 +155,6 @@
#include <gtk/gtkrecentchooserwidget.h>
#include <gtk/gtkrecentfilter.h>
#include <gtk/gtkrecentmanager.h>
#include <gtk/gtkruler.h>
#include <gtk/gtkscale.h>
#include <gtk/gtkscalebutton.h>
#include <gtk/gtkscrollable.h>
@ -177,6 +175,7 @@
#include <gtk/gtkstatusicon.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkstyle.h>
#include <gtk/gtkswitch.h>
#include <gtk/gtktable.h>
#include <gtk/gtktearoffmenuitem.h>
#include <gtk/gtktextbuffer.h>
@ -215,7 +214,6 @@
#include <gtk/gtkviewport.h>
#include <gtk/gtkvolumebutton.h>
#include <gtk/gtkvpaned.h>
#include <gtk/gtkvruler.h>
#include <gtk/gtkvscale.h>
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkvseparator.h>

File diff suppressed because it is too large Load Diff

View File

@ -164,6 +164,7 @@ static void gtk_assistant_get_child_property (GtkContainer *container,
GParamSpec *pspec);
static AtkObject *gtk_assistant_get_accessible (GtkWidget *widget);
static GType gtk_assistant_accessible_factory_get_type (void);
static void gtk_assistant_buildable_interface_init (GtkBuildableIface *iface);
static GObject *gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
@ -2438,27 +2439,59 @@ gtk_assistant_commit (GtkAssistant *assistant)
set_assistant_buttons_state (assistant);
}
static AtkObject *
gtk_assistant_get_accessible (GtkWidget *widget)
{
static gboolean first_time = TRUE;
if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/*
* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for
* the parent type of GtkAssistant.
*/
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry, derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
GTK_TYPE_ASSISTANT,
gtk_assistant_accessible_factory_get_type ());
first_time = FALSE;
}
return GTK_WIDGET_CLASS (gtk_assistant_parent_class)->get_accessible (widget);
}
/* accessible implementation */
/* dummy typedefs */
typedef struct _GtkAssistantAccessible GtkAssistantAccessible;
typedef struct _GtkAssistantAccessibleClass GtkAssistantAccessibleClass;
ATK_DEFINE_TYPE (GtkAssistantAccessible, gtk_assistant_accessible, GTK_TYPE_ASSISTANT);
static gint
gtk_assistant_accessible_get_n_children (AtkObject *accessible)
{
GtkAssistant *assistant;
GtkWidget *widget;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
if (!widget)
if (widget == NULL)
return 0;
assistant = GTK_ASSISTANT (widget);
return g_list_length (assistant->priv->pages) + 1;
return g_list_length (GTK_ASSISTANT (accessible)->priv->pages) + 1;
}
static AtkObject *
gtk_assistant_accessible_ref_child (AtkObject *accessible,
gint index)
@ -2471,7 +2504,7 @@ gtk_assistant_accessible_ref_child (AtkObject *accessible,
const gchar *title;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
if (!widget)
if (widget == NULL)
return NULL;
assistant = GTK_ASSISTANT (widget);
@ -2504,57 +2537,26 @@ gtk_assistant_accessible_ref_child (AtkObject *accessible,
}
static void
gtk_assistant_accessible_class_init (AtkObjectClass *class)
gtk_assistant_accessible_class_init (GtkAssistantAccessibleClass *klass)
{
class->get_n_children = gtk_assistant_accessible_get_n_children;
class->ref_child = gtk_assistant_accessible_ref_child;
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
atk_class->get_n_children = gtk_assistant_accessible_get_n_children;
atk_class->ref_child = gtk_assistant_accessible_ref_child;
}
static GType
gtk_assistant_accessible_get_type (void)
static void
gtk_assistant_accessible_init (GtkAssistantAccessible *self)
{
static GType type = 0;
if (!type)
{
/*
* Figure out the size of the class and instance
* we are deriving from
*/
AtkObjectFactory *factory;
GType derived_type;
GTypeQuery query;
GType derived_atk_type;
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
factory = atk_registry_get_factory (atk_get_default_registry (),
derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
g_type_query (derived_atk_type, &query);
type = g_type_register_static_simple (derived_atk_type,
I_("GtkAssistantAccessible"),
query.class_size,
(GClassInitFunc) gtk_assistant_accessible_class_init,
query.instance_size,
NULL, 0);
}
return type;
}
static AtkObject *
gtk_assistant_accessible_new (GObject *obj)
{
AtkObject *accessible;
/* factory */
typedef AtkObjectFactory GtkAssistantAccessibleFactory;
typedef AtkObjectFactoryClass GtkAssistantAccessibleFactoryClass;
g_return_val_if_fail (GTK_IS_ASSISTANT (obj), NULL);
accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
G_DEFINE_TYPE (GtkAssistantAccessibleFactory,
gtk_assistant_accessible_factory,
ATK_TYPE_OBJECT_FACTORY);
static GType
gtk_assistant_accessible_factory_get_accessible_type (void)
@ -2565,7 +2567,12 @@ gtk_assistant_accessible_factory_get_accessible_type (void)
static AtkObject*
gtk_assistant_accessible_factory_create_accessible (GObject *obj)
{
return gtk_assistant_accessible_new (obj);
AtkObject *accessible;
accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
static void
@ -2575,59 +2582,12 @@ gtk_assistant_accessible_factory_class_init (AtkObjectFactoryClass *class)
class->get_accessible_type = gtk_assistant_accessible_factory_get_accessible_type;
}
static GType
gtk_assistant_accessible_factory_get_type (void)
static void
gtk_assistant_accessible_factory_init (AtkObjectFactory *factory)
{
static GType type = 0;
if (!type)
{
type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
I_("GtkAssistantAccessibleFactory"),
sizeof (AtkObjectFactoryClass),
(GClassInitFunc) gtk_assistant_accessible_factory_class_init,
sizeof (AtkObjectFactory),
NULL, 0);
}
return type;
}
static AtkObject *
gtk_assistant_get_accessible (GtkWidget *widget)
{
static gboolean first_time = TRUE;
if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/*
* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for
* the parent type of GtkAssistant.
*/
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry,
derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
{
atk_registry_set_factory_type (registry,
GTK_TYPE_ASSISTANT,
gtk_assistant_accessible_factory_get_type ());
}
first_time = FALSE;
}
return GTK_WIDGET_CLASS (gtk_assistant_parent_class)->get_accessible (widget);
}
/* buildable implementation */
static GtkBuildableIface *parent_buildable_iface;

View File

@ -274,17 +274,13 @@ gtk_box_class_init (GtkBoxClass *class)
* GtkBox:fill:
*
* Whether the child should receive extra space when the parent grows.
*
* Note that the default value for this property is %FALSE for GtkBox,
* but #GtkHBox, #GtkVBox and other subclasses use the old default
* of %TRUE.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_FILL,
g_param_spec_boolean ("fill",
P_("Fill"),
P_("Whether extra space given to the child should be allocated to the child or used as padding"),
FALSE,
TRUE,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
@ -1648,7 +1644,7 @@ gtk_box_add (GtkContainer *container,
gtk_box_pack_start (GTK_BOX (container), widget,
priv->default_expand,
priv->default_expand,
TRUE,
0);
}

View File

@ -1563,7 +1563,7 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
{
GdkRGBA rgba = { 0 };
if (gdk_rgba_parse (string, &rgba))
if (gdk_rgba_parse (&rgba, string))
g_value_set_boxed (value, &rgba);
else
{

View File

@ -1827,10 +1827,10 @@ gtk_real_button_activate (GtkButton *button)
device = gtk_get_current_event_device ();
if (device && device->source != GDK_SOURCE_KEYBOARD)
if (device && gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD);
g_return_if_fail (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
{

View File

@ -534,7 +534,7 @@ gtk_cell_renderer_set_property (GObject *object,
if (!g_value_get_string (value))
set_cell_bg_color (cell, NULL);
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
set_cell_bg_color (cell, &rgba);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));

View File

@ -616,7 +616,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
if (!device)
return NULL;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyb = device;
pointer = gdk_device_get_associated_device (device);

View File

@ -1193,7 +1193,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
if (!g_value_get_string (value))
set_bg_color (celltext, NULL); /* reset to background_set to FALSE */
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
set_bg_color (celltext, &rgba);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));
@ -1208,7 +1208,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
if (!g_value_get_string (value))
set_fg_color (celltext, NULL); /* reset to foreground_set to FALSE */
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
set_fg_color (celltext, &rgba);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));

View File

@ -1912,7 +1912,7 @@ get_screen_color (GtkWidget *button)
device = gtk_get_current_event_device ();
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyb_device = device;
pointer_device = gdk_device_get_associated_device (device);

View File

@ -143,6 +143,8 @@ struct _GtkComboBoxPrivate
gint text_column;
GtkCellRenderer *text_renderer;
gint id_column;
GSList *cells;
guint popup_in_progress : 1;
@ -245,7 +247,9 @@ enum {
PROP_EDITING_CANCELED,
PROP_HAS_ENTRY,
PROP_ENTRY_TEXT_COLUMN,
PROP_POPUP_FIXED_WIDTH
PROP_POPUP_FIXED_WIDTH,
PROP_ID_COLUMN,
PROP_ACTIVE_ID
};
static guint combo_box_signals[LAST_SIGNAL] = {0,};
@ -948,6 +952,38 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
-1, G_MAXINT, -1,
GTK_PARAM_READWRITE));
/**
* GtkComboBox:id-column:
*
* The column in the combo box's model that provides string
* IDs for the values in the model, if != -1.
*
* Since: 3.0
*/
g_object_class_install_property (object_class,
PROP_ID_COLUMN,
g_param_spec_int ("id-column",
P_("ID Column"),
P_("The column in the combo box's model that provides "
"string IDs for the values in the model"),
-1, G_MAXINT, -1,
GTK_PARAM_READWRITE));
/**
* GtkComboBox:active-id:
*
* The value of the ID column of the active row.
*
* Since: 3.0
*/
g_object_class_install_property (object_class,
PROP_ACTIVE_ID,
g_param_spec_string ("active-id",
P_("Active id"),
P_("The value of the id column "
"for the active row"),
NULL, GTK_PARAM_READWRITE));
/**
* GtkComboBox:popup-fixed-width:
*
@ -1077,6 +1113,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
priv->text_column = -1;
priv->text_renderer = NULL;
priv->id_column = -1;
gtk_combo_box_check_appearance (combo_box);
}
@ -1168,6 +1205,14 @@ gtk_combo_box_set_property (GObject *object,
gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value));
break;
case PROP_ID_COLUMN:
gtk_combo_box_set_id_column (combo_box, g_value_get_int (value));
break;
case PROP_ACTIVE_ID:
gtk_combo_box_set_active_id (combo_box, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1245,6 +1290,14 @@ gtk_combo_box_get_property (GObject *object,
g_value_set_int (value, priv->text_column);
break;
case PROP_ID_COLUMN:
g_value_set_int (value, priv->id_column);
break;
case PROP_ACTIVE_ID:
g_value_set_string (value, gtk_combo_box_get_active_id (combo_box));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -2199,7 +2252,7 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
time = gtk_get_current_event_time ();
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);
@ -4879,6 +4932,7 @@ gtk_combo_box_new_with_model (GtkTreeModel *model)
/**
* gtk_combo_box_new_with_model_and_entry:
* @model: A #GtkTreeModel
*
* Creates a new empty #GtkComboBox with an entry
* and with the model initialized to @model.
@ -5199,6 +5253,8 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
g_signal_emit (combo_box, combo_box_signals[CHANGED], 0);
g_object_notify (G_OBJECT (combo_box), "active");
if (combo_box->priv->id_column >= 0)
g_object_notify (G_OBJECT (combo_box), "active-id");
}
@ -6587,3 +6643,157 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
if (natural_size)
*natural_size = nat_height;
}
/**
* gtk_combo_box_set_id_column:
* @combo_box: A #GtkComboBox
* @id_column: A column in @model to get string IDs for values from
*
* Sets the model column which @combo_box should use to get string IDs
* for values from. The column @id_column in the model of @combo_box
* must be of type %G_TYPE_STRING.
*
* Since: 3.0
*/
void
gtk_combo_box_set_id_column (GtkComboBox *combo_box,
gint id_column)
{
GtkComboBoxPrivate *priv = combo_box->priv;
GtkTreeModel *model;
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
if (id_column != priv->id_column)
{
model = gtk_combo_box_get_model (combo_box);
g_return_if_fail (id_column >= 0);
g_return_if_fail (model == NULL ||
id_column < gtk_tree_model_get_n_columns (model));
priv->id_column = id_column;
g_object_notify (G_OBJECT (combo_box), "id-column");
g_object_notify (G_OBJECT (combo_box), "active-id");
}
}
/**
* gtk_combo_box_get_id_column:
* @combo_box: A #GtkComboBox
*
* Returns the column which @combo_box is using to get string IDs
* for values from.
*
* Return value: A column in the data source model of @combo_box.
*
* Since: 3.0
*/
gint
gtk_combo_box_get_id_column (GtkComboBox *combo_box)
{
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
return combo_box->priv->id_column;
}
/**
* gtk_combo_box_get_active_id:
* @combo_box: a #GtkComboBox
*
* Returns the ID of the active row of @combo_box. This value is taken
* from the active row and the column specified by the 'id-column'
* property of @combo_box (see gtk_combo_box_set_id_column()).
*
* The returned value is an interned string which means that you can
* compare the pointer by value to other interned strings and that you
* must not free it.
*
* If the 'id-column' property of @combo_box is not set or if no row is
* selected then %NULL is returned.
*
* Return value: the ID of the active row, or %NULL
*
* Since: 3.0
**/
const gchar *
gtk_combo_box_get_active_id (GtkComboBox *combo_box)
{
GtkTreeModel *model;
GtkTreeIter iter;
gint column;
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
column = combo_box->priv->id_column;
if (column < 0)
return NULL;
model = gtk_combo_box_get_model (combo_box);
g_return_val_if_fail (gtk_tree_model_get_column_type (model, column) ==
G_TYPE_STRING, NULL);
if (gtk_combo_box_get_active_iter (combo_box, &iter))
{
const gchar *interned;
gchar *id;
gtk_tree_model_get (model, &iter, column, &id, -1);
interned = g_intern_string (id);
g_free (id);
return interned;
}
return NULL;
}
/**
* gtk_combo_box_set_active_id:
* @combo_box: a #GtkComboBox
* @active_id: the ID of the row to select
*
* Changes the active row of @combo_box to the one that has an ID equal to @id.
*
* If the 'id-column' property of @combo_box is unset or if no row has
* the given ID then nothing happens.
*
* Since: 3.0
**/
void
gtk_combo_box_set_active_id (GtkComboBox *combo_box,
const gchar *active_id)
{
GtkTreeModel *model;
GtkTreeIter iter;
gint column;
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
column = combo_box->priv->id_column;
if (column < 0)
return;
model = gtk_combo_box_get_model (combo_box);
g_return_if_fail (gtk_tree_model_get_column_type (model, column) ==
G_TYPE_STRING);
if (gtk_tree_model_get_iter_first (model, &iter))
do {
gboolean match;
gchar *id;
gtk_tree_model_get (model, &iter, column, &id, -1);
match = strcmp (id, active_id) == 0;
g_free (id);
if (match)
{
gtk_combo_box_set_active_iter (combo_box, &iter);
break;
}
} while (gtk_tree_model_iter_next (model, &iter));
}

View File

@ -134,6 +134,12 @@ void gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
void gtk_combo_box_popdown (GtkComboBox *combo_box);
AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
gint gtk_combo_box_get_id_column (GtkComboBox *combo_box);
void gtk_combo_box_set_id_column (GtkComboBox *combo_box,
gint id_column);
const gchar * gtk_combo_box_get_active_id (GtkComboBox *combo_box);
void gtk_combo_box_set_active_id (GtkComboBox *combo_box,
const gchar *active_id);
G_END_DECLS

View File

@ -72,7 +72,7 @@ gtk_combo_box_text_init (GtkComboBoxText *combo_box)
{
GtkListStore *store;
store = gtk_list_store_new (1, G_TYPE_STRING);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
g_object_unref (store);
}
@ -102,6 +102,7 @@ gtk_combo_box_text_new (void)
{
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"entry-text-column", 0,
"id-column", 1,
NULL);
}
@ -121,6 +122,7 @@ gtk_combo_box_text_new_with_entry (void)
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"has-entry", TRUE,
"entry-text-column", 0,
"id-column", 1,
NULL);
}
@ -131,13 +133,16 @@ gtk_combo_box_text_new_with_entry (void)
*
* Appends @text to the list of strings stored in @combo_box.
*
* This is the same as calling gtk_combo_box_text_insert_text() with a
* position of -1.
*
* Since: 2.24
*/
void
gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
const gchar *text)
{
gtk_combo_box_text_insert_text (combo_box, G_MAXINT, text);
gtk_combo_box_text_insert (combo_box, -1, NULL, text);
}
/**
@ -147,13 +152,16 @@ gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
*
* Prepends @text to the list of strings stored in @combo_box.
*
* This is the same as calling gtk_combo_box_text_insert_text() with a
* position of 0.
*
* Since: 2.24
*/
void
gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
const gchar *text)
{
gtk_combo_box_text_insert_text (combo_box, 0, text);
gtk_combo_box_text_insert (combo_box, 0, NULL, text);
}
/**
@ -164,12 +172,84 @@ gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
*
* Inserts @text at @position in the list of strings stored in @combo_box.
*
* If @position is negative then @text is appended.
*
* This is the same as calling gtk_combo_box_text_insert() with a %NULL
* ID string.
*
* Since: 2.24
*/
void
gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
gint position,
const gchar *text)
{
gtk_combo_box_text_insert (combo_box, position, NULL, text);
}
/**
* gtk_combo_box_text_append:
* @combo_box: A #GtkComboBoxText
* @text: A string
*
* Appends @text to the list of strings stored in @combo_box. If @id is
* non-%NULL then it is used as the ID of the row.
*
* This is the same as calling gtk_combo_box_text_insert() with a
* position of -1.
*
* Since: 2.24
*/
void
gtk_combo_box_text_append (GtkComboBoxText *combo_box,
const gchar *id,
const gchar *text)
{
gtk_combo_box_text_insert (combo_box, -1, id, text);
}
/**
* gtk_combo_box_text_prepend:
* @combo_box: A #GtkComboBox
* @text: A string
*
* Prepends @text to the list of strings stored in @combo_box. If @id
* is non-%NULL then it is used as the ID of the row.
*
* This is the same as calling gtk_combo_box_text_insert() with a
* position of 0.
*
* Since: 2.24
*/
void
gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
const gchar *id,
const gchar *text)
{
gtk_combo_box_text_insert (combo_box, 0, id, text);
}
/**
* gtk_combo_box_text_insert:
* @combo_box: A #GtkComboBoxText
* @position: An index to insert @text
* @id: a string ID for this value, or %NULL
* @text: A string to display
*
* Inserts @text at @position in the list of strings stored in @combo_box.
* If @id is non-%NULL then it is used as the ID of the row. See
* #GtkComboBox::id-column.
*
* If @position is negative then @text is appended.
*
* Since: 3.0
*/
void
gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
gint position,
const gchar *id,
const gchar *text)
{
GtkListStore *store;
GtkTreeIter iter;
@ -177,9 +257,11 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
gint column_type;
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box));
g_return_if_fail (position >= 0);
g_return_if_fail (text != NULL);
if (position < 0)
position = G_MAXINT;
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
g_return_if_fail (GTK_IS_LIST_STORE (store));
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
@ -188,6 +270,17 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
gtk_list_store_insert (store, &iter, position);
gtk_list_store_set (store, &iter, text_column, text, -1);
if (id != NULL)
{
gint id_column;
id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
g_return_if_fail (column_type == G_TYPE_STRING);
gtk_list_store_set (store, &iter, id_column, id, -1);
}
}
/**

View File

@ -72,6 +72,16 @@ void gtk_combo_box_text_remove (GtkComboBoxText *combo_box
void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box);
gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box);
void gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
gint position,
const gchar *id,
const gchar *text);
void gtk_combo_box_text_append (GtkComboBoxText *combo_box,
const gchar *id,
const gchar *text);
void gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
const gchar *id,
const gchar *text);
G_END_DECLS

View File

@ -2329,7 +2329,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
pointer = gdk_event_get_device (event);
if (pointer->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (pointer) == GDK_SOURCE_KEYBOARD)
{
keyboard = pointer;
pointer = gdk_device_get_associated_device (keyboard);

View File

@ -9710,7 +9710,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
device = gtk_get_current_event_device ();
if (device && device->source == GDK_SOURCE_KEYBOARD)
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
if (device)

View File

@ -208,13 +208,6 @@ typedef enum
GTK_MESSAGE_OTHER
} GtkMessageType;
typedef enum
{
GTK_PIXELS,
GTK_INCHES,
GTK_CENTIMETERS
} GtkMetricType;
/**
* GtkMovementStep:
* @GTK_MOVEMENT_LOGICAL_POSITIONS: Move forward or back by graphemes

View File

@ -1,51 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkhruler.h"
#include "gtkorientable.h"
G_DEFINE_TYPE (GtkHRuler, gtk_hruler, GTK_TYPE_RULER)
static void
gtk_hruler_class_init (GtkHRulerClass *klass)
{
}
static void
gtk_hruler_init (GtkHRuler *hruler)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (hruler),
GTK_ORIENTATION_HORIZONTAL);
}
GtkWidget *
gtk_hruler_new (void)
{
return g_object_new (GTK_TYPE_HRULER, NULL);
}

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_HRULER_H__
#define __GTK_HRULER_H__
#include <gtk/gtkruler.h>
G_BEGIN_DECLS
#define GTK_TYPE_HRULER (gtk_hruler_get_type ())
#define GTK_HRULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HRULER, GtkHRuler))
#define GTK_HRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HRULER, GtkHRulerClass))
#define GTK_IS_HRULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HRULER))
#define GTK_IS_HRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HRULER))
#define GTK_HRULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HRULER, GtkHRulerClass))
typedef struct _GtkHRuler GtkHRuler;
typedef struct _GtkHRulerClass GtkHRulerClass;
struct _GtkHRuler
{
GtkRuler ruler;
};
struct _GtkHRulerClass
{
GtkRulerClass parent_class;
};
GType gtk_hruler_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_hruler_new (void);
G_END_DECLS
#endif /* __GTK_HRULER_H__ */

View File

@ -317,7 +317,7 @@ static void gtk_icon_view_set_hadjustment (GtkIco
GtkAdjustment *adjustment);
static void gtk_icon_view_set_vadjustment (GtkIconView *icon_view,
GtkAdjustment *adjustment);
static void gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
static void gtk_icon_view_accessible_set_adjustment (AtkObject *accessible,
GtkOrientation orientation,
GtkAdjustment *adjustment);
static void gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
@ -2707,6 +2707,7 @@ gtk_icon_view_set_hadjustment (GtkIconView *icon_view,
GtkAdjustment *adjustment)
{
GtkIconViewPrivate *priv = icon_view->priv;
AtkObject *atk_obj;
if (adjustment && priv->hadjustment == adjustment)
return;
@ -2728,9 +2729,10 @@ gtk_icon_view_set_hadjustment (GtkIconView *icon_view,
priv->hadjustment = g_object_ref_sink (adjustment);
gtk_icon_view_set_hadjustment_values (icon_view);
gtk_icon_view_accessible_set_adjustment (icon_view,
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
gtk_icon_view_accessible_set_adjustment (atk_obj,
GTK_ORIENTATION_HORIZONTAL,
priv->hadjustment);
adjustment);
g_object_notify (G_OBJECT (icon_view), "hadjustment");
}
@ -2740,6 +2742,7 @@ gtk_icon_view_set_vadjustment (GtkIconView *icon_view,
GtkAdjustment *adjustment)
{
GtkIconViewPrivate *priv = icon_view->priv;
AtkObject *atk_obj;
if (adjustment && priv->vadjustment == adjustment)
return;
@ -2761,9 +2764,10 @@ gtk_icon_view_set_vadjustment (GtkIconView *icon_view,
priv->vadjustment = g_object_ref_sink (adjustment);
gtk_icon_view_set_vadjustment_values (icon_view);
gtk_icon_view_accessible_set_adjustment (icon_view,
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
gtk_icon_view_accessible_set_adjustment (atk_obj,
GTK_ORIENTATION_VERTICAL,
priv->vadjustment);
adjustment);
g_object_notify (G_OBJECT (icon_view), "vadjustment");
}
@ -9207,32 +9211,21 @@ gtk_icon_view_accessible_traverse_items (GtkIconViewAccessible *view,
}
static void
gtk_icon_view_accessible_adjustment_changed (GtkAdjustment *adjustment,
GtkIconView *icon_view)
gtk_icon_view_accessible_adjustment_changed (GtkAdjustment *adjustment,
GtkIconViewAccessible *view)
{
AtkObject *obj;
GtkIconViewAccessible *view;
/*
* The scrollbars have changed
*/
obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
view = GTK_ICON_VIEW_ACCESSIBLE (obj);
gtk_icon_view_accessible_traverse_items (view, NULL);
}
static void
gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
gtk_icon_view_accessible_set_adjustment (AtkObject *accessible,
GtkOrientation orientation,
GtkAdjustment *adjustment)
{
AtkObject *atk_obj;
GtkIconViewAccessiblePrivate *priv;
GtkAdjustment **old_adj_ptr;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
priv = gtk_icon_view_accessible_get_priv (atk_obj);
priv = gtk_icon_view_accessible_get_priv (accessible);
/* Adjustments are set for the first time in constructor and priv is not
* initialized at that time, so skip this first setting. */
@ -9261,7 +9254,7 @@ gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
(gpointer *)&priv->old_hadj);
g_signal_handlers_disconnect_by_func (*old_adj_ptr,
gtk_icon_view_accessible_adjustment_changed,
icon_view);
accessible);
}
/* Connect signal */
@ -9269,7 +9262,7 @@ gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
g_object_add_weak_pointer (G_OBJECT (adjustment), (gpointer *)old_adj_ptr);
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
icon_view);
accessible);
}
static void
@ -9572,11 +9565,11 @@ gtk_icon_view_accessible_initialize (AtkObject *accessible,
icon_view = GTK_ICON_VIEW (data);
if (icon_view->priv->hadjustment)
gtk_icon_view_accessible_set_adjustment (icon_view,
gtk_icon_view_accessible_set_adjustment (accessible,
GTK_ORIENTATION_HORIZONTAL,
icon_view->priv->hadjustment);
if (icon_view->priv->vadjustment)
gtk_icon_view_accessible_set_adjustment (icon_view,
gtk_icon_view_accessible_set_adjustment (accessible,
GTK_ORIENTATION_VERTICAL,
icon_view->priv->vadjustment);
g_signal_connect (data,
@ -9623,7 +9616,7 @@ gtk_icon_view_accessible_destroyed (GtkWidget *widget,
g_signal_handlers_disconnect_by_func (priv->old_hadj,
(gpointer) gtk_icon_view_accessible_adjustment_changed,
widget);
accessible);
priv->old_hadj = NULL;
}
if (priv->old_vadj)
@ -9633,7 +9626,7 @@ gtk_icon_view_accessible_destroyed (GtkWidget *widget,
g_signal_handlers_disconnect_by_func (priv->old_vadj,
(gpointer) gtk_icon_view_accessible_adjustment_changed,
widget);
accessible);
priv->old_vadj = NULL;
}
}

View File

@ -1469,7 +1469,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
menu_shell = GTK_MENU_SHELL (menu);
priv = gtk_menu_get_private (menu);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);
@ -1760,8 +1760,11 @@ gtk_menu_popdown (GtkMenu *menu)
/* The X Grab, if present, will automatically be removed when we hide
* the window */
gtk_widget_hide (menu->toplevel);
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL);
if (menu->toplevel)
{
gtk_widget_hide (menu->toplevel);
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL);
}
pointer = _gtk_menu_shell_get_grab_device (menu_shell);

View File

@ -153,6 +153,7 @@ static void gtk_menu_shell_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_menu_shell_realize (GtkWidget *widget);
static void gtk_menu_shell_finalize (GObject *object);
static void gtk_menu_shell_dispose (GObject *object);
static gint gtk_menu_shell_button_press (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_menu_shell_button_release (GtkWidget *widget,
@ -222,6 +223,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
object_class->set_property = gtk_menu_shell_set_property;
object_class->get_property = gtk_menu_shell_get_property;
object_class->finalize = gtk_menu_shell_finalize;
object_class->dispose = gtk_menu_shell_dispose;
widget_class->realize = gtk_menu_shell_realize;
widget_class->button_press_event = gtk_menu_shell_button_press;
@ -463,6 +465,16 @@ gtk_menu_shell_finalize (GObject *object)
}
static void
gtk_menu_shell_dispose (GObject *object)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
gtk_menu_shell_deactivate (menu_shell);
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->dispose (object);
}
void
gtk_menu_shell_append (GtkMenuShell *menu_shell,
GtkWidget *child)
@ -1807,7 +1819,7 @@ _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
if (!device)
priv->grab_pointer = NULL;
else if (device->source == GDK_SOURCE_KEYBOARD)
else if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
priv->grab_pointer = gdk_device_get_associated_device (device);
else
priv->grab_pointer = device;

View File

@ -378,7 +378,7 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
{
GdkDevice *device = d->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
keyboard = device;
}

View File

@ -1,959 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <math.h>
#include <string.h>
#include "gtkorientable.h"
#include "gtkruler.h"
#include "gtktypeutils.h"
#include "gtkprivate.h"
#include "gtkintl.h"
#define RULER_WIDTH 14
#define MINIMUM_INCR 5
#define MAXIMUM_SUBDIVIDE 5
#define MAXIMUM_SCALES 10
#define ROUND(x) ((int) ((x) + 0.5))
struct _GtkRulerPrivate
{
GtkOrientation orientation;
GtkRulerMetric *metric;
cairo_surface_t *backing_store;
gint slider_size;
gint xsrc;
gint ysrc;
gdouble lower; /* The upper limit of the ruler (in points) */
gdouble max_size; /* The maximum size of the ruler */
gdouble position; /* The position of the mark on the ruler */
gdouble upper; /* The lower limit of the ruler */
};
enum {
PROP_0,
PROP_ORIENTATION,
PROP_LOWER,
PROP_UPPER,
PROP_POSITION,
PROP_MAX_SIZE,
PROP_METRIC
};
static void gtk_ruler_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_ruler_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_ruler_realize (GtkWidget *widget);
static void gtk_ruler_unrealize (GtkWidget *widget);
static void gtk_ruler_get_preferred_width
(GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_ruler_get_preferred_height
(GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_ruler_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gboolean gtk_ruler_draw (GtkWidget *widget,
cairo_t *cr);
static void gtk_ruler_make_pixmap (GtkRuler *ruler);
static void gtk_ruler_draw_ticks (GtkRuler *ruler);
static void gtk_ruler_real_draw_ticks (GtkRuler *ruler,
cairo_t *cr);
static void gtk_ruler_real_draw_pos (GtkRuler *ruler,
cairo_t *cr);
static const GtkRulerMetric ruler_metrics[] =
{
{ "Pixel", "Pi", 1.0, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
{ "Inches", "In", 72.0, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
{ "Centimeters", "Cn", 28.35, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
};
G_DEFINE_TYPE_WITH_CODE (GtkRuler, gtk_ruler, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
NULL))
static void
gtk_ruler_class_init (GtkRulerClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
gobject_class->set_property = gtk_ruler_set_property;
gobject_class->get_property = gtk_ruler_get_property;
widget_class->realize = gtk_ruler_realize;
widget_class->unrealize = gtk_ruler_unrealize;
widget_class->get_preferred_width = gtk_ruler_get_preferred_width;
widget_class->get_preferred_height = gtk_ruler_get_preferred_height;
widget_class->size_allocate = gtk_ruler_size_allocate;
widget_class->motion_notify_event = gtk_ruler_motion_notify;
widget_class->draw = gtk_ruler_draw;
class->draw_ticks = gtk_ruler_real_draw_ticks;
class->draw_pos = gtk_ruler_real_draw_pos;
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
g_object_class_install_property (gobject_class,
PROP_LOWER,
g_param_spec_double ("lower",
P_("Lower"),
P_("Lower limit of ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_UPPER,
g_param_spec_double ("upper",
P_("Upper"),
P_("Upper limit of ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_POSITION,
g_param_spec_double ("position",
P_("Position"),
P_("Position of mark on the ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_MAX_SIZE,
g_param_spec_double ("max-size",
P_("Max Size"),
P_("Maximum size of the ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
/**
* GtkRuler:metric:
*
* The metric used for the ruler.
*
* Since: 2.8
*/
g_object_class_install_property (gobject_class,
PROP_METRIC,
g_param_spec_enum ("metric",
P_("Metric"),
P_("The metric used for the ruler"),
GTK_TYPE_METRIC_TYPE,
GTK_PIXELS,
GTK_PARAM_READWRITE));
g_type_class_add_private (gobject_class, sizeof (GtkRulerPrivate));
}
static void
gtk_ruler_init (GtkRuler *ruler)
{
GtkRulerPrivate *priv;
ruler->priv = G_TYPE_INSTANCE_GET_PRIVATE (ruler,
GTK_TYPE_RULER,
GtkRulerPrivate);
priv = ruler->priv;
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
priv->backing_store = NULL;
priv->xsrc = 0;
priv->ysrc = 0;
priv->slider_size = 0;
priv->lower = 0;
priv->upper = 0;
priv->position = 0;
priv->max_size = 0;
gtk_ruler_set_metric (ruler, GTK_PIXELS);
}
static void
gtk_ruler_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkRuler *ruler = GTK_RULER (object);
GtkRulerPrivate *priv = ruler->priv;
switch (prop_id)
{
case PROP_ORIENTATION:
priv->orientation = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (ruler));
break;
case PROP_LOWER:
gtk_ruler_set_range (ruler, g_value_get_double (value), priv->upper,
priv->position, priv->max_size);
break;
case PROP_UPPER:
gtk_ruler_set_range (ruler, priv->lower, g_value_get_double (value),
priv->position, priv->max_size);
break;
case PROP_POSITION:
gtk_ruler_set_range (ruler, priv->lower, priv->upper,
g_value_get_double (value), priv->max_size);
break;
case PROP_MAX_SIZE:
gtk_ruler_set_range (ruler, priv->lower, priv->upper,
priv->position, g_value_get_double (value));
break;
case PROP_METRIC:
gtk_ruler_set_metric (ruler, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_ruler_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkRuler *ruler = GTK_RULER (object);
GtkRulerPrivate *priv = ruler->priv;
switch (prop_id)
{
case PROP_ORIENTATION:
g_value_set_enum (value, priv->orientation);
break;
case PROP_LOWER:
g_value_set_double (value, priv->lower);
break;
case PROP_UPPER:
g_value_set_double (value, priv->upper);
break;
case PROP_POSITION:
g_value_set_double (value, priv->position);
break;
case PROP_MAX_SIZE:
g_value_set_double (value, priv->max_size);
break;
case PROP_METRIC:
g_value_set_enum (value, gtk_ruler_get_metric (ruler));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/**
* gtk_ruler_new:
* @orientation: the ruler's orientation.
*
* Creates a new #GtkRuler with the given orientation.
*
* Return value: a new #GtkRuler.
*
* Since: 3.0
**/
GtkWidget *
gtk_ruler_new (GtkOrientation orientation)
{
return g_object_new (GTK_TYPE_RULER,
"orientation", orientation,
NULL);
}
/**
* gtk_ruler_invalidate_ticks:
* @ruler: the ruler to invalidate
*
* For performance reasons, #GtkRuler keeps a backbuffer containing the
* prerendered contents of the ticks. To cause a repaint this buffer,
* call this function instead of gtk_widget_queue_draw().
**/
static void
gtk_ruler_invalidate_ticks (GtkRuler *ruler)
{
g_return_if_fail (GTK_IS_RULER (ruler));
if (ruler->priv->backing_store == NULL)
return;
gtk_ruler_draw_ticks (ruler);
gtk_widget_queue_draw (GTK_WIDGET (ruler));
}
void
gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
priv->metric = (GtkRulerMetric *) &ruler_metrics[metric];
g_object_notify (G_OBJECT (ruler), "metric");
gtk_ruler_invalidate_ticks (ruler);
}
/**
* gtk_ruler_get_metric:
* @ruler: a #GtkRuler
*
* Gets the units used for a #GtkRuler. See gtk_ruler_set_metric().
*
* Return value: the units currently used for @ruler
**/
GtkMetricType
gtk_ruler_get_metric (GtkRuler *ruler)
{
GtkRulerPrivate *priv;
gint i;
g_return_val_if_fail (GTK_IS_RULER (ruler), 0);
priv = ruler->priv;
for (i = 0; i < G_N_ELEMENTS (ruler_metrics); i++)
if (priv->metric == &ruler_metrics[i])
return i;
g_assert_not_reached ();
return 0;
}
/**
* gtk_ruler_set_range:
* @ruler: the gtkruler
* @lower: the lower limit of the ruler
* @upper: the upper limit of the ruler
* @position: the mark on the ruler
* @max_size: the maximum size of the ruler used when calculating the space to
* leave for the text
*
* This sets the range of the ruler.
*/
void
gtk_ruler_set_range (GtkRuler *ruler,
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
g_object_freeze_notify (G_OBJECT (ruler));
if (priv->lower != lower)
{
priv->lower = lower;
g_object_notify (G_OBJECT (ruler), "lower");
}
if (priv->upper != upper)
{
priv->upper = upper;
g_object_notify (G_OBJECT (ruler), "upper");
}
if (priv->position != position)
{
priv->position = position;
g_object_notify (G_OBJECT (ruler), "position");
}
if (priv->max_size != max_size)
{
priv->max_size = max_size;
g_object_notify (G_OBJECT (ruler), "max-size");
}
g_object_thaw_notify (G_OBJECT (ruler));
gtk_ruler_invalidate_ticks (ruler);
}
/**
* gtk_ruler_get_range:
* @ruler: a #GtkRuler
* @lower: (allow-none): location to store lower limit of the ruler, or %NULL
* @upper: (allow-none): location to store upper limit of the ruler, or %NULL
* @position: (allow-none): location to store the current position of the mark on the ruler, or %NULL
* @max_size: location to store the maximum size of the ruler used when calculating
* the space to leave for the text, or %NULL.
*
* Retrieves values indicating the range and current position of a #GtkRuler.
* See gtk_ruler_set_range().
**/
void
gtk_ruler_get_range (GtkRuler *ruler,
gdouble *lower,
gdouble *upper,
gdouble *position,
gdouble *max_size)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
if (lower)
*lower = priv->lower;
if (upper)
*upper = priv->upper;
if (position)
*position = priv->position;
if (max_size)
*max_size = priv->max_size;
}
static void
gtk_ruler_draw_ticks (GtkRuler *ruler)
{
GtkRulerPrivate *priv = ruler->priv;
cairo_t *cr;
g_return_if_fail (GTK_IS_RULER (ruler));
if (priv->backing_store == NULL)
return;
cr = cairo_create (priv->backing_store);
if (GTK_RULER_GET_CLASS (ruler)->draw_ticks)
GTK_RULER_GET_CLASS (ruler)->draw_ticks (ruler, cr);
cairo_destroy (cr);
}
static void
gtk_ruler_realize (GtkWidget *widget)
{
GtkAllocation allocation;
GtkRuler *ruler;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
ruler = GTK_RULER (widget);
gtk_widget_set_realized (widget, TRUE);
gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, ruler);
gtk_widget_style_attach (widget);
gtk_style_set_background (gtk_widget_get_style (widget),
window, GTK_STATE_ACTIVE);
gtk_ruler_make_pixmap (ruler);
}
static void
gtk_ruler_unrealize (GtkWidget *widget)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
if (priv->backing_store)
{
cairo_surface_destroy (priv->backing_store);
priv->backing_store = NULL;
}
GTK_WIDGET_CLASS (gtk_ruler_parent_class)->unrealize (widget);
}
static void
gtk_ruler_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum,
gint *natural)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint thickness;
style = gtk_widget_get_style (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
thickness = style->xthickness;
else
thickness = style->ythickness;
if (priv->orientation == orientation)
*minimum = *natural = thickness * 2 + 1;
else
*minimum = *natural = thickness * 2 + RULER_WIDTH;
}
static void
gtk_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
gtk_ruler_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
}
static void
gtk_ruler_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
gtk_ruler_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
}
static void
gtk_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkAllocation old_allocation;
gboolean resized;
gtk_widget_get_allocation (widget, &old_allocation);
resized = (old_allocation.width != allocation->width ||
old_allocation.height != allocation->height);
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
{
gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
if (resized)
gtk_ruler_make_pixmap (ruler);
}
}
static gboolean
gtk_ruler_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
GtkAllocation allocation;
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
gint x;
gint y;
gdk_event_request_motions (event);
x = event->x;
y = event->y;
gtk_widget_get_allocation (widget, &allocation);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
priv->position = priv->lower + ((priv->upper - priv->lower) * x) / allocation.width;
else
priv->position = priv->lower + ((priv->upper - priv->lower) * y) / allocation.height;
g_object_notify (G_OBJECT (ruler), "position");
gtk_widget_queue_draw (widget);
return FALSE;
}
static gboolean
gtk_ruler_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
cairo_set_source_surface (cr, priv->backing_store, 0, 0);
cairo_paint (cr);
if (GTK_RULER_GET_CLASS (ruler)->draw_pos)
GTK_RULER_GET_CLASS (ruler)->draw_pos (ruler, cr);
return FALSE;
}
static void
gtk_ruler_make_pixmap (GtkRuler *ruler)
{
GtkRulerPrivate *priv = ruler->priv;
GtkAllocation allocation;
GtkWidget *widget;
widget = GTK_WIDGET (ruler);
gtk_widget_get_allocation (widget, &allocation);
if (priv->backing_store)
cairo_surface_destroy (priv->backing_store);
priv->backing_store = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
allocation.width,
allocation.height);
priv->xsrc = 0;
priv->ysrc = 0;
gtk_ruler_draw_ticks (ruler);
}
static void
gtk_ruler_real_draw_ticks (GtkRuler *ruler,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (ruler);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint i, j;
gint w, h;
gint width, height;
gint xthickness;
gint ythickness;
gint length, ideal_length;
gdouble lower, upper; /* Upper and lower limits, in ruler units */
gdouble increment; /* Number of pixels per unit */
gint scale; /* Number of units per major unit */
gdouble subd_incr;
gdouble start, end, cur;
gchar unit_str[32];
gint digit_height;
gint digit_offset;
gint text_width;
gint text_height;
gint pos;
PangoLayout *layout;
PangoRectangle logical_rect, ink_rect;
style = gtk_widget_get_style (widget);
xthickness = style->xthickness;
ythickness = style->ythickness;
layout = gtk_widget_create_pango_layout (widget, "012456789");
pango_layout_get_extents (layout, &ink_rect, &logical_rect);
digit_height = PANGO_PIXELS (ink_rect.height) + 2;
digit_offset = ink_rect.y;
w = gtk_widget_get_allocated_width (widget);
h = gtk_widget_get_allocated_height (widget);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
width = w;
height = h - ythickness * 2;
}
else
{
width = h;
height = w - ythickness * 2;
}
#define DETAILE(private) (priv->orientation == GTK_ORIENTATION_HORIZONTAL ? "hruler" : "vruler");
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
gtk_paint_box (style, cr,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
widget,
priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
"hruler" : "vruler",
0, 0,
w, h);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_rectangle (cr,
xthickness,
height + ythickness,
w - 2 * xthickness,
1);
}
else
{
cairo_rectangle (cr,
height + xthickness,
ythickness,
1,
h - 2 * ythickness);
}
upper = priv->upper / priv->metric->pixels_per_unit;
lower = priv->lower / priv->metric->pixels_per_unit;
if ((upper - lower) == 0)
goto out;
increment = (gdouble) width / (upper - lower);
/* determine the scale H
* We calculate the text size as for the vruler, so that the result
* for the scale looks consistent with an accompanying vruler
*/
/* determine the scale V
* use the maximum extents of the ruler to determine the largest
* possible number to be displayed. Calculate the height in pixels
* of this displayed text. Use this height to find a scale which
* leaves sufficient room for drawing the ruler.
*/
scale = ceil (priv->max_size / priv->metric->pixels_per_unit);
g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
text_width = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
if (priv->metric->ruler_scale[scale] * fabs(increment) > 2 * text_width)
break;
}
else
{
text_height = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
if (priv->metric->ruler_scale[scale] * fabs(increment) > 2 * text_height)
break;
}
if (scale == MAXIMUM_SCALES)
scale = MAXIMUM_SCALES - 1;
/* drawing starts here */
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gdouble) priv->metric->ruler_scale[scale] /
(gdouble) priv->metric->subdivide[i];
if (subd_incr * fabs(increment) <= MINIMUM_INCR)
continue;
/* Calculate the length of the tickmarks. Make sure that
* this length increases for each set of ticks
*/
ideal_length = height / (i + 1) - 1;
if (ideal_length > ++length)
length = ideal_length;
if (lower < upper)
{
start = floor (lower / subd_incr) * subd_incr;
end = ceil (upper / subd_incr) * subd_incr;
}
else
{
start = floor (upper / subd_incr) * subd_incr;
end = ceil (lower / subd_incr) * subd_incr;
}
for (cur = start; cur <= end; cur += subd_incr)
{
pos = ROUND ((cur - lower) * increment);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_rectangle (cr,
pos, height + ythickness - length,
1, length);
}
else
{
cairo_rectangle (cr,
height + xthickness - length, pos,
length, 1);
}
cairo_fill (cr);
/* draw label */
if (i == 0)
{
g_snprintf (unit_str, sizeof (unit_str), "%d", (int) cur);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
pango_layout_set_text (layout, unit_str, -1);
pango_layout_get_extents (layout, &logical_rect, NULL);
gtk_paint_layout (style,
cr,
gtk_widget_get_state (widget),
FALSE,
widget,
"hruler",
pos + 2, ythickness + PANGO_PIXELS (logical_rect.y - digit_offset),
layout);
}
else
{
for (j = 0; j < (int) strlen (unit_str); j++)
{
pango_layout_set_text (layout, unit_str + j, 1);
pango_layout_get_extents (layout, NULL, &logical_rect);
gtk_paint_layout (style,
cr,
gtk_widget_get_state (widget),
FALSE,
widget,
"vruler",
xthickness + 1,
pos + digit_height * j + 2 + PANGO_PIXELS (logical_rect.y - digit_offset),
layout);
}
}
}
}
}
cairo_fill (cr);
out:
g_object_unref (layout);
}
static void
gtk_ruler_real_draw_pos (GtkRuler *ruler,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (ruler);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint x, y, width, height;
gint bs_width, bs_height;
gint xthickness;
gint ythickness;
gdouble increment;
style = gtk_widget_get_style (widget);
xthickness = style->xthickness;
ythickness = style->ythickness;
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
height -= ythickness * 2;
bs_width = height / 2 + 2;
bs_width |= 1; /* make sure it's odd */
bs_height = bs_width / 2 + 1;
}
else
{
width -= xthickness * 2;
bs_height = width / 2 + 2;
bs_height |= 1; /* make sure it's odd */
bs_width = bs_height / 2 + 1;
}
if ((bs_width > 0) && (bs_height > 0))
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
increment = (gdouble) width / (priv->upper - priv->lower);
x = ROUND ((priv->position - priv->lower) * increment) + (xthickness - bs_width) / 2 - 1;
y = (height + bs_height) / 2 + ythickness;
}
else
{
increment = (gdouble) height / (priv->upper - priv->lower);
x = (width + bs_width) / 2 + xthickness;
y = ROUND ((priv->position - priv->lower) * increment) + (ythickness - bs_height) / 2 - 1;
}
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
cairo_move_to (cr, x, y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_line_to (cr, x + bs_width / 2.0, y + bs_height);
cairo_line_to (cr, x + bs_width, y);
}
else
{
cairo_line_to (cr, x + bs_width, y + bs_height / 2.0);
cairo_line_to (cr, x, y + bs_height);
}
cairo_fill (cr);
priv->xsrc = x;
priv->ysrc = y;
}
}

View File

@ -1,120 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_RULER_H__
#define __GTK_RULER_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_RULER (gtk_ruler_get_type ())
#define GTK_RULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RULER, GtkRuler))
#define GTK_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RULER, GtkRulerClass))
#define GTK_IS_RULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RULER))
#define GTK_IS_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RULER))
#define GTK_RULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RULER, GtkRulerClass))
typedef struct _GtkRuler GtkRuler;
typedef struct _GtkRulerPrivate GtkRulerPrivate;
typedef struct _GtkRulerClass GtkRulerClass;
typedef struct _GtkRulerMetric GtkRulerMetric;
/* All distances below are in 1/72nd's of an inch. (According to
* Adobe that's a point, but points are really 1/72.27 in.)
*/
struct _GtkRuler
{
GtkWidget widget;
/*< private >*/
GtkRulerPrivate *priv;
};
struct _GtkRulerClass
{
GtkWidgetClass parent_class;
void (* draw_ticks) (GtkRuler *ruler,
cairo_t *cr);
void (* draw_pos) (GtkRuler *ruler,
cairo_t *cr);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
struct _GtkRulerMetric
{
gchar *metric_name;
gchar *abbrev;
/* This should be points_per_unit. This is the size of the unit
* in 1/72nd's of an inch and has nothing to do with screen pixels */
gdouble pixels_per_unit;
gdouble ruler_scale[10];
gint subdivide[5]; /* five possible modes of subdivision */
};
GType gtk_ruler_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_ruler_new (GtkOrientation orientation);
void gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric);
GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler);
void gtk_ruler_set_range (GtkRuler *ruler,
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size);
void gtk_ruler_get_range (GtkRuler *ruler,
gdouble *lower,
gdouble *upper,
gdouble *position,
gdouble *max_size);
G_END_DECLS
#endif /* __GTK_RULER_H__ */

View File

@ -1027,7 +1027,7 @@ gtk_scale_popup (GtkWidget *widget,
device = gdk_event_get_device (event);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);

View File

@ -66,7 +66,8 @@ struct _GtkSelectionData
GdkDisplay *GSEAL (display);
};
struct _GtkTargetEntry {
struct _GtkTargetEntry
{
gchar *target;
guint flags;
guint info;

View File

@ -364,20 +364,22 @@ gtk_spinner_dispose (GObject *gobject)
}
static void
gtk_spinner_set_active (GtkSpinner *spinner, gboolean active)
gtk_spinner_set_active (GtkSpinner *spinner,
gboolean active)
{
GtkSpinnerPrivate *priv;
GtkSpinnerPrivate *priv = spinner->priv;
active = active != FALSE;
priv = GTK_SPINNER (spinner)->priv;
active = !!active;
if (priv->active != active)
{
priv->active = active;
g_object_notify (G_OBJECT (spinner), "active");
if (active && gtk_widget_get_realized (GTK_WIDGET (spinner)) && priv->timeout == 0)
if (active &&
gtk_widget_get_realized (GTK_WIDGET (spinner)) &&
priv->timeout == 0)
{
gtk_spinner_add_timeout (spinner);
}
@ -388,84 +390,7 @@ gtk_spinner_set_active (GtkSpinner *spinner, gboolean active)
}
}
static GType
gtk_spinner_accessible_factory_get_accessible_type (void)
{
return gtk_spinner_accessible_get_type ();
}
static AtkObject *
gtk_spinner_accessible_new (GObject *obj)
{
AtkObject *accessible;
g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL);
accessible = g_object_new (gtk_spinner_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
static AtkObject*
gtk_spinner_accessible_factory_create_accessible (GObject *obj)
{
return gtk_spinner_accessible_new (obj);
}
static void
gtk_spinner_accessible_factory_class_init (AtkObjectFactoryClass *klass)
{
klass->create_accessible = gtk_spinner_accessible_factory_create_accessible;
klass->get_accessible_type = gtk_spinner_accessible_factory_get_accessible_type;
}
static GType
gtk_spinner_accessible_factory_get_type (void)
{
static GType type = 0;
if (!type)
{
const GTypeInfo tinfo =
{
sizeof (AtkObjectFactoryClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_spinner_accessible_factory_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (AtkObjectFactory),
0, /* n_preallocs */
NULL, NULL
};
type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
I_("GtkSpinnerAccessibleFactory"),
&tinfo, 0);
}
return type;
}
static AtkObjectClass *a11y_parent_class = NULL;
static void
gtk_spinner_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
atk_object_set_description (accessible, _("Provides visual indication of progress"));
a11y_parent_class->initialize (accessible, widget);
}
static void
gtk_spinner_accessible_class_init (AtkObjectClass *klass)
{
a11y_parent_class = g_type_class_peek_parent (klass);
klass->initialize = gtk_spinner_accessible_initialize;
}
/* accessible implementation */
static void
gtk_spinner_accessible_image_get_size (AtkImage *image,
@ -476,7 +401,7 @@ gtk_spinner_accessible_image_get_size (AtkImage *image,
GtkWidget *widget;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
if (!widget)
if (widget == NULL)
{
*width = *height = 0;
}
@ -489,62 +414,79 @@ gtk_spinner_accessible_image_get_size (AtkImage *image,
}
static void
gtk_spinner_accessible_image_interface_init (AtkImageIface *iface)
gtk_spinner_accessible_image_iface_init (AtkImageIface *iface)
{
iface->get_image_size = gtk_spinner_accessible_image_get_size;
}
static GType
gtk_spinner_accessible_get_type (void)
/* dummy typedef */
typedef struct _GtkSpinnerAccessible GtkSpinnerAccessible;
typedef struct _GtkSpinnerAccessibleClass GtkSpinnerAccessibleClass;
ATK_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible,
gtk_spinner_accessible,
GTK_TYPE_IMAGE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
gtk_spinner_accessible_image_iface_init));
static void
gtk_spinner_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
static GType type = 0;
ATK_OBJECT_CLASS (gtk_spinner_accessible_parent_class)->initialize (accessible, widget);
/* Action interface
Name etc. ... */
if (G_UNLIKELY (type == 0))
{
const GInterfaceInfo atk_image_info = {
(GInterfaceInitFunc) gtk_spinner_accessible_image_interface_init,
(GInterfaceFinalizeFunc) NULL,
NULL
};
GType parent_atk_type;
GTypeInfo tinfo = { 0 };
GTypeQuery query;
AtkObjectFactory *factory;
atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
atk_object_set_description (accessible, _("Provides visual indication of progress"));
}
if ((type = g_type_from_name ("GtkSpinnerAccessible")))
return type;
static void
gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
{
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
factory = atk_registry_get_factory (atk_get_default_registry (),
GTK_TYPE_IMAGE);
if (!factory)
return G_TYPE_INVALID;
atk_class->initialize = gtk_spinner_accessible_initialize;
}
parent_atk_type = atk_object_factory_get_accessible_type (factory);
if (!parent_atk_type)
return G_TYPE_INVALID;
static void
gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
{
}
/*
* Figure out the size of the class and instance
* we are deriving from
*/
g_type_query (parent_atk_type, &query);
/* factory */
typedef AtkObjectFactory GtkSpinnerAccessibleFactory;
typedef AtkObjectFactoryClass GtkSpinnerAccessibleFactoryClass;
tinfo.class_init = (GClassInitFunc) gtk_spinner_accessible_class_init;
tinfo.class_size = query.class_size;
tinfo.instance_size = query.instance_size;
G_DEFINE_TYPE (GtkSpinnerAccessibleFactory,
gtk_spinner_accessible_factory,
ATK_TYPE_OBJECT_FACTORY);
/* Register the type */
type = g_type_register_static (parent_atk_type,
"GtkSpinnerAccessible",
&tinfo, 0);
static GType
gtk_spinner_accessible_factory_get_accessible_type (void)
{
return gtk_spinner_accessible_get_type ();
}
g_type_add_interface_static (type, ATK_TYPE_IMAGE,
&atk_image_info);
}
static AtkObject *
gtk_spinner_accessible_factory_create_accessible (GObject *obj)
{
AtkObject *accessible;
return type;
accessible = g_object_new (gtk_spinner_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
static void
gtk_spinner_accessible_factory_class_init (AtkObjectFactoryClass *klass)
{
klass->create_accessible = gtk_spinner_accessible_factory_create_accessible;
klass->get_accessible_type = gtk_spinner_accessible_factory_get_accessible_type;
}
static void
gtk_spinner_accessible_factory_init (AtkObjectFactory *factory)
{
}
static AtkObject *
@ -567,8 +509,7 @@ gtk_spinner_get_accessible (GtkWidget *widget)
derived_type = g_type_parent (GTK_TYPE_SPINNER);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry,
derived_type);
factory = atk_registry_get_factory (registry, derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
@ -576,6 +517,7 @@ gtk_spinner_get_accessible (GtkWidget *widget)
gtk_spinner_accessible_factory_get_type ());
first_time = FALSE;
}
return GTK_WIDGET_CLASS (gtk_spinner_parent_class)->get_accessible (widget);
}

998
gtk/gtkswitch.c Normal file
View File

@ -0,0 +1,998 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2010 Intel Corporation
* Copyright (C) 2010 RedHat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
* Matthias Clasen <mclasen@redhat.com>
*
* Based on similar code from:
* Thomas Wood <thos@linux.intel.com>
*/
/**
* SECTION:gtkswitch
* @Short_Description: A "light switch" style toggle
* @Title: GtkSwitch
* @See_Also: #GtkToggleButton
*
* #GtkSwitch is a widget that has two states: on or off. The user can control
* which state should be active by clicking the empty area, or by dragging the
* handle.
*/
#include "config.h"
#include "gtkswitch.h"
#include <gdk/gdkkeysyms.h>
#include "gtkaccessible.h"
#include "gtkactivatable.h"
#include "gtkintl.h"
#include "gtkstyle.h"
#include "gtkprivate.h"
#include "gtktoggleaction.h"
#include "gtkwidget.h"
#define DEFAULT_SLIDER_WIDTH (36)
#define DEFAULT_SLIDER_HEIGHT (22)
struct _GtkSwitchPrivate
{
GdkWindow *event_window;
GtkAction *action;
gint handle_x;
gint offset;
gint drag_start;
gint drag_threshold;
guint is_active : 1;
guint is_dragging : 1;
guint in_press : 1;
guint in_switch : 1;
guint use_action_appearance : 1;
};
enum
{
PROP_0,
PROP_ACTIVE,
PROP_RELATED_ACTION,
PROP_USE_ACTION_APPEARANCE,
LAST_PROP
};
static GParamSpec *switch_props[LAST_PROP] = { NULL, };
static GType gtk_switch_accessible_factory_get_type (void);
static void gtk_switch_activatable_interface_init (GtkActivatableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkSwitch, gtk_switch, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
gtk_switch_activatable_interface_init));
static gboolean
gtk_switch_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
if (priv->is_active)
{
/* if the event occurred in the "off" area, then this
* is a direct toggle
*/
if (event->x <= allocation.width / 2)
{
priv->in_press = TRUE;
return FALSE;
}
priv->offset = event->x - allocation.width / 2;
}
else
{
/* if the event occurred in the "on" area, then this
* is a direct toggle
*/
if (event->x >= allocation.width / 2)
{
priv->in_press = TRUE;
return FALSE;
}
priv->offset = event->x;
}
priv->drag_start = event->x;
g_object_get (gtk_widget_get_settings (widget),
"gtk-dnd-drag-threshold", &priv->drag_threshold,
NULL);
return FALSE;
}
static gboolean
gtk_switch_motion (GtkWidget *widget,
GdkEventMotion *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
/* if this is a direct toggle we don't handle motion */
if (priv->in_press)
return FALSE;
if (ABS (event->x - priv->drag_start) < priv->drag_threshold)
return TRUE;
if (event->state & GDK_BUTTON1_MASK)
{
gint position = event->x - priv->offset;
GtkAllocation allocation;
GtkStyle *style;
style = gtk_widget_get_style (widget);
gtk_widget_get_allocation (widget, &allocation);
/* constrain the handle within the trough width */
if (position > (allocation.width / 2 - style->xthickness))
priv->handle_x = allocation.width / 2 - style->xthickness;
else if (position < style->xthickness)
priv->handle_x = style->xthickness;
else
priv->handle_x = position;
priv->is_dragging = TRUE;
/* we need to redraw the handle */
gtk_widget_queue_draw (widget);
return TRUE;
}
return FALSE;
}
static gboolean
gtk_switch_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
/* dragged toggles have a "soft" grab, so we don't care whether we
* are in the switch or not when the button is released; we do care
* for direct toggles, instead
*/
if (!priv->is_dragging && !priv->in_switch)
return FALSE;
/* direct toggle */
if (priv->in_press)
{
priv->in_press = FALSE;
gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);
return TRUE;
}
/* dragged toggle */
if (priv->is_dragging)
{
priv->is_dragging = FALSE;
/* if half the handle passed the middle of the switch, then we
* consider it to be on
*/
if ((priv->handle_x + (allocation.width / 4)) >= (allocation.width / 2))
{
gtk_switch_set_active (GTK_SWITCH (widget), TRUE);
priv->handle_x = allocation.width / 2;
}
else
{
gtk_switch_set_active (GTK_SWITCH (widget), FALSE);
priv->handle_x = 0;
}
gtk_widget_queue_draw (widget);
return TRUE;
}
return FALSE;
}
static gboolean
gtk_switch_enter (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
if (event->window == priv->event_window)
priv->in_switch = TRUE;
return FALSE;
}
static gboolean
gtk_switch_leave (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
if (event->window == priv->event_window)
priv->in_switch = FALSE;
return FALSE;
}
static gboolean
gtk_switch_key_release (GtkWidget *widget,
GdkEventKey *event)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
if (event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_KP_Enter ||
event->keyval == GDK_KEY_ISO_Enter ||
event->keyval == GDK_KEY_space ||
event->keyval == GDK_KEY_KP_Space)
{
gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);
}
return FALSE;
}
static void
gtk_switch_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkStyle *style = gtk_widget_get_style (widget);
gint width, slider_width, focus_width, focus_pad;
PangoLayout *layout;
PangoRectangle logical_rect;
width = style->xthickness * 2;
gtk_widget_style_get (widget,
"slider-width", &slider_width,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
width += 2 * (focus_width + focus_pad);
/* Translators: if the "on" state label requires more than three
* glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
* the state
*/
layout = gtk_widget_create_pango_layout (widget, C_("switch", "ON"));
pango_layout_get_extents (layout, NULL, &logical_rect);
pango_extents_to_pixels (&logical_rect, NULL);
width += MAX (logical_rect.width, slider_width);
/* Translators: if the "off" state label requires more than three
* glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
*/
pango_layout_set_text (layout, C_("switch", "OFF"), -1);
pango_layout_get_extents (layout, NULL, &logical_rect);
pango_extents_to_pixels (&logical_rect, NULL);
width += MAX (logical_rect.width, slider_width);
g_object_unref (layout);
if (minimum)
*minimum = width;
if (natural)
*natural = width;
}
static void
gtk_switch_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkStyle *style = gtk_widget_get_style (widget);
gint height, focus_width, focus_pad;
PangoLayout *layout;
PangoRectangle logical_rect;
gchar *str;
height = style->ythickness * 2;
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
height += 2 * (focus_width + focus_pad);
str = g_strdup_printf ("%s%s",
C_("switch", "ON"),
C_("switch", "OFF"));
layout = gtk_widget_create_pango_layout (widget, str);
pango_layout_get_extents (layout, NULL, &logical_rect);
pango_extents_to_pixels (&logical_rect, NULL);
height += MAX (DEFAULT_SLIDER_HEIGHT, logical_rect.height);
g_object_unref (layout);
g_free (str);
if (minimum)
*minimum = height;
if (natural)
*natural = height;
}
static void
gtk_switch_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (priv->event_window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
static void
gtk_switch_realize (GtkWidget *widget)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GdkWindow *parent_window;
GdkWindowAttr attributes;
gint attributes_mask;
GtkAllocation allocation;
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, parent_window);
g_object_ref (parent_window);
gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_ONLY;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_POINTER_MOTION_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y;
priv->event_window = gdk_window_new (parent_window,
&attributes,
attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
gtk_widget_style_attach (widget);
}
static void
gtk_switch_unrealize (GtkWidget *widget)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
priv->event_window = NULL;
}
GTK_WIDGET_CLASS (gtk_switch_parent_class)->unrealize (widget);
}
static void
gtk_switch_map (GtkWidget *widget)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GTK_WIDGET_CLASS (gtk_switch_parent_class)->map (widget);
if (priv->event_window)
gdk_window_show (priv->event_window);
}
static void
gtk_switch_unmap (GtkWidget *widget)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
if (priv->event_window)
gdk_window_hide (priv->event_window);
GTK_WIDGET_CLASS (gtk_switch_parent_class)->unmap (widget);
}
static inline void
gtk_switch_paint_handle (GtkWidget *widget,
cairo_t *cr,
GdkRectangle *box)
{
GtkStyle *style = gtk_widget_get_style (widget);
gtk_paint_slider (style, cr,
gtk_widget_get_state (widget),
GTK_SHADOW_OUT,
GTK_WIDGET (widget), "switch-slider",
box->x,
box->y,
box->width,
box->height,
GTK_ORIENTATION_HORIZONTAL);
}
static gboolean
gtk_switch_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkStyle *style;
GdkRectangle handle;
PangoLayout *layout;
PangoRectangle rect;
gint label_x, label_y;
GtkStateType state;
gint focus_width, focus_pad;
gint x, y, width, height;
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
style = gtk_widget_get_style (widget);
x = 0;
y = 0;
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
if (gtk_widget_has_focus (widget))
gtk_paint_focus (style, cr,
gtk_widget_get_state (widget),
widget, "button",
x, y, width, height);
x += focus_width + focus_pad;
y += focus_width + focus_pad;
width -= 2 * (focus_width + focus_pad);
height -= 2 * (focus_width + focus_pad);
state = priv->is_active ? GTK_STATE_SELECTED : gtk_widget_get_state (widget);
/* background - XXX should this be a flat box instead? we're missing
* the border given by the shadow with that, which would require
* fixing all theme engines to add a subtle border for this widget
*/
gtk_paint_box (style, cr,
state,
GTK_SHADOW_IN,
widget, "switch-background",
x, y, width, height);
if (!gtk_widget_is_sensitive (widget))
state = GTK_STATE_INSENSITIVE;
/* XXX the +1/-1 it's pixel wriggling after checking with the default
* theme and xmag
*/
handle.y = y + style->ythickness + 1;
handle.width = (width - style->xthickness * 2) / 2;
handle.height = (height - style->ythickness * 2) - 1;
/* Translators: if the "on" state label requires more than three
* glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
* the state
*/
layout = gtk_widget_create_pango_layout (widget, C_("switch", "ON"));
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
label_x = x + style->xthickness
+ ((width / 2) - rect.width - (style->xthickness * 2)) / 2;
label_y = y + style->ythickness
+ (height - rect.height - (style->ythickness * 2)) / 2;
gtk_paint_layout (style, cr,
state,
FALSE,
widget, "switch-on-label",
label_x, label_y,
layout);
g_object_unref (layout);
/* Translators: if the "off" state label requires more than three
* glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
*/
layout = gtk_widget_create_pango_layout (widget, C_("switch", "OFF"));
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
label_x = x + style->xthickness
+ (width / 2)
+ ((width / 2) - rect.width - (style->xthickness * 2)) / 2;
label_y = y + style->ythickness
+ (height - rect.height - (style->ythickness * 2)) / 2;
gtk_paint_layout (style, cr,
state,
FALSE,
widget, "switch-off-label",
label_x, label_y,
layout);
g_object_unref (layout);
if (priv->is_dragging)
handle.x = x + priv->handle_x;
else if (priv->is_active)
handle.x = x + width - handle.width - style->xthickness;
else
handle.x = x + style->xthickness;
gtk_switch_paint_handle (widget, cr, &handle);
return FALSE;
}
static AtkObject *
gtk_switch_get_accessible (GtkWidget *widget)
{
static gboolean first_time = TRUE;
if (G_UNLIKELY (first_time))
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for the
* parent type of GtkSwitch
*/
derived_type = g_type_parent (GTK_TYPE_SWITCH);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry, derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
GTK_TYPE_SWITCH,
gtk_switch_accessible_factory_get_type ());
first_time = FALSE;
}
return GTK_WIDGET_CLASS (gtk_switch_parent_class)->get_accessible (widget);
}
static void
gtk_switch_set_related_action (GtkSwitch *sw,
GtkAction *action)
{
GtkSwitchPrivate *priv = sw->priv;
if (priv->action == action)
return;
gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (sw), action);
priv->action = action;
}
static void
gtk_switch_set_use_action_appearance (GtkSwitch *sw,
gboolean use_appearance)
{
GtkSwitchPrivate *priv = sw->priv;
if (priv->use_action_appearance != use_appearance)
{
priv->use_action_appearance = use_appearance;
gtk_activatable_sync_action_properties (GTK_ACTIVATABLE (sw), priv->action);
}
}
static void
gtk_switch_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkSwitch *sw = GTK_SWITCH (gobject);
switch (prop_id)
{
case PROP_ACTIVE:
gtk_switch_set_active (sw, g_value_get_boolean (value));
break;
case PROP_RELATED_ACTION:
gtk_switch_set_related_action (sw, g_value_get_object (value));
break;
case PROP_USE_ACTION_APPEARANCE:
gtk_switch_set_use_action_appearance (sw, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gtk_switch_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkSwitchPrivate *priv = GTK_SWITCH (gobject)->priv;
switch (prop_id)
{
case PROP_ACTIVE:
g_value_set_boolean (value, priv->is_active);
break;
case PROP_RELATED_ACTION:
g_value_set_object (value, priv->action);
break;
case PROP_USE_ACTION_APPEARANCE:
g_value_set_boolean (value, priv->use_action_appearance);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
gtk_switch_dispose (GObject *object)
{
GtkSwitchPrivate *priv = GTK_SWITCH (object)->priv;
if (priv->action)
{
gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (object), NULL);
priv->action = NULL;
}
G_OBJECT_CLASS (gtk_switch_parent_class)->dispose (object);
}
static void
gtk_switch_class_init (GtkSwitchClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gpointer activatable_iface;
g_type_class_add_private (klass, sizeof (GtkSwitchPrivate));
activatable_iface = g_type_default_interface_peek (GTK_TYPE_ACTIVATABLE);
switch_props[PROP_RELATED_ACTION] =
g_param_spec_override ("related-action",
g_object_interface_find_property (activatable_iface,
"related-action"));
switch_props[PROP_USE_ACTION_APPEARANCE] =
g_param_spec_override ("use-action-appearance",
g_object_interface_find_property (activatable_iface,
"use-action-appearance"));
/**
* GtkSwitch:active:
*
* Whether the #GtkSwitch widget is in its on or off state.
*/
switch_props[PROP_ACTIVE] =
g_param_spec_boolean ("active",
P_("Active"),
P_("Whether the switch is on or off"),
FALSE,
GTK_PARAM_READWRITE);
gobject_class->set_property = gtk_switch_set_property;
gobject_class->get_property = gtk_switch_get_property;
gobject_class->dispose = gtk_switch_dispose;
g_object_class_install_properties (gobject_class, LAST_PROP, switch_props);
widget_class->get_preferred_width = gtk_switch_get_preferred_width;
widget_class->get_preferred_height = gtk_switch_get_preferred_height;
widget_class->size_allocate = gtk_switch_size_allocate;
widget_class->realize = gtk_switch_realize;
widget_class->unrealize = gtk_switch_unrealize;
widget_class->map = gtk_switch_map;
widget_class->unmap = gtk_switch_unmap;
widget_class->draw = gtk_switch_draw;
widget_class->button_press_event = gtk_switch_button_press;
widget_class->button_release_event = gtk_switch_button_release;
widget_class->motion_notify_event = gtk_switch_motion;
widget_class->enter_notify_event = gtk_switch_enter;
widget_class->leave_notify_event = gtk_switch_leave;
widget_class->key_release_event = gtk_switch_key_release;
widget_class->get_accessible = gtk_switch_get_accessible;
/**
* GtkSwitch:slider-width:
*
* The minimum width of the #GtkSwitch handle, in pixels.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("slider-width",
P_("Slider Width"),
P_("The minimum width of the handle"),
DEFAULT_SLIDER_WIDTH, G_MAXINT,
DEFAULT_SLIDER_WIDTH,
GTK_PARAM_READABLE));
}
static void
gtk_switch_init (GtkSwitch *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_SWITCH, GtkSwitchPrivate);
self->priv->use_action_appearance = TRUE;
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
}
/**
* gtk_switch_new:
*
* Creates a new #GtkSwitch widget.
*
* Return value: the newly created #GtkSwitch instance
*
* Since: 3.0
*/
GtkWidget *
gtk_switch_new (void)
{
return g_object_new (GTK_TYPE_SWITCH, NULL);
}
/**
* gtk_switch_set_active:
* @sw: a #GtkSwitch
* @is_active: %TRUE if @sw should be active, and %FALSE otherwise
*
* Changes the state of @sw to the desired one.
*
* Since: 3.0
*/
void
gtk_switch_set_active (GtkSwitch *sw,
gboolean is_active)
{
GtkSwitchPrivate *priv;
g_return_if_fail (GTK_IS_SWITCH (sw));
is_active = !!is_active;
priv = sw->priv;
if (priv->is_active != is_active)
{
AtkObject *accessible;
priv->is_active = is_active;
g_object_notify_by_pspec (G_OBJECT (sw), switch_props[PROP_ACTIVE]);
if (priv->action)
gtk_action_activate (priv->action);
accessible = gtk_widget_get_accessible (GTK_WIDGET (sw));
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, priv->is_active);
gtk_widget_queue_draw (GTK_WIDGET (sw));
}
}
/**
* gtk_switch_get_active:
* @sw: a #GtkSwitch
*
* Gets whether the #GtkSwitch is in its "on" or "off" state.
*
* Return value: %TRUE if the #GtkSwitch is active, and %FALSE otherwise
*
* Since: 3.0
*/
gboolean
gtk_switch_get_active (GtkSwitch *sw)
{
g_return_val_if_fail (GTK_IS_SWITCH (sw), FALSE);
return sw->priv->is_active;
}
static void
gtk_switch_update (GtkActivatable *activatable,
GtkAction *action,
const gchar *property_name)
{
if (strcmp (property_name, "visible") == 0)
{
if (gtk_action_is_visible (action))
gtk_widget_show (GTK_WIDGET (activatable));
else
gtk_widget_hide (GTK_WIDGET (activatable));
}
else if (strcmp (property_name, "sensitive") == 0)
{
gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
}
else if (strcmp (property_name, "active") == 0)
{
gtk_action_block_activate (action);
gtk_switch_set_active (GTK_SWITCH (activatable), gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
gtk_action_unblock_activate (action);
}
}
static void
gtk_switch_sync_action_properties (GtkActivatable *activatable,
GtkAction *action)
{
if (!action)
return;
if (gtk_action_is_visible (action))
gtk_widget_show (GTK_WIDGET (activatable));
else
gtk_widget_hide (GTK_WIDGET (activatable));
gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
gtk_action_block_activate (action);
gtk_switch_set_active (GTK_SWITCH (activatable), gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
gtk_action_unblock_activate (action);
}
static void
gtk_switch_activatable_interface_init (GtkActivatableIface *iface)
{
iface->update = gtk_switch_update;
iface->sync_action_properties = gtk_switch_sync_action_properties;
}
/* accessibility: object */
/* dummy typedefs */
typedef struct _GtkSwitchAccessible GtkSwitchAccessible;
typedef struct _GtkSwitchAccessibleClass GtkSwitchAccessibleClass;
ATK_DEFINE_TYPE (GtkSwitchAccessible, _gtk_switch_accessible, GTK_TYPE_WIDGET);
static AtkStateSet *
gtk_switch_accessible_ref_state_set (AtkObject *accessible)
{
AtkStateSet *state_set;
GtkWidget *widget;
state_set = ATK_OBJECT_CLASS (_gtk_switch_accessible_parent_class)->ref_state_set (accessible);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
if (widget == NULL)
return state_set;
if (gtk_switch_get_active (GTK_SWITCH (widget)))
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
return state_set;
}
static void
_gtk_switch_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
ATK_OBJECT_CLASS (_gtk_switch_accessible_parent_class)->initialize (accessible, widget);
atk_object_set_role (accessible, ATK_ROLE_TOGGLE_BUTTON);
atk_object_set_name (accessible, C_("light switch widget", "Switch"));
atk_object_set_description (accessible, _("Switches between on and off states"));
}
static void
_gtk_switch_accessible_class_init (GtkSwitchAccessibleClass *klass)
{
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
atk_class->initialize = _gtk_switch_accessible_initialize;
atk_class->ref_state_set = gtk_switch_accessible_ref_state_set;
}
static void
_gtk_switch_accessible_init (GtkSwitchAccessible *self)
{
}
/* accessibility: factory */
typedef AtkObjectFactoryClass GtkSwitchAccessibleFactoryClass;
typedef AtkObjectFactory GtkSwitchAccessibleFactory;
G_DEFINE_TYPE (GtkSwitchAccessibleFactory,
gtk_switch_accessible_factory,
ATK_TYPE_OBJECT_FACTORY);
static GType
gtk_switch_accessible_factory_get_accessible_type (void)
{
return _gtk_switch_accessible_get_type ();
}
static AtkObject *
gtk_switch_accessible_factory_create_accessible (GObject *obj)
{
AtkObject *accessible;
accessible = g_object_new (_gtk_switch_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
static void
gtk_switch_accessible_factory_class_init (AtkObjectFactoryClass *klass)
{
klass->create_accessible = gtk_switch_accessible_factory_create_accessible;
klass->get_accessible_type = gtk_switch_accessible_factory_get_accessible_type;
}
static void
gtk_switch_accessible_factory_init (AtkObjectFactory *factory)
{
}

95
gtk/gtkswitch.h Normal file
View File

@ -0,0 +1,95 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2010 Intel Corporation
* Copyright (C) 2010 RedHat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
* Matthias Clasen <mclasen@redhat.com>
*
* Based on similar code from:
* Thomas Wood <thos@linux.intel.com>
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_SWITCH_H__
#define __GTK_SWITCH_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_SWITCH (gtk_switch_get_type ())
#define GTK_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SWITCH, GtkSwitch))
#define GTK_IS_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SWITCH))
#define GTK_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SWITCH, GtkSwitchClass))
#define GTK_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SWITCH))
#define GTK_SWITCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SWITCH, GtkSwitchClass))
typedef struct _GtkSwitch GtkSwitch;
typedef struct _GtkSwitchPrivate GtkSwitchPrivate;
typedef struct _GtkSwitchClass GtkSwitchClass;
/**
* GtkSwitch:
*
* The <structname>GtkSwitch</structname> structure contains private
* data and it should only be accessed using the provided API.
*/
struct _GtkSwitch
{
/*< private >*/
GtkWidget parent_instance;
GtkSwitchPrivate *priv;
};
/**
* GtkSwitchClass:
*
* The <structname>GtkSwitchClass</structname> structure contains only
* private data.
*/
struct _GtkSwitchClass
{
/*< private >*/
GtkWidgetClass parent_class;
void (* _switch_padding_1) (void);
void (* _switch_padding_2) (void);
void (* _switch_padding_3) (void);
void (* _switch_padding_4) (void);
void (* _switch_padding_5) (void);
void (* _switch_padding_6) (void);
void (* _switch_padding_7) (void);
};
GType gtk_switch_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_switch_new (void);
void gtk_switch_set_active (GtkSwitch *sw,
gboolean is_active);
gboolean gtk_switch_get_active (GtkSwitch *sw);
G_END_DECLS
#endif /* __GTK_SWITCH_H__ */

View File

@ -1350,7 +1350,7 @@ _gtk_tooltip_focus_in (GtkWidget *widget)
device = gtk_get_current_event_device ();
if (device && device->source == GDK_SOURCE_KEYBOARD)
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
/* This function should be called by either a focus in event,

View File

@ -10407,7 +10407,7 @@ send_focus_change (GtkWidget *widget,
GdkEvent *fevent;
GdkWindow *window;
if (dev->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD)
continue;
window = gtk_widget_get_window (widget);

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkorientable.h"
#include "gtkvruler.h"
/**
* SECTION:gtkvruler
* @Short_description: A vertical ruler
* @Title: GtkVRuler
*
* <note>
* This widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
* </note>
*
* The VRuler widget is a widget arranged vertically creating a ruler that is
* utilized around other widgets such as a text widget. The ruler is used to show
* the location of the mouse on the window and to show the size of the window in
* specified units. The available units of measurement are GTK_PIXELS, GTK_INCHES
* and GTK_CENTIMETERS. GTK_PIXELS is the default unit of measurement.
*/
G_DEFINE_TYPE (GtkVRuler, gtk_vruler, GTK_TYPE_RULER)
static void
gtk_vruler_class_init (GtkVRulerClass *klass)
{
}
static void
gtk_vruler_init (GtkVRuler *vruler)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (vruler),
GTK_ORIENTATION_VERTICAL);
}
/**
* gtk_vruler_new:
*
* Creates a new vertical ruler
*
* Returns: a new #GtkVRuler.
*/
GtkWidget *
gtk_vruler_new (void)
{
return g_object_new (GTK_TYPE_VRULER, NULL);
}

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_VRULER_H__
#define __GTK_VRULER_H__
#include <gtk/gtkruler.h>
G_BEGIN_DECLS
#define GTK_TYPE_VRULER (gtk_vruler_get_type ())
#define GTK_VRULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VRULER, GtkVRuler))
#define GTK_VRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VRULER, GtkVRulerClass))
#define GTK_IS_VRULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VRULER))
#define GTK_IS_VRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VRULER))
#define GTK_VRULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VRULER, GtkVRulerClass))
typedef struct _GtkVRuler GtkVRuler;
typedef struct _GtkVRulerClass GtkVRulerClass;
struct _GtkVRuler
{
GtkRuler ruler;
};
struct _GtkVRulerClass
{
GtkRulerClass parent_class;
};
GType gtk_vruler_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_vruler_new (void);
G_END_DECLS
#endif /* __GTK_VRULER_H__ */

View File

@ -5923,7 +5923,7 @@ do_focus_change (GtkWidget *widget,
GdkDevice *dev = d->data;
GdkEvent *fevent;
if (dev->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD)
continue;
/* Skip non-master keyboards that haven't

View File

@ -248,7 +248,6 @@ gtk_OBJECTS = \
gtkhbbox.obj \
gtkhbox.obj \
gtkhpaned.obj \
gtkhruler.obj \
gtkhscale.obj \
gtkhscrollbar.obj \
gtkhseparator.obj \
@ -305,7 +304,6 @@ gtk_OBJECTS = \
gtkrange.obj \
gtkrbtree.obj \
gtkrc.obj \
gtkruler.obj \
gtkscale.obj \
gtkscalebutton.obj \
gtkscrollbar.obj \
@ -347,7 +345,6 @@ gtk_OBJECTS = \
gtkviewport.obj \
gtkvolumebutton.obj \
gtkvpaned.obj \
gtkvruler.obj \
gtkvscale.obj \
gtkvscrollbar.obj \
gtkvseparator.obj \
@ -433,7 +430,6 @@ gtk_public_h_sources = \
gtkhbbox.h \
gtkhbox.h \
gtkhpaned.h \
gtkhruler.h \
gtkhscale.h \
gtkhscrollbar.h \
gtkhseparator.h \
@ -496,7 +492,6 @@ gtk_public_h_sources = \
gtkrecentchooserwidget.h \
gtkrecentfilter.h \
gtkrecentmanager.h \
gtkruler.h \
gtkscale.h \
gtkscalebutton.h \
gtkscrollbar.h \
@ -555,7 +550,6 @@ gtk_public_h_sources = \
gtkviewport.h \
gtkvolumebutton.h \
gtkvpaned.h \
gtkvruler.h \
gtkvscale.h \
gtkvscrollbar.h \
gtkvseparator.h \
@ -573,7 +567,7 @@ gtk_extra_sources = \
gtk.def: gtk.symbols makefile.msc
echo EXPORTS > gtk.def
cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES \
cl /EP -DG_OS_WIN32 \
-DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= \
-DG_GNUC_PRINTF=;G_GNUC_PRINTF gtk.symbols >> gtk.def

View File

@ -722,7 +722,6 @@ test_types (void)
" <object class=\"GtkHButtonBox\" id=\"hbuttonbox\"/>"
" <object class=\"GtkHBox\" id=\"hbox\"/>"
" <object class=\"GtkHPaned\" id=\"hpaned\"/>"
" <object class=\"GtkHRuler\" id=\"hruler\"/>"
" <object class=\"GtkHScale\" id=\"hscale\"/>"
" <object class=\"GtkHScrollbar\" id=\"hscrollbar\"/>"
" <object class=\"GtkHSeparator\" id=\"hseparator\"/>"
@ -749,7 +748,6 @@ test_types (void)
" <object class=\"GtkVScrollbar\" id=\"vscrollbar\"/>"
" <object class=\"GtkVSeparator\" id=\"vseparator\"/>"
" <object class=\"GtkViewport\" id=\"viewport\"/>"
" <object class=\"GtkVRuler\" id=\"vruler\"/>"
" <object class=\"GtkVPaned\" id=\"vpaned\"/>"
" <object class=\"GtkVScale\" id=\"vscale\"/>"
" <object class=\"GtkWindow\" id=\"window\"/>"

View File

@ -1424,6 +1424,32 @@ validate_file (const gchar *file)
return TRUE;
}
/**
* safe_fclose:
* @f: A FILE* stream, must have underlying fd
*
* Unix defaults for data preservation after system crash
* are unspecified, and many systems will eat your data
* in this situation unless you explicitly fsync().
*
* Returns: %TRUE on success, %FALSE on failure, and will set errno()
*/
static gboolean
safe_fclose (FILE *f)
{
int fd = fileno (f);
g_assert (fd >= 0);
if (fflush (f) == EOF)
return FALSE;
#ifndef G_OS_WIN32
if (fsync (fd) < 0)
return FALSE;
#endif
if (fclose (f) == EOF)
return FALSE;
return TRUE;
}
static void
build_cache (const gchar *path)
{
@ -1432,7 +1458,6 @@ build_cache (const gchar *path)
gchar *bak_cache_path = NULL;
#endif
GHashTable *files;
gboolean retval;
FILE *cache;
struct stat path_stat, cache_stat;
struct utimbuf utime_buf;
@ -1490,18 +1515,23 @@ opentmp:
}
/* FIXME: Handle failure */
retval = write_file (cache, files, directories);
fclose (cache);
g_list_foreach (directories, (GFunc)g_free, NULL);
g_list_free (directories);
if (!retval)
if (!write_file (cache, files, directories))
{
g_unlink (tmp_cache_path);
exit (1);
}
if (!safe_fclose (cache))
{
g_printerr (_("Failed to write cache file: %s\n"), g_strerror (errno));
g_unlink (tmp_cache_path);
exit (1);
}
cache = NULL;
g_list_foreach (directories, (GFunc)g_free, NULL);
g_list_free (directories);
if (!validate_file (tmp_cache_path))
{
g_printerr (_("The generated cache was invalid.\n"));

View File

@ -86,7 +86,6 @@ gtk/gtkhandlebox.c
gtk/gtkhbbox.c
gtk/gtkhbox.c
gtk/gtkhpaned.c
gtk/gtkhruler.c
gtk/gtkhscale.c
gtk/gtkhscrollbar.c
gtk/gtkhseparator.c
@ -147,7 +146,6 @@ gtk/gtkrecentchooser.c
gtk/gtkrecentchooserdefault.c
gtk/gtkrecentchoosermenu.c
gtk/gtkrecentmanager.c
gtk/gtkruler.c
gtk/gtkscalebutton.c
gtk/gtkscale.c
gtk/gtkscrollbar.c
@ -164,6 +162,7 @@ gtk/gtkstatusbar.c
gtk/gtkstatusicon.c
gtk/gtkstock.c
gtk/gtkstyle.c
gtk/gtkswitch.c
gtk/gtktable.c
gtk/gtktearoffmenuitem.c
gtk/gtktextbuffer.c
@ -205,7 +204,6 @@ gtk/gtkvbox.c
gtk/gtkviewport.c
gtk/gtkvolumebutton.c
gtk/gtkvpaned.c
gtk/gtkvruler.c
gtk/gtkvscale.c
gtk/gtkvscrollbar.c
gtk/gtkvseparator.c

View File

@ -1,10 +1 @@
demos/gtk-demo/demo.ui
gdk-pixbuf/io-gdip-bmp.c
gdk-pixbuf/io-gdip-emf.c
gdk-pixbuf/io-gdip-gif.c
gdk-pixbuf/io-gdip-ico.c
gdk-pixbuf/io-gdip-jpeg.c
gdk-pixbuf/io-gdip-png.c
gdk-pixbuf/io-gdip-utils.c
gdk-pixbuf/io-gdip-wmf.c

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,6 @@ gtk/gtkhandlebox.c
gtk/gtkhbbox.c
gtk/gtkhbox.c
gtk/gtkhpaned.c
gtk/gtkhruler.c
gtk/gtkhscale.c
gtk/gtkhscrollbar.c
gtk/gtkhseparator.c
@ -147,7 +146,6 @@ gtk/gtkrecentchooser.c
gtk/gtkrecentchooserdefault.c
gtk/gtkrecentchoosermenu.c
gtk/gtkrecentmanager.c
gtk/gtkruler.c
gtk/gtkscalebutton.c
gtk/gtkscale.c
gtk/gtkscrollbar.c
@ -165,6 +163,7 @@ gtk/gtkstatusbar.c
gtk/gtkstatusicon.c
gtk/gtkstock.c
gtk/gtkstyle.c
gtk/gtkswitch.c
gtk/gtktable.c
gtk/gtktearoffmenuitem.c
gtk/gtktextbuffer.c
@ -206,7 +205,6 @@ gtk/gtkvbox.c
gtk/gtkviewport.c
gtk/gtkvolumebutton.c
gtk/gtkvpaned.c
gtk/gtkvruler.c
gtk/gtkvscale.c
gtk/gtkvscrollbar.c
gtk/gtkvseparator.c

View File

@ -1,3 +1,2 @@
demos/gtk-demo/demo.ui
gtk/paper_names.c

2222
po/de.po

File diff suppressed because it is too large Load Diff

1897
po/id.po

File diff suppressed because it is too large Load Diff

1826
po/ro.po

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: gtk+ master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2b&component=general\n"
"POT-Creation-Date: 2010-10-12 17:16+0000\n"
"PO-Revision-Date: 2010-10-12 20:07+0100\n"
"Last-Translator: Matej Urbančič <mateju@svn.gnome.org>\n"
"PO-Revision-Date: 2010-11-29 09:32+0100\n"
"Last-Translator: Andrej Žnidaršič <andrej.znidarsic@gmail.com>\n"
"Language-Team: Slovenian GNOME Translation Team <gnome-si@googlegroups.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
@ -103,12 +103,12 @@ msgstr "Premik nazaj"
#: ../gdk/keyname-table.h:3941
msgctxt "keyboard label"
msgid "Tab"
msgstr "Tab"
msgstr "Tabulator"
#: ../gdk/keyname-table.h:3942
msgctxt "keyboard label"
msgid "Return"
msgstr "Vnesi"
msgstr "Vnosna tipka"
#: ../gdk/keyname-table.h:3943
msgctxt "keyboard label"
@ -398,7 +398,7 @@ msgstr "Grafična podobo oblikovali"
#: ../gtk/gtkaccellabel.c:160
msgctxt "keyboard label"
msgid "Shift"
msgstr "Premakni"
msgstr "Shift"
#. This is the text that should appear next to menu accelerators
#. * that use the control key. If the text on this key isn't typically

View File

@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: gtk+\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-10-01 15:41-0400\n"
"PO-Revision-Date: 2010-04-06 15:08+0700\n"
"PO-Revision-Date: 2010-11-29 18:55+0700\n"
"Last-Translator: Theppitak Karoonboonyanan <thep@linux.thai.net>\n"
"Language-Team: Thai <thai-l10n@googlegroups.com>\n"
"Language: th\n"
@ -70,9 +70,8 @@ msgstr "SCREEN"
#. Description of --gdk-debug=FLAGS in --help output
#: gdk/gdk.c:164
#, fuzzy
msgid "GDK debugging flags to set"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะเปิดใช้"
msgstr "แฟล็กการดีบั๊กของ GDK ที่จะเปิดใช้"
#. Placeholder in --gdk-debug=FLAGS in --help output
#. Placeholder in --gdk-no-debug=FLAGS in --help output
@ -84,9 +83,8 @@ msgstr "FLAGS"
#. Description of --gdk-no-debug=FLAGS in --help output
#: gdk/gdk.c:167
#, fuzzy
msgid "GDK debugging flags to unset"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะปิด"
msgstr "แฟล็กการดีบั๊กของ GDK ที่จะปิด"
#: gdk/keyname-table.h:3940
msgctxt "keyboard label"
@ -330,7 +328,7 @@ msgstr "เรียกใช้ X แบบประสานเวลา"
#: gtk/gtkaboutdialog.c:101
#, c-format
msgid "This program comes with ABSOLUTELY NO WARRANTY; for details, visit %s"
msgstr ""
msgstr "โปรแกรมนี้ไม่มีการรับประกันใดๆ ดูรายละเอียดเพิ่มเติมได้ที่ %s"
#: gtk/gtkaboutdialog.c:339 gtk/gtkaboutdialog.c:2235
msgid "License"
@ -455,9 +453,9 @@ msgid "Invalid type function on line %d: '%s'"
msgstr "ฟังก์ชันถามชนิดใช้ไม่ได้ที่บรรทัด %d: '%s'"
#: gtk/gtkbuilderparser.c:407
#, fuzzy, c-format
#, c-format
msgid "Duplicate object ID '%s' on line %d (previously on line %d)"
msgstr "id ของอ็อบเจกต์ '%s' ซ้ำที่บรรทัด %d (ใช้แล้วที่บรรทัด %d)"
msgstr "ID ของอ็อบเจกต์ '%s' ซ้ำที่บรรทัด %d (ใช้แล้วที่บรรทัด %d)"
#: gtk/gtkbuilderparser.c:859
#, c-format
@ -612,9 +610,8 @@ msgid "_Saturation:"
msgstr "ความส_ด:"
#: gtk/gtkcolorsel.c:421
#, fuzzy
msgid "Intensity of the color."
msgstr "ความโปร่งแสงของสี"
msgstr "ความเข้มของสี"
#: gtk/gtkcolorsel.c:422
msgid "_Value:"
@ -789,12 +786,11 @@ msgstr "แ_ทรกอักขระควบคุมของยูนิ
#: gtk/gtkentry.c:10015
msgid "Caps Lock and Num Lock are on"
msgstr ""
msgstr "ปุ่ม Caps Lock และ Num Lock ติดอยู่"
#: gtk/gtkentry.c:10017
#, fuzzy
msgid "Num Lock is on"
msgstr "ปุ่ม Caps Lock ติดอยู่"
msgstr "ปุ่ม Num Lock ติดอยู่"
#: gtk/gtkentry.c:10019
msgid "Caps Lock is on"
@ -1267,12 +1263,12 @@ msgstr "ให้ความสำคัญกับคำเตือนปร
#. Description of --gtk-debug=FLAGS in --help output
#: gtk/gtkmain.c:532
msgid "GTK+ debugging flags to set"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะเปิดใช้"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะเปิดใช้"
#. Description of --gtk-no-debug=FLAGS in --help output
#: gtk/gtkmain.c:535
msgid "GTK+ debugging flags to unset"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะปิด"
msgstr "แฟล็กการดีบักของ GTK+ ที่จะปิด"
#. Translate to default:RTL if you want your widgets
#. * to be RTL, otherwise translate to default:LTR.
@ -1333,9 +1329,9 @@ msgid "Remember _forever"
msgstr "จำรหัสผ่านไว้_ตลอดไป"
#: gtk/gtkmountoperation.c:883
#, fuzzy, c-format
#, c-format
msgid "Unknown Application (PID %d)"
msgstr "โปรแกรมไม่ทราบชื่อ (pid %d)"
msgstr "โปรแกรมไม่ทราบชื่อ (PID %d)"
#: gtk/gtkmountoperation.c:1066
#, c-format
@ -1347,9 +1343,9 @@ msgid "_End Process"
msgstr "_จบโพรเซส"
#: gtk/gtkmountoperation-stub.c:64
#, fuzzy, c-format
#, c-format
msgid "Cannot kill process with PID %d. Operation is not implemented."
msgstr "ไม่สามารถฆ่าโพรเซสที่มี pid %d ได้ เนื่องจากยังไม่ได้ทำปฏิบัติการนี้"
msgstr "ไม่สามารถฆ่าโพรเซสที่มี PID %d ได้ เนื่องจากยังไม่ได้พัฒนาปฏิบัติการนี้"
#. translators: this string is a name for the 'less' command
#: gtk/gtkmountoperation-x11.c:862
@ -1373,9 +1369,9 @@ msgid "Z Shell"
msgstr "Z Shell"
#: gtk/gtkmountoperation-x11.c:963
#, fuzzy, c-format
#, c-format
msgid "Cannot end process with PID %d: %s"
msgstr "ไม่สามารถจบโพรเซสที่มี pid %d ได้: %s"
msgstr "ไม่สามารถจบโพรเซสที่มี PID %d ได้: %s"
#: gtk/gtknotebook.c:4619 gtk/gtknotebook.c:7170
#, c-format
@ -1450,9 +1446,8 @@ msgid "Not available"
msgstr "ไม่มี"
#: gtk/gtkprinteroptionwidget.c:794
#, fuzzy
msgid "Select a folder"
msgstr "เลือกแฟ้ม"
msgstr "เลือกโฟลเดอร์"
#: gtk/gtkprinteroptionwidget.c:813
msgid "_Save in folder:"
@ -2091,10 +2086,9 @@ msgid "_Cancel"
msgstr "_ยกเลิก"
#: gtk/gtkstock.c:326
#, fuzzy
msgctxt "Stock label"
msgid "_CD-ROM"
msgstr "_ซีดีรอม"
msgstr "ซีดี_รอม"
#: gtk/gtkstock.c:327
msgctxt "Stock label"
@ -2152,7 +2146,6 @@ msgid "_Edit"
msgstr "แ_ก้ไข"
#: gtk/gtkstock.c:338
#, fuzzy
msgctxt "Stock label"
msgid "_File"
msgstr "แ_ฟ้ม"
@ -2231,7 +2224,6 @@ msgid "_Up"
msgstr "_ขึ้น"
#: gtk/gtkstock.c:360
#, fuzzy
msgctxt "Stock label"
msgid "_Hard Disk"
msgstr "ฮาร์_ดดิสก์"
@ -2569,9 +2561,9 @@ msgid "The attribute \"%s\" was found twice on the <%s> element"
msgstr "พบแอตทริบิวต์ \"%s\" ซ้ำในอิลิเมนต์ <%s>"
#: gtk/gtktextbufferserialize.c:845
#, fuzzy, c-format
#, c-format
msgid "<%s> element has invalid ID \"%s\""
msgstr "อิลิเมนต์ <%s> มี id \"%s\" ซึ่งไม่ถูกต้อง"
msgstr "อิลิเมนต์ <%s> มี ID \"%s\" ซึ่งไม่ถูกต้อง"
#: gtk/gtktextbufferserialize.c:855
#, c-format
@ -3886,7 +3878,7 @@ msgid "Printer '%s' is out of paper."
msgstr "เครื่องพิมพ์ '%s' กระดาษหมด"
#: modules/printbackends/cups/gtkprintbackendcups.c:1686
#, fuzzy, c-format
#, c-format
msgid "Printer '%s' is currently offline."
msgstr "เครื่องพิมพ์ '%s' ออฟไลน์อยู่"
@ -4195,10 +4187,10 @@ msgid ""
msgstr "เปิดแฟ้มรูปภาพ '%s' ไม่สำเร็จ: ไม่แน่ใจว่าเพราะอะไร แต่อาจเป็นเพราะแฟ้มเสียหาย"
#~ msgid "Gdk debugging flags to set"
#~ msgstr "แฟล็กการดีบักของ GDK ที่จะเปิดใช้"
#~ msgstr "แฟล็กการดีบักของ GDK ที่จะเปิดใช้"
#~ msgid "Gdk debugging flags to unset"
#~ msgstr "แฟล็กการดีบักของ GDK ที่จะปิด"
#~ msgstr "แฟล็กการดีบักของ GDK ที่จะปิด"
#~ msgid "Image file '%s' contains no data"
#~ msgstr "แฟ้มรูปภาพ '%s' ไม่มีข้อมูล"

Some files were not shown because too many files have changed in this diff Show More