Compare commits
49 Commits
gtk-2-20
...
kris-async
Author | SHA1 | Date | |
---|---|---|---|
|
65bdb7ca9a | ||
|
c0d7735260 | ||
|
163fa10926 | ||
|
6694dbddb9 | ||
|
24762914ca | ||
|
7cea08bbb6 | ||
|
31d0084f7e | ||
|
e0792b0e3a | ||
|
32d750ea51 | ||
|
0c9e045b23 | ||
|
064abaf966 | ||
|
31d15343ae | ||
|
9c9ab7d977 | ||
|
614bbed704 | ||
|
914b750cbf | ||
|
2b419300fd | ||
|
5a72f83bc8 | ||
|
77a5e4877d | ||
|
8e337ee801 | ||
|
541805189c | ||
|
33cd7bec0e | ||
|
0ad7ea990a | ||
|
86092bb99a | ||
|
a5a40428d6 | ||
|
80253eef39 | ||
|
67bcafbaa6 | ||
|
5671cd6e72 | ||
|
6d05ff46d0 | ||
|
504e508a94 | ||
|
6d95ee973d | ||
|
640183f70c | ||
|
13e0ec79b5 | ||
|
75984fc181 | ||
|
f0b4533cdc | ||
|
44c163f421 | ||
|
dcec12da93 | ||
|
c14393c33c | ||
|
909146bd83 | ||
|
881e00c1d9 | ||
|
f471b51452 | ||
|
e71098346e | ||
|
dd8ceb472f | ||
|
185de00018 | ||
|
f983226842 | ||
|
08db22f008 | ||
|
a86b453f7a | ||
|
aaac16bf9d | ||
|
8b7d8e13c0 | ||
|
0291a22d10 |
37
.cvsignore
Normal file
37
.cvsignore
Normal file
@@ -0,0 +1,37 @@
|
||||
*.lo
|
||||
config.log
|
||||
config.h
|
||||
config.h.in
|
||||
libtool
|
||||
config.status
|
||||
stamp-h
|
||||
stamp-h1
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
config.h.win32
|
||||
gtk-config-2.0
|
||||
config.cache
|
||||
ABOUT-NLS
|
||||
intl
|
||||
stamp-h.in
|
||||
gtk+.spec
|
||||
gtk+-2.0.pc
|
||||
gtk+-2.0-uninstalled.pc
|
||||
gtk+-linux-fb-2.0.pc
|
||||
gtk+-nanox-2.0.pc
|
||||
gtk+-x11-2.0.pc
|
||||
gdk-2.0.pc
|
||||
gdk-2.0-uninstalled.pc
|
||||
gdk-linux-fb-2.0.pc
|
||||
gdk-nanox-2.0.pc
|
||||
gdk-x11-2.0.pc
|
||||
gdk-pixbuf-2.0.pc
|
||||
gdk-pixbuf-2.0-uninstalled.pc
|
||||
gtk-zip.sh
|
||||
missing
|
||||
install-sh
|
||||
mkinstalldirs
|
||||
sgml
|
||||
autom4te.cache
|
20
AUTHORS
20
AUTHORS
@@ -1,12 +1,12 @@
|
||||
Please do not mail any of the authors listed here
|
||||
asking questions about this version of GTK+.
|
||||
|
||||
Original Authors
|
||||
----------------
|
||||
Peter Mattis <petm@xcf.berkeley.edu>
|
||||
Spencer Kimball <spencer@xcf.berkeley.edu>
|
||||
Josh MacDonald <jmacd@xcf.berkeley.edu>
|
||||
|
||||
Please do not mail the original authors asking questions about this
|
||||
version of GTK+.
|
||||
|
||||
The GTK+ Team (in alphabetical order)
|
||||
-------------------------------------
|
||||
Shawn T. Amundson <amundson@gtk.org>
|
||||
@@ -32,7 +32,7 @@ There are many others who have contributed patches; we thank them,
|
||||
GTK+ is much better because of them.
|
||||
|
||||
|
||||
Over time, GTK+ has incorporated some pieces of software which
|
||||
Over time, TK+ has incorporated some pieces of software which
|
||||
started as independent projects. We list the original authors here:
|
||||
|
||||
|
||||
@@ -51,15 +51,3 @@ IME input method
|
||||
----------------
|
||||
Takuro Ashie
|
||||
Kazuki IWAMOTO
|
||||
|
||||
|
||||
Mac OS X backend
|
||||
----------------
|
||||
Anders Carlsson
|
||||
|
||||
|
||||
DirectFB backend
|
||||
----------------
|
||||
Denis Oliver Kropp
|
||||
Sven Neumann
|
||||
Mike Emmel
|
||||
|
@@ -1,514 +0,0 @@
|
||||
2006-04-30 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.[ch] (gtk_file_info_render_icon): remove the
|
||||
caching code,
|
||||
(gtk_file_info_get_icon_name): new function,
|
||||
(gtk_file_system_volume_get_icon_name): new function,
|
||||
(gtk_file_system_volume_render_icon): refactor to use
|
||||
get_icon_name() and render the icon on the fly.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_volume_render_icon),
|
||||
(gtk_file_system_unix_volume_get_icon_name): reflect updates in
|
||||
file system interface,
|
||||
(get_fallback_icon): remove, along with icon caching code.
|
||||
|
||||
* gtk/gtk.symbols: updated.
|
||||
|
||||
2006-04-30 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemmodel.c (got_root_folder_cb), (ref_path_cb),
|
||||
(get_children_get_folder_cb): don't leak the handle,
|
||||
(got_root_folder_cb), (get_children_get_folder_cb): emit
|
||||
row-inserted for the newly added nodes.
|
||||
|
||||
2006-04-30 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (file_list_drag_data_select_uris),
|
||||
(file_list_drag_data_received_get_info_cb),
|
||||
(file_list_drag_data_received_cb): refactor code for selecting
|
||||
multiple uris into file_list_drag_data_select_uris().
|
||||
|
||||
2006-04-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (dnd_select_folder_get_info_cb): don't
|
||||
leak handle,
|
||||
(change_icon_theme_get_info_cb), (set_info_get_info_cb),
|
||||
(model_add_special_get_info_cb), (update_label_get_info_cb): ditto.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (shortcuts_reload_icons_get_info_cb):
|
||||
don't leak the handle,
|
||||
(get_file_info_finished), (edited_idle_create_folder_cb),
|
||||
(file_list_drag_data_received_get_info_cb),
|
||||
(show_and_select_paths_get_folder_cb),
|
||||
(update_current_folder_get_info_cb), (add_shortcut_get_info_cb),
|
||||
(confirmation_confirm_get_info_cb), (action_create_folder_cb),
|
||||
(save_entry_get_info_cb), (shortcuts_activate_volume_mount_cb),
|
||||
(shortcuts_activate_get_info_cb), (update_from_entry_get_info_cb):
|
||||
ditto.
|
||||
|
||||
* gtk/gtkfilechooserentry.c (load_directory_get_folder_callback):
|
||||
don't leak the handle.
|
||||
|
||||
* gtk/gtkpathbar.c (set_button_image_get_info_cb),
|
||||
(gtk_path_bar_get_info_callback): don't leak the handle.
|
||||
|
||||
2006-04-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Review.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (shortcuts_reload_icons_get_info_cb):
|
||||
don't forget to unref data->impl at the end.
|
||||
|
||||
2006-04-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Review, continued.
|
||||
|
||||
* gtk/gtkfilechooserdialog.c (response_cb): set response_requested
|
||||
to FALSE after stopping emission of the response signal.
|
||||
|
||||
2006-03-16 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
More review work.
|
||||
|
||||
* gtk/gtkfilechooserprivate.h: remove idle_finished_loading_source
|
||||
from GtkFileSystemModel.
|
||||
|
||||
* gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): remove
|
||||
idle_finished_loading_source,
|
||||
(idle_finished_loading_cb), (queue_finished_loading): removed,
|
||||
(got_root_folder_cb): save a list walk, immediately emit
|
||||
finished-loading and don't queue it, since we are already in an
|
||||
idle here, always list_children() so the children the folder already
|
||||
has are returned,
|
||||
(_gtk_file_system_model_new): handle the case where NULL is
|
||||
returned by _get_folder(),
|
||||
(_gtk_file_system_model_path_do): remove comment, and append the
|
||||
new handle to the list, don't try to remove,
|
||||
(get_children_get_folder_cb): save a list walk, remove the dummy
|
||||
child if the _get_folder() call fails or is cancelled.
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
More suggestions from Federico.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_create_folder):
|
||||
remove check for filename_is_root(), since we never hit that code
|
||||
and else mkdir will fail anyway,
|
||||
(gtk_file_system_unix_create_folder): fixup parent folder refresh
|
||||
code.
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemunix.c (read_hidden_file), (fill_in_hidden),
|
||||
(get_is_hidden_for_file): factor out g_file_get_contents() code
|
||||
in read_hidden_file(). (Federico Mena Quintero).
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Icon name code suggestions by Federico Mena Quintero.
|
||||
|
||||
* gtk/gtkfilesystemunix.c: add GTK_FILE_INFO_ICON to
|
||||
STAT_NEEDED_MASK,
|
||||
(get_fallback_icon_name), (get_fallback_icon),
|
||||
(get_icon_name_for_directory), (get_special_icon_name): get rid
|
||||
of strdups,
|
||||
(get_icon_type_from_path): add a statbuf argument and use the
|
||||
statbuf when folder_unix is NULL,
|
||||
(create_file_info): adapt to work with above changes.
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_info): path
|
||||
is NULL is an error here (gtk_file_system_get_info() already guards
|
||||
path = NULL),
|
||||
(gtk_file_system_unix_get_info): move basename creation to just
|
||||
before create_file_info(). (Federico Mena Quintero).
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemunix.c (struct _GtkFileFolderUnix): add
|
||||
load_folder_id field,
|
||||
(load_folder): add thread enter/leave construct, set load_folder_id
|
||||
to zero since we have the idle removed when we return,
|
||||
(gtk_file_system_unix_get_folder): initialize load_folder_id to 0
|
||||
and store the source id of the load_folder idle,
|
||||
(gtk_file_folder_unix_finalize): remove the load_folder idle
|
||||
if necessary. (Federico Mena Quintero).
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooser.c (gtk_file_chooser_get_current_folder): return
|
||||
NULL if there is no current folder path.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_map): we
|
||||
reload the current folder if there is one, else we continue the
|
||||
still pending load.
|
||||
|
||||
2006-03-14 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Couple of fixes from Markku Vire.
|
||||
|
||||
* gtk/gtkfilesystem.c (gtk_file_info_copy): also strdup icon_name
|
||||
and display_key.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_create_folder):
|
||||
initialize error to NULL,
|
||||
(gtk_file_folder_unix_list_children): return an empty list for now if
|
||||
we couldn't read the directory.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb),
|
||||
(gtk_file_chooser_default_update_current_folder): set and unset
|
||||
busy cursor while checking whether the given path is a folder.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.h: change the GtkFileInfo argument of the
|
||||
GetInfoCallback to be const.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c, gtk/gtkfilechooserdefault.c,
|
||||
gtk/gtkpathbar.c: changes functions to reflect the above change.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c, gtk/gtkfilechooserprivate.h: keep track
|
||||
of handles, cancel all pending operations on dispose.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserprivate.h (struct _GtkFileSystemModel): add
|
||||
pending_handles field,
|
||||
(struct _FileModelNode): add load_pending flag.
|
||||
|
||||
* gtk/gtkfilesystemmodel.c (gtk_file_system_model_dispose): introduce,
|
||||
cancel all pending operations here,
|
||||
(got_root_folder_cb), (_gtk_file_system_model_new), (ref_path_cb),
|
||||
(_gtk_file_system_model_path_do): keep track of all pending
|
||||
operations, handle cancelled operations.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_finalize),
|
||||
(gtk_file_chooser_button_destroy): move all handle cancellations
|
||||
and object unrefs to destroy.
|
||||
|
||||
* gtk/gtkpathbar.c (gtk_path_bar_finalize), (gtk_path_bar_dispose):
|
||||
likewise.
|
||||
|
||||
* gtk/gtkfilechooserentry.c (gtk_file_chooser_entry_class_init):
|
||||
add dispose,
|
||||
(gtk_file_chooser_entry_dispose): cancel handles and unrefs
|
||||
objects here instead of finalize.
|
||||
|
||||
2005-12-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.c (get_cached_icon): check if "name" is an
|
||||
absolute path, if so load the icon from that file.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): fix
|
||||
the build.
|
||||
|
||||
2005-12-21 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): remove
|
||||
the FIXME since it doesn't make sense, when we return a cached
|
||||
folder we won't emit finished-loading either,
|
||||
(gtk_file_system_unix_create_folder): remove unused variable,
|
||||
(gtk_file_folder_unix_list_children): remove unused code,
|
||||
(get_is_hidden_for_file): new function,
|
||||
(create_file_info): also handle getting is_hidden when called
|
||||
without a folder unix (from _system_get_info() for example).
|
||||
|
||||
2005-12-20 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (check_is_folder): fully removed!
|
||||
woo!,
|
||||
(check_save_entry): add is_folder argument,
|
||||
(gtk_file_chooser_default_get_paths): update check_save_entry() call,
|
||||
(get_display_name_for_folder): removed,
|
||||
(confirmation_confirm_get_info_cb): new function which will
|
||||
handle the confirmation dialog now we have all information for it,
|
||||
(should_respond_after_confirm_overwrite): replace the call to
|
||||
get_display_name_for_folder() with an asynchronous solution,
|
||||
(action_create_folder_cb): request dialog response on successfull
|
||||
folder creation,
|
||||
(gtk_file_chooser_default_should_respond): update call to
|
||||
check_save_entry(); replace the check is folder call for "path"
|
||||
by just using the is_folder return value from check_save_entry();
|
||||
replaced the check is folder call for "parent_path" with an
|
||||
asynchronous setup, remainder of that work is now done in
|
||||
save_entry_get_info_cb(),
|
||||
(save_entry_get_info_cb): new function.
|
||||
|
||||
* gtk/gtkfilechoosermebed.[ch]: add response-requested signal.
|
||||
|
||||
* gtk/gtkfilechooserdialog.c, gtk/gtkfilechooserprivate.h: handle
|
||||
response_requested signal.
|
||||
|
||||
* gtk/gtkfilechooserentry.[ch]
|
||||
(_gtk_file_chooser_entry_get_is_folder): new function.
|
||||
|
||||
2005-12-20 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (ref_path_cb): when called with
|
||||
!folder, check if node is the node we are looking for (can be
|
||||
triggered when we call ref_path_cb ourselves after a find_child_node),
|
||||
(_gtk_file_system_model_path_do): introduce parent_node field;
|
||||
after finding a child node in a loaded parent node, don't forget
|
||||
to call ref_path_cb,
|
||||
(get_children_get_folder_cb): don't forget to set data->node->folder
|
||||
to the newly acquired folder.
|
||||
|
||||
2005-12-20 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (show_and_select_paths_get_folder_cb):
|
||||
handle case where the folder we get already finished loading.
|
||||
|
||||
* gtk/gtkfilesystemmodel.c (ref_path_cb),
|
||||
(_gtk_file_system_model_path_do): make this work.
|
||||
|
||||
2005-12-19 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (shortcuts_update_count): modify
|
||||
in such a way that it can also negatively update the count on
|
||||
failures,
|
||||
(get_file_info_finished): handle failures, update save folder
|
||||
combo box on success,
|
||||
(shortcuts_insert_path): change the boolean return value into a
|
||||
void one, also refilter the model and update the save folder combo
|
||||
box for the non-asynchronous case,
|
||||
(shortcuts_append_home), (shortcuts_append_desktop),
|
||||
(shortcuts_add_volumes), (shortcuts_add_current_folder),
|
||||
(add_shortcuts_get_info_cb): adapt to shortcuts_insert_path() updates.
|
||||
|
||||
2005-12-19 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkpathbar.[ch]: add handle fields to ButtonData and
|
||||
GtkPathBar; do correct handle bookkeeping.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (load_folder),
|
||||
(gtk_file_system_unix_get_folder),
|
||||
(gtk_file_folder_unix_is_finished_loading): add is_finished_loading
|
||||
field to GtkFileFolderUnix, which is set to true once we are
|
||||
really finished with loading (previous assumption that we are
|
||||
always finshed loading is not true anymore).
|
||||
|
||||
* gtk/gtkfilesystemmodel.c (got_root_folder_cb): if the folder is
|
||||
finished loading, list the children and update the root level.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
|
||||
handle cancellation.
|
||||
|
||||
2005-12-16 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystemunix.c: always call the callback, even when
|
||||
cancelled; ref handles passed to the callback queue functions;
|
||||
don't set cancelled to TRUE in _cancel_operation(), since operations
|
||||
in this backend are always completed,
|
||||
(get_special_icon_name): don't strdup the value of
|
||||
get_icon_name_for_directory() again.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c: adapt to new cancellation policy;
|
||||
reference all objects which are passed as callback arguments; in the
|
||||
callback check if the handles match.
|
||||
|
||||
* gtk/gtkfilechooserentry.c: likewise.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: likewise. Also changed the shortcut
|
||||
loading code to be more like the code in GtkFileChooserButton, where
|
||||
we store all handles in the model and have model_row_free_data
|
||||
cancel any pending operations,
|
||||
(shortcuts_model_create): copy the error.
|
||||
|
||||
* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserDefault): remove
|
||||
loading_volumes and loading_bookmarks fields.
|
||||
|
||||
* gtk/gtkfilesystem.c (gtk_file_info_free): free icon_name here...
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (edited_idle_create_folder_cb): fix
|
||||
thinko.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (dispatch_create_folder_callback),
|
||||
(queue_create_folder_callback): need to copy/free the path,
|
||||
(gtk_file_system_unix_create_folder): put the "reget folder" hack
|
||||
back in, though it's working different now.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_finalize),
|
||||
(dnd_select_folder_get_info_cb), (gtk_file_chooser_drag_data_received),
|
||||
(change_icon_theme_get_info_cb), (change_icon_theme),
|
||||
(model_add_special_get_info_cb), (model_add_special),
|
||||
(update_label_get_info_cb), (update_label_and_image): cancel existing
|
||||
operations, if any; added apprioriate fields to
|
||||
GtkFileChooserButtonPrivate.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserentry.c (gtk_file_chooser_entry_finalize): if
|
||||
there's a folder loading, cancel the operation,
|
||||
(load_directory_get_folder_callback): set the loading folder handle
|
||||
to NULL,
|
||||
(load_directory_callback): cancel any currently loading folders
|
||||
before starting a new get folder operation.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): don't overwrite
|
||||
data if it's already set (for example by the "is volume" case).
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (set_info_get_info_cb),
|
||||
(set_info_for_path_at_iter): store a row reference in the temporary
|
||||
data structure and not an iter,
|
||||
(model_add_special), (model_update_current_folder),
|
||||
(gtk_file_chooser_button_add_shorcut_folder): remove unused pixbuf
|
||||
variable.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (get_file_info_finished),
|
||||
(shortcuts_insert_path): replace gtk_file_system_render_icon() call
|
||||
with gtk_file_system_get_file_info(),
|
||||
(gtk_file_chooser_default_add_shortcut_folder),
|
||||
(gtk_file_chooser_default_remove_shortcut_folder): handle shortcuts
|
||||
which are still loading.
|
||||
|
||||
* gtk/gtkfilechooserprivate.h: add shortcuts_loading field to
|
||||
struct _GtkFileChooserDefault.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (set_info_get_info_cb),
|
||||
(set_info_for_path_at_iter), (model_free_row_data): keep handle
|
||||
and path together; now supports adding/removing shortcuts
|
||||
which are still loading.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.c: make the cancelled field an GObject property.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.h: make the GError argument in the callbacks
|
||||
const.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c: update callbacks,
|
||||
* gtk/gtkfilechooserentry.c: likewise,
|
||||
* gtk/gtkfilechooserdefault.c: likewise,
|
||||
* gtk/gtkfilesystemmodel.c: likewise,
|
||||
* gtk/gtkpathbar.c: likewise.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (edited_idle_create_folder_cb): copy
|
||||
the error which will be passed to error_creating_folder_dialog(),
|
||||
(action_create_folder_cb): likewise,
|
||||
(file_list_drag_data_received_get_info_cb): add forgotten GError
|
||||
declaration.
|
||||
|
||||
2005-12-13 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkpathbar.c (get_button_image), (set_button_image),
|
||||
(set_button_image_get_info_cb),
|
||||
(gtk_path_bar_update_button_appearance): update to new icon
|
||||
rendering call.
|
||||
|
||||
2005-12-09 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (file_list_drag_data_received),
|
||||
(gtk_file_chooser_default_add_shortcut_folder),
|
||||
(shortcuts_activate_get_info_cb): replace synchronous check_is_folder
|
||||
calls with an async gtk_file_system_get_info() solution.
|
||||
|
||||
2005-12-09 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilesystem.c (icon_cache_element_free), (icon_theme_changed),
|
||||
(get_cached_icon), (gtk_file_info_render_icon): implement pixbuf
|
||||
caching as found in the file system backends.
|
||||
|
||||
2005-12-09 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtk.symbols: updated.
|
||||
|
||||
* gtk/gtkfilesystem.[ch] (struct GtkFileInfo): added icon_name field,
|
||||
(enum GtkFileInfoType): added GTK_FILE_INFO_ICON,
|
||||
(gtk_file_info_set_icon_name): new function,
|
||||
(gtk_file_info_render_icon): new function,
|
||||
(gtk_file_system_render_icon): removed.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_render_icon): removed,
|
||||
(create_file_info): fill icon_name field if required,
|
||||
(get_*_icon): modified to suit create_file_info() better.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c: modified to use
|
||||
gtk_file_info_render_icon() instead of gtk_file_system_render_icon().
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: likewise.
|
||||
|
||||
2005-12-06 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (get_file_info_finished),
|
||||
(update_current_folder_get_info_cb): fix mem leaks.
|
||||
|
||||
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_info): ditto.
|
||||
|
||||
* gtk/gtkpathbar.c (gtk_path_bar_set_path_finish): ditto.
|
||||
|
||||
2005-12-06 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (dnd_select_folder_get_info_cb),
|
||||
(gtk_file_chooser_button_drag_data_received): make asynchronous,
|
||||
(update_label_and_image): remove unused variable.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c
|
||||
(gtk_file_chooser_default_update_current_folder): split in two
|
||||
functions, so we can have the is_folder check back.
|
||||
* gtk/gtkfilechooserprivate.h: add update_current_folder_handle
|
||||
field.
|
||||
|
||||
2005-12-06 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (show_and_select_paths): fixed a typo.
|
||||
|
||||
2005-12-05 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
(merge from HEAD)
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (trap_activate_cb): "event->state &
|
||||
modifiers", not "event->state && modifiers". Patch by Sadrul
|
||||
Habib Chowdhury <imadil@gmail.com>. Fixes bug #323073.
|
||||
|
||||
2005-12-06 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Beginnings of an asynchronous file chooser.
|
||||
|
||||
* gtk/gtkfilechooserbutton.c: display name and the is folder property
|
||||
are now asynchronously set using set_info_for_at_path_iter(), the
|
||||
is folder property is now also stored in the tree model.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c: lots of changes to the shortcuts
|
||||
model code to make it operate asynchronously, check_is_folder() has
|
||||
been "disabled" for now, all other synchronous calls were
|
||||
replaced with asychronous ones.
|
||||
|
||||
* gtk/gtkfilechooserentry.c: update call to
|
||||
gtk_file_system_get_folder().
|
||||
|
||||
* gtk/gtkfilechooserprivate.h: added two fields.
|
||||
|
||||
* gtk/gtkfilesystem.[ch]: for about 85% changed to the changes
|
||||
outlined in the proposal discussed on gtk-devel-list.
|
||||
|
||||
* gtk/gtkfilesystemmodel.[ch]: updated all asynchronous calls,
|
||||
_gtk_file_system_model_path_do() basically had to be rewritten
|
||||
(and I still need to finish that).
|
||||
|
||||
* gtk/gtkfilesystemunix.c: changed to be compatible with the new
|
||||
GtkFileSystem interface.
|
||||
|
||||
* gtk/gtkpathbar.c (button_clicked_cb): block/unblock the
|
||||
button_clicked_cb callback around the call to
|
||||
gtk_toggle_button_set_active(), avoids button_clicked_cb getting
|
||||
called twice.
|
||||
(_gtk_path_bar_set_path): refactored to be asynchronous.
|
@@ -1,500 +0,0 @@
|
||||
2006-04-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* docs/tools/widgets.c (get_all_widgets): Add print dialog
|
||||
and page setup dialog.
|
||||
|
||||
2006-04-11 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkpapersize.c (gtk_paper_size_get_display_name):
|
||||
Call gettext on the standard paper names.
|
||||
|
||||
2006-04-11 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gdk/gdk.symbols:
|
||||
* gdk/win32/gdkevents-win32.c:
|
||||
* gdk/win32/gdkwin32.h:
|
||||
Add gdk_win32_set_modal_dialog_libgtk_only that we
|
||||
need for handling the mainloop in the print dialogs.
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Pump the gtk+ mainloop when needed in the print dialogs.
|
||||
This means gtk+ windows will redraw while the print dialogs
|
||||
are up.
|
||||
|
||||
2006-04-10 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Better size handling.
|
||||
Save win32-specific settings in additions to the generic ones
|
||||
if the generic one is lossy.
|
||||
|
||||
2006-04-10 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Finish implementing run_page_setup_dialog.
|
||||
|
||||
* gtk/gtkpagesetup.h:
|
||||
* gtk/gtkpapersize.h:
|
||||
* gtk/gtkprint-win32.h:
|
||||
* gtk/gtkprintcontext.h:
|
||||
* gtk/gtkprinter-private.h:
|
||||
* gtk/gtkprintoperation-private.h:
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
* gtk/gtkprintoperation.h:
|
||||
* gtk/gtkprintsettings.h:
|
||||
s/EGG/GTK/
|
||||
|
||||
2006-04-09 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk+-unix-print-2.0.pc.in: Fix a typo (#337698)
|
||||
|
||||
2006-04-07 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/paper_names_offsets.c:
|
||||
* gtk/gen-paper-names.c: Correct the suffix/duplicate optimizations.
|
||||
|
||||
2006-04-07 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Initial work on gtk_print_run_page_setup_dialog.
|
||||
Not reading margins yet.
|
||||
|
||||
2006-04-07 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/Makefile.am:
|
||||
Link to winspool
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtkprintoperation-private.h:
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
* gtk/gtkprintoperation.[ch]:
|
||||
Add gtk_print_operation_get_status_string() and status
|
||||
string to _gtk_print_operation_set_status.
|
||||
Rename GTK_PRINT_STATUS_PROCESSING to GTK_PRINT_STATUS_PRINTING.
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Poll for status updates
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
Rename GTK_PRINT_STATUS_PROCESSING to GTK_PRINT_STATUS_PRINTING.
|
||||
|
||||
* tests/print-editor.c:
|
||||
Show print status string
|
||||
|
||||
2006-04-06 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/paper_names_offsets.c:
|
||||
* gtk/gtkpapersize.c: Save 4K of .data by converting
|
||||
the array of paper names to offsets.
|
||||
|
||||
* gtk/gen-paper-names.c: Utility used to create
|
||||
paper_names_offsets.c from paper_names.c.
|
||||
|
||||
* gtk/Makefile.am: Necessary glue.
|
||||
|
||||
2006-04-06 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Use glib base64 code.
|
||||
Set up manual_* vars fully.
|
||||
|
||||
2006-04-06 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/Makefile.am:
|
||||
Add -lcomdlg32 on win32
|
||||
|
||||
* gtk/gtkprint-win32.h:
|
||||
Move WINVER define to .c files
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
Add empty gtk_print_run_page_setup win implementation
|
||||
Move WINVER define to this file
|
||||
|
||||
* modules/Makefile.am:
|
||||
Only build print backends on unix
|
||||
|
||||
2006-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
* gtk/gtkprintoperation-unix.c: Use GTK_RESPONSE_CANCEL/OK
|
||||
instead of GTK_RESPONSE_REJECT/ACCEPT, to make Esc close
|
||||
the dialog, and to not use values which are documented
|
||||
as reserved for apps.
|
||||
|
||||
2006-04-05 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* modules/printbackends/lpr/gtkprintbackendlpr.c:
|
||||
Don't hardcode lpr command, expose full commandline.
|
||||
|
||||
2006-04-05 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Don't check for printer changes after dialog is dead.
|
||||
|
||||
* gtk/gtkprintbackend.c: (gtk_print_backend_load_modules):
|
||||
Strip whitespace from backend strings
|
||||
|
||||
* gtk/gtkprintbackend.h:
|
||||
Add private printer functions
|
||||
|
||||
* gtk/gtkprinter-private.h:
|
||||
Move GtkPrinterPrivate into gtkprinter.c
|
||||
|
||||
* gtk/gtkprinter.[ch]:
|
||||
Move GtkPrinterPrivate into gtkprinter.c
|
||||
Add new construct properties.
|
||||
Add setter functions.
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
* modules/printbackends/cups/gtkprintercups.[ch]:
|
||||
Update to new APIs.
|
||||
|
||||
* modules/printbackends/lpr/Makefile.am:
|
||||
* modules/printbackends/lpr/gtkprintbackendlpr.c:
|
||||
* modules/printbackends/lpr/gtkprinterlpr.[ch]
|
||||
Update to new APIs.
|
||||
Remove GtkPrinterLPR.
|
||||
Read/Save command line option in settings
|
||||
|
||||
* modules/printbackends/pdf/Makefile.am:
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c:
|
||||
* modules/printbackends/pdf/gtkprinterpdf.[ch]:
|
||||
Update to new APIs.
|
||||
Remove GtkPrinterPDF.
|
||||
|
||||
2006-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.h: Add missing standard
|
||||
GObject macros. (#337277, Yevgen Muntyan)
|
||||
|
||||
2006-04-04 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprinteroption.[ch]:
|
||||
Add gtk_printer_option_has_choice.
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
Add support for "print at time".
|
||||
|
||||
2006-04-04 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpapersize.c:
|
||||
Handle ppd names with ".Transverse" suffix
|
||||
Don't force width < height
|
||||
|
||||
* gtk/gtkprinteroption.c:
|
||||
Make sure that value is never NULL.
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
Add some HP whitelist names
|
||||
Remove spew from ignored options.
|
||||
|
||||
2006-04-03 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
Fix warnings
|
||||
|
||||
* gtk/gtkprinter-private.h:
|
||||
* gtk/gtkprinter.[ch]:
|
||||
Add gtk_printer_is_default.
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Use gtk_printer_is_default.
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
Get default printer info
|
||||
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c:
|
||||
Fix warning.
|
||||
|
||||
2006-04-03 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c:
|
||||
* modules/printbackends/pdf/gtkprinterpdf.[ch]:
|
||||
Correctly read/write/use the output filename setting.
|
||||
|
||||
2006-04-03 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
Disable margin from printers if there are no printers.
|
||||
|
||||
* gtk/gtkpapersize.c:
|
||||
Fix build.
|
||||
|
||||
2006-04-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols: protect unix-only symbols by
|
||||
G_OS_UNIX (#336819, Yevgen Muntyan)
|
||||
|
||||
* gtk/gtkpapersize.c: Win32 fixes. (#336806, Yevgen Muntyan)
|
||||
|
||||
2006-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
Update
|
||||
|
||||
* gtk/gtkprintbackend.[ch]:
|
||||
Add dnotify to gtk_print_backend_print_stream
|
||||
|
||||
* gtk/gtkprinter-private.h:
|
||||
Declare gtk_print_job_set_status
|
||||
|
||||
* gtk/gtkprinter.[ch]:
|
||||
Remove gtk_printer_prepare_job.
|
||||
|
||||
* gtk/gtkprintjob.[ch]:
|
||||
Now you create print job directly with gtk_print_job_new() and
|
||||
they'll be prepared automatically.
|
||||
Add status_changed signal and get_status.
|
||||
Add gtk_print_job_set_source_file to allow sending a file.
|
||||
|
||||
* gtk/gtkprintoperation-private.h:
|
||||
Add destroy notify for platform_data.
|
||||
Declare _gtk_print_operation_set_status.
|
||||
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
Hook up status change handling.
|
||||
Use the new way to get a print job.
|
||||
|
||||
* gtk/gtkprintoperation.[ch]:
|
||||
Add status_changed signal and get_status/is_finished.
|
||||
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
* modules/printbackends/lpr/gtkprintbackendlpr.c:
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c:
|
||||
Update to use new APIs and set status on the job.
|
||||
Cups polls for the status.
|
||||
|
||||
* tests/print-editor.c:
|
||||
Track the print operations in the status bar.
|
||||
|
||||
2006-03-30 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/Makefile.am:
|
||||
* gtk/gtkprintbackend.c:
|
||||
Default to "pdf,cups" if we found cups, and
|
||||
"pdf,lpr" otherwise.
|
||||
|
||||
2006-03-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* modules/printbackends/Makefile.am:
|
||||
* configure.in: Don't build the cups backend
|
||||
if cups is not there.
|
||||
|
||||
2006-03-29 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
gtk_printer_prep_job -> gtk_printer_prepare_job
|
||||
gtk_print_job_prep -> gtk_print_job_prepare
|
||||
|
||||
* gtk/gtkprintbackend.h:
|
||||
* gtk/gtkprinter-private.h:
|
||||
* gtk/gtkprinter.[ch]:
|
||||
Add print_job argument to printer_prepare_for_print
|
||||
gtk_printer_prep_job -> gtk_printer_prepare_job
|
||||
|
||||
* gtk/gtkprintjob.[ch]:
|
||||
Add manual rendering settings to GtkPrintJob.
|
||||
gtk_print_job_prep -> gtk_print_job_prepare
|
||||
|
||||
* gtk/gtkprintoperation-private.h:
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
* gtk/gtkprintoperation.c:
|
||||
Get more manual_* settings working.
|
||||
Run mainloop after each printed page.
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Save page ranges.
|
||||
|
||||
* modules/printbackends/cups/gtkprintbackendcups.c:
|
||||
* modules/printbackends/lpr/gtkprintbackendlpr.c:
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c:
|
||||
Now put the manual_* settings inside the PrintJob in
|
||||
prepare_for_print.
|
||||
|
||||
2006-03-29 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Make sure we remember the format-for printer.
|
||||
Also, use it as the default if set.
|
||||
|
||||
2006-03-28 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Remove unnecessary padding under list.
|
||||
|
||||
2006-03-28 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
More HIGy layout.
|
||||
|
||||
2006-03-28 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
HIG conformance of spacing and titles.
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Use standard constructor form print button too.
|
||||
|
||||
2006-03-27 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* modules/printbackends/*/Makefile.am: Fix
|
||||
a problem with builddir != srcdir builds.
|
||||
(#335915, Yevgen Muntyan)
|
||||
|
||||
2006-03-27 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintbackend.c: Simply the syntax
|
||||
of the setting to "cups,pdf", and get rid
|
||||
of the GScanner used to parse it.
|
||||
|
||||
2006-03-27 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Reorder print list so status is at the end.
|
||||
Ellipsize the status column.
|
||||
|
||||
2006-03-27 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
Handle removed printers and status-changed.
|
||||
Handle NULL printer location.
|
||||
|
||||
2006-03-27 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/Makefile.am:
|
||||
* gtk/stock-icons/24/gtk-orientation-landscape.png:
|
||||
* gtk/stock-icons/24/gtk-orientation-portrait.png:
|
||||
* gtk/stock-icons/24/gtk-orientation-reverse-landscape.png:
|
||||
* gtk/gtkiconfactory.c: (get_default_icons):
|
||||
* gtk/gtkstock.h:
|
||||
Add orientation stock icons.
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
Use the orientation icons.
|
||||
|
||||
2006-03-27 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c:
|
||||
* gtk/gtkprintjob.c:
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
s/impl/dialog/
|
||||
Don't prefix static functions with _
|
||||
|
||||
2006-03-26 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintunixdialog.c: Don't use _(""). (#335898,
|
||||
Christian Persch)
|
||||
|
||||
* modules/printbackends/*: Don't use G_DEFINE_TYPE
|
||||
in modules.
|
||||
|
||||
* gtk/gtkprintbackend.c: Remove an unused static function.
|
||||
|
||||
2006-03-25 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols: Add printing symbols
|
||||
|
||||
* gtk/gtkpapersize.[hc]:
|
||||
* gtk/gtkpage*.[hc]:
|
||||
* gtk/gtkprint*.[hc]: Add aliasing, #include cleanups.
|
||||
|
||||
* gtk/gtkprintcontext.h:
|
||||
* gtk/gtkprintoperation.h:
|
||||
* gtk/gtkprintsettings.h: Make get_type function const.
|
||||
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.c: Remove
|
||||
C99ism.
|
||||
|
||||
* modules/printbackends/cups/gtkcupsutils.c: Use unsigned
|
||||
integers for bitfields.
|
||||
|
||||
2006-03-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix docs
|
||||
|
||||
* gtk/Makefile.am (EXTRA_DIST): Add the stock icons here.
|
||||
|
||||
* gdk/directfb/Makefile.am (EXTRA_DIST): Remove ChangeLog,
|
||||
to make make dist happier.
|
||||
|
||||
2006-03-24 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
* gtk/gtkprintbackend.c:
|
||||
* modules/printbackends/Makefile.am:
|
||||
* modules/printbackends/cups/Makefile.am:
|
||||
* modules/printbackends/lpr/Makefile.am:
|
||||
* modules/printbackends/lpr/gtkprintbackendlpr.[ch]:
|
||||
* modules/printbackends/lpr/gtkprinterlpr.[ch]:
|
||||
* modules/printbackends/pdf/Makefile.am:
|
||||
* modules/printbackends/pdf/gtkprintbackendpdf.[ch]:
|
||||
* modules/printbackends/pdf/gtkprinterpdf.[ch]:
|
||||
Import pdf and lpr backend
|
||||
|
||||
2006-03-24 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
Import print-operation into gtk+
|
||||
|
||||
* .cvsignore:
|
||||
* Makefile.am:
|
||||
* gtk+-unix-print-2.0.pc.in:
|
||||
Add gtk+-unix-print-2.0.pc
|
||||
|
||||
* configure.in:
|
||||
Look for cups
|
||||
Look for various _NL_* extensions
|
||||
Output new makefiles and .pc.in
|
||||
|
||||
* gtk/Makefile.am:
|
||||
Add new files
|
||||
|
||||
* gtk/gtk.h:
|
||||
Include gtkprintoperation.h
|
||||
|
||||
* gtk/gtkenums.h:
|
||||
Add printing enums
|
||||
|
||||
* gtk/gtkmarshalers.list:
|
||||
Add required new marshallers
|
||||
|
||||
* gtk/gtkpagesetup.[ch]:
|
||||
* gtk/gtkpagesetupunixdialog.[ch]:
|
||||
* gtk/gtkpagesetupunixdialog.h:
|
||||
* gtk/gtkpapersize.[ch]:
|
||||
* gtk/gtkprint-win32.[ch]:
|
||||
* gtk/gtkprintbackend.[ch]:
|
||||
* gtk/gtkprintcontext.[ch]:
|
||||
* gtk/gtkprinter-private.h:
|
||||
* gtk/gtkprinter.[ch]:
|
||||
* gtk/gtkprinteroption.[ch]:
|
||||
* gtk/gtkprinteroptionset.[ch]:
|
||||
* gtk/gtkprinteroptionwidget.[ch]:
|
||||
* gtk/gtkprintjob.[ch]:
|
||||
* gtk/gtkprintoperation-private.h:
|
||||
* gtk/gtkprintoperation-unix.c:
|
||||
* gtk/gtkprintoperation-win32.c:
|
||||
* gtk/gtkprintoperation.[ch]:
|
||||
* gtk/gtkprintsettings.[ch]:
|
||||
* gtk/gtkprintunixdialog.[ch]:
|
||||
* gtk/paper_names.c:
|
||||
Generic printing support
|
||||
|
||||
* modules/Makefile.am:
|
||||
* modules/printbackends/Makefile.am:
|
||||
* modules/printbackends/cups/Makefile.am:
|
||||
* modules/printbackends/cups/gtkcupsutils.[ch]:
|
||||
* modules/printbackends/cups/gtkprintbackendcups.[ch]:
|
||||
* modules/printbackends/cups/gtkprintercups.[ch]:
|
||||
Cups backend
|
||||
|
||||
* tests/.cvsignore:
|
||||
* tests/Makefile.am:
|
||||
* tests/print-editor.c:
|
||||
Add printing test app
|
||||
|
@@ -7981,7 +7981,7 @@ Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
|
||||
the emission of the "add-accelerator" signal on a widget. this is
|
||||
useful to prevent accelerator installation on certain widgets.
|
||||
usefull to prevent accelerator installation on certain widgets.
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
|
||||
labels left justified, by setting their alignment. stop accelerator
|
||||
|
@@ -17108,7 +17108,7 @@ Tue Jan 16 13:13:13 GMT 2001 Tony Gale <gale@gtk.org>
|
||||
Use fb_mem, fb_stride, fb_width, fb_height.
|
||||
Added recompute_rowstride to reset the rowstride of all windows.
|
||||
Added gdk_fb_recompute_all() which recomputes rootwindow size,
|
||||
window abs positions and window rowstrides. Useful when the
|
||||
window abs positions and window rowstrides. Usefull when the
|
||||
rotation has changed.
|
||||
|
||||
Thu Jan 11 13:16:50 GMT 2001 Tony Gale <gale@gtk.org>
|
||||
|
7104
ChangeLog.pre-2-10
7104
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
8912
ChangeLog.pre-2-12
8912
ChangeLog.pre-2-12
File diff suppressed because it is too large
Load Diff
9588
ChangeLog.pre-2-14
9588
ChangeLog.pre-2-14
File diff suppressed because it is too large
Load Diff
3959
ChangeLog.pre-2-16
3959
ChangeLog.pre-2-16
File diff suppressed because it is too large
Load Diff
79
HACKING
79
HACKING
@@ -1,64 +1,55 @@
|
||||
If you want to hack on the GTK+ project, you'll need to have
|
||||
the following packages installed:
|
||||
|
||||
- GNU autoconf 2.54
|
||||
- GNU automake 1.7
|
||||
- GNU libtool 1.4
|
||||
- indent (GNU indent 1.9.1 is known good)
|
||||
- GNU gettext 10.40
|
||||
- GNU autoconf 2.52
|
||||
- GNU automake 1.4
|
||||
- GNU libtool 1.4
|
||||
- indent (GNU indent 1.9.1 is known good)
|
||||
- GNU gettext 10.40
|
||||
|
||||
These should be available by ftp from ftp.gnu.org or any of the
|
||||
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
|
||||
|
||||
Up-to-date instructions about developing GNOME applications and libraries
|
||||
can be found here:
|
||||
|
||||
http://developer.gnome.org
|
||||
|
||||
Information about using git with GNOME can be found here:
|
||||
|
||||
http://live.gnome.org/Git
|
||||
|
||||
In order to get GIT gtk+ installed on your system, you need to have
|
||||
the most recent GIT versions of glib, pango, and atk installed as well.
|
||||
In order to get CVS gtk+ installed on your system, you need to have
|
||||
the most recent CVS version of glib, pango, and atk installed as well.
|
||||
The installation process of these libraries is similar to that of gtk+, but
|
||||
needs to be fulfilled prior to installation of gtk+.
|
||||
|
||||
If at all possible, please use GIT to get the latest development version of
|
||||
gtk+ and glib. You can do the following to get glib and gtk+ from GIT:
|
||||
|
||||
$ git clone git://git.gnome.org/glib
|
||||
$ git clone git://git.gnome.org/pango
|
||||
$ git clone git://git.gnome.org/atk
|
||||
$ git clone git://git.gnome.org/gtk+
|
||||
|
||||
Note: if you plan to push changes to back to the master repository and
|
||||
have a gnome account, you want to use the following instead:
|
||||
|
||||
$ git clone ssh://<username>@git.gnome.org/git/gtk+
|
||||
|
||||
To compile the GIT version of gtk+ on your system, you will need to take
|
||||
To compile a CVS version of gtk+ on your system, you will need to take
|
||||
several steps to setup the tree for compilation. You can do all these
|
||||
steps at once by running:
|
||||
|
||||
gtk+$ ./autogen.sh
|
||||
|
||||
cvsroot/gtk+# ./autogen.sh
|
||||
|
||||
Basically this does the following for you:
|
||||
|
||||
gtk+$ aclocal; automake; autoconf
|
||||
cvsroot/gtk+# aclocal; automake; autoconf
|
||||
|
||||
The above commands create the `configure' script. Now you
|
||||
run the `configure' script in `gtk+/' to create all Makefiles.
|
||||
More information about that in `INSTALL'.
|
||||
The above commands create the "configure" script. Now you
|
||||
can run the configure script in cvsroot/gtk+ to create all
|
||||
the Makefiles.
|
||||
|
||||
Before running `autogen.sh' or `configure', make sure you have libtool
|
||||
in your path.
|
||||
Before running autogen.sh or configure, make sure you have libtool
|
||||
in your path.
|
||||
|
||||
Note that autogen.sh runs configure for you. If you wish to pass
|
||||
options like `--prefix=/usr' to `configure' you can give those options
|
||||
to `autogen.sh' and they will be passed on to `configure'.
|
||||
options like --prefix=/usr to configure you can give those options
|
||||
to autogen.sh and they will be passed on to configure.
|
||||
|
||||
If at all possible, please use CVS to get the latest development version of
|
||||
gtk+ and glib. You can do the following to get glib and gtk+ from cvs:
|
||||
|
||||
$ export CVSROOT=':pserver:anonymous@cvs.gnome.org:/cvs/gnome'
|
||||
$ cvs login
|
||||
(there is no password, just hit return)
|
||||
$ cvs -z3 checkout glib
|
||||
$ cvs -z3 checkout pango
|
||||
$ cvs -z3 checkout atk
|
||||
$ cvs -z3 checkout gtk+
|
||||
|
||||
For information about submitting patches and commiting changes
|
||||
to CVS, see the README and README.cvs-commits files. In particular,
|
||||
don't, under any circumstances, commit anything to CVS before
|
||||
reading and understanding README.cvs-commmits.
|
||||
|
||||
|
||||
For information about submitting patches and pushing changes
|
||||
to GIT, see the `README' and `README.commits' files. In particular,
|
||||
don't, under any circumstances, push anything to GIT before
|
||||
reading and understanding `README.commmits'.
|
||||
|
39
INSTALL
Normal file
39
INSTALL
Normal file
@@ -0,0 +1,39 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
GTK+ requires the following packages:
|
||||
|
||||
- The GLib, Pango, and Atk libraries, available at the same location as GTK+
|
||||
(Either Pango-1.0 or Pango-1.2 can be used with GTK+-2.2;
|
||||
Pango-1.2 is recommended.)
|
||||
|
||||
- The TIFF, PNG, and JPEG image loading libraries. You most
|
||||
likely have these installed on your system already. If not
|
||||
these libraries are available from:
|
||||
|
||||
http://www.libtiff.org/
|
||||
http://www.libpng.org/
|
||||
http://www.ijg.org/
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-2.8.2.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-2.8.2 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK
|
||||
|
||||
The Details
|
||||
===========
|
||||
|
||||
Complete information about installing GTK+ and related libraries can be found
|
||||
in the file:
|
||||
|
||||
docs/reference/gtk/html/gtk-building.html
|
||||
|
||||
Or online at:
|
||||
|
||||
http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html
|
||||
|
14
INSTALL.in
14
INSTALL.in
@@ -3,11 +3,9 @@ Prerequisites
|
||||
|
||||
GTK+ requires the following packages:
|
||||
|
||||
- The GLib, Pango, ATK and cairo libraries, available at the same
|
||||
location as GTK+. GTK+ @GTK_VERSION@ requires at least GLib 2.23.6,
|
||||
Pango 1.20, ATK 1.29.2 and cairo 1.6.0.
|
||||
|
||||
- gobject-introspection 0.6.7 or newer.
|
||||
- The GLib, Pango, and Atk libraries, available at the same location as GTK+
|
||||
(Either Pango-1.0 or Pango-1.2 can be used with GTK+-2.2;
|
||||
Pango-1.2 is recommended.)
|
||||
|
||||
- The TIFF, PNG, and JPEG image loading libraries. You most
|
||||
likely have these installed on your system already. If not
|
||||
@@ -17,17 +15,15 @@ GTK+ requires the following packages:
|
||||
http://www.libpng.org/
|
||||
http://www.ijg.org/
|
||||
|
||||
libtiff must be version 3.6.0 or higher.
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-@GTK_VERSION@.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-@GTK_VERSION@ # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK+
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK+
|
||||
% make install # install GTK
|
||||
|
||||
The Details
|
||||
===========
|
||||
|
12
MAINTAINERS
12
MAINTAINERS
@@ -1,12 +0,0 @@
|
||||
Matthias Clasen
|
||||
E-mail: mclasen@redhat.com
|
||||
Userid: matthiasc
|
||||
|
||||
Tim Janik
|
||||
E-mail: timj@gtk.org
|
||||
Userid: timj
|
||||
|
||||
Note that a lot of people are contributing to GTK+, and some parts of it
|
||||
are technically maintained by other people. The people listed above are
|
||||
meant as contacts for administrative questions such as cvs accounts. Other
|
||||
questions are best directed to the mailing list gtk-devel-list@gnome.org.
|
79
Makefile.am
79
Makefile.am
@@ -1,14 +1,12 @@
|
||||
## Makefile.am for GTK+
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests perf contrib
|
||||
SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros
|
||||
|
||||
# require automake 1.4
|
||||
AUTOMAKE_OPTIONS = 1.7
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
EXTRA_DIST += \
|
||||
EXTRA_DIST = \
|
||||
HACKING \
|
||||
makecopyright \
|
||||
NEWS.pre-1-0 \
|
||||
@@ -18,14 +16,7 @@ EXTRA_DIST += \
|
||||
ChangeLog.pre-2-2 \
|
||||
ChangeLog.pre-2-4 \
|
||||
ChangeLog.pre-2-6 \
|
||||
ChangeLog.pre-2-8 \
|
||||
ChangeLog.pre-2-10 \
|
||||
ChangeLog.pre-2-12 \
|
||||
ChangeLog.pre-2-14 \
|
||||
ChangeLog.pre-2-16 \
|
||||
ChangeLog.gtk-async-file-chooser \
|
||||
ChangeLog.gtk-printing \
|
||||
README.commits \
|
||||
README.cvs-commits \
|
||||
README.win32 \
|
||||
config.h.win32 \
|
||||
makefile.msc \
|
||||
@@ -119,26 +110,6 @@ EXTRA_DIST += \
|
||||
examples/spinbutton/spinbutton.c \
|
||||
examples/spinbutton/Makefile \
|
||||
examples/find-examples.sh
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(srcdir)/INSTALL \
|
||||
$(srcdir)/README \
|
||||
$(srcdir)/aclocal.m4 \
|
||||
$(srcdir)/autoscan.log \
|
||||
$(srcdir)/compile \
|
||||
$(srcdir)/config.guess \
|
||||
$(srcdir)/config.h.in \
|
||||
$(srcdir)/config.sub \
|
||||
$(srcdir)/configure.scan \
|
||||
$(srcdir)/depcomp \
|
||||
$(srcdir)/install-sh \
|
||||
$(srcdir)/ltmain.sh \
|
||||
$(srcdir)/missing \
|
||||
$(srcdir)/mkinstalldirs \
|
||||
$(srcdir)/omf.make \
|
||||
$(srcdir)/xmldocs.make \
|
||||
$(srcdir)/gtk-doc.make \
|
||||
$(srcdir)/ChangeLog \
|
||||
`find "$(srcdir)" -type f -name Makefile.in -print`
|
||||
|
||||
GDKTARGET=@gdktarget@
|
||||
|
||||
@@ -160,40 +131,13 @@ gdk-$(GDKTARGET)-2.0-uninstalled.pc: gdk-2.0-uninstalled.pc
|
||||
cp gdk-2.0-uninstalled.pc gdk-$(GDKTARGET)-2.0-uninstalled.pc
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA= gdk-pixbuf-2.0.pc gdk-$(GDKTARGET)-2.0.pc gtk+-$(GDKTARGET)-2.0.pc gail.pc
|
||||
|
||||
if OS_UNIX
|
||||
pkgconfig_DATA += gtk+-unix-print-2.0.pc
|
||||
endif
|
||||
pkgconfig_DATA= gdk-pixbuf-2.0.pc gdk-$(GDKTARGET)-2.0.pc gtk+-$(GDKTARGET)-2.0.pc
|
||||
|
||||
DISTCLEANFILES = \
|
||||
gtk+-unix-print-2.0.pc \
|
||||
gtk+-$(GDKTARGET)-2.0.pc \
|
||||
gdk-$(GDKTARGET)-2.0.pc \
|
||||
gail.pc \
|
||||
gtk+-$(GDKTARGET)-2.0-uninstalled.pc \
|
||||
gdk-$(GDKTARGET)-2.0-uninstalled.pc \
|
||||
gail-uninstalled.pc \
|
||||
config.lt
|
||||
|
||||
distclean-local:
|
||||
if test "$(srcdir)" = "."; then :; else \
|
||||
rm -f ChangeLog; \
|
||||
fi
|
||||
|
||||
ChangeLog:
|
||||
@echo Creating $@
|
||||
@if test -d "$(srcdir)/.git"; then \
|
||||
(GIT_DIR=$(top_srcdir)/.git ./missing --run git log GTK_2_16_0^^.. --stat) | fmt --split-only > $@.tmp \
|
||||
&& mv -f $@.tmp $@ \
|
||||
|| ($(RM) $@.tmp; \
|
||||
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
|
||||
(test -f $@ || echo git-log is required to generate this file >> $@)); \
|
||||
else \
|
||||
test -f $@ || \
|
||||
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
|
||||
echo A git checkout and git-log is required to generate this file >> $@); \
|
||||
fi
|
||||
gdk-$(GDKTARGET)-2.0-uninstalled.pc
|
||||
|
||||
## copy the default target for this platform to gdk-2.0.pc and gtk+-2.0.pc
|
||||
DEFAULT_GDKTARGET=x11
|
||||
@@ -219,7 +163,7 @@ dist-hook:
|
||||
&& cp INSTALL README $(distdir) ; \
|
||||
fi
|
||||
|
||||
.PHONY: files release sanity snapshot ChangeLog
|
||||
.PHONY: files release sanity snapshot
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
@@ -243,16 +187,5 @@ sanity:
|
||||
snapshot:
|
||||
$(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man --disable-rebuilds --enable-introspection
|
||||
|
||||
GITIGNOREFILES = \
|
||||
po-properties/Makefile.in.in \
|
||||
po-properties/Makefile.in \
|
||||
po-properties/Makefile \
|
||||
po-properties/*.gmo \
|
||||
po-properties/*.mo \
|
||||
po-properties/POTFILES \
|
||||
po-properties/stamp-it \
|
||||
po-properties/.intltool-merge-cache
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
|
||||
|
@@ -1,82 +0,0 @@
|
||||
# GTK+ - The GIMP Toolkit
|
||||
|
||||
GTESTER = gtester # in $PATH for non-GLIB packages
|
||||
GTESTER_REPORT = gtester-report # in $PATH for non-GLIB packages
|
||||
|
||||
# initialize variables for unconditional += appending
|
||||
EXTRA_DIST =
|
||||
TEST_PROGS =
|
||||
|
||||
### testing rules
|
||||
|
||||
# Xvfb based test rules
|
||||
XVFB = Xvfb -ac -noreset -screen 0 800x600x16
|
||||
XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
|
||||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 \
|
||||
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 \
|
||||
1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 \
|
||||
9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \
|
||||
9995 9996 9997 9998 9999
|
||||
SKIP_GDKTARGET = \
|
||||
test "$(gdktarget)" != "x11" \
|
||||
&& echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target."
|
||||
XVFB_START = \
|
||||
${XVFB} -help 2>/dev/null 1>&2 \
|
||||
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
|
||||
&& { ${XVFB} :$$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
|
||||
trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
|
||||
|| { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
|
||||
&& DISPLAY=:$$XID && export DISPLAY
|
||||
# call as: $(XVFB_START) && someprogram
|
||||
|
||||
# test: run all tests in cwd and subdirs
|
||||
test: ${TEST_PROGS}
|
||||
@$(SKIP_GDKTARGET) || test -z "${TEST_PROGS}" || { \
|
||||
$(XVFB_START) && { set -e; ${GTESTER} --verbose ${TEST_PROGS}; }; \
|
||||
}
|
||||
@ for subdir in $(SUBDIRS) ; do \
|
||||
test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
|
||||
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
|
||||
done
|
||||
# test-report: run tests in subdirs and generate report
|
||||
# perf-report: run tests in subdirs with -m perf and generate report
|
||||
# full-report: like test-report: with -m perf and -m slow
|
||||
test-report perf-report full-report: ${TEST_PROGS}
|
||||
@ ignore_logdir=true ; \
|
||||
if test -z "$$GTESTER_LOGDIR" ; then \
|
||||
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
|
||||
ignore_logdir=false ; \
|
||||
fi ; \
|
||||
for subdir in $(SUBDIRS) ; do \
|
||||
test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
|
||||
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
|
||||
done ; \
|
||||
$(SKIP_GDKTARGET) || test -z "${TEST_PROGS}" || { \
|
||||
case $@ in \
|
||||
test-report) test_options="-k";; \
|
||||
perf-report) test_options="-k -m=perf";; \
|
||||
full-report) test_options="-k -m=perf -m=slow";; \
|
||||
esac ; \
|
||||
$(XVFB_START) && { \
|
||||
set -e; \
|
||||
if test -z "$$GTESTER_LOGDIR" ; then \
|
||||
${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
|
||||
elif test -n "${TEST_PROGS}" ; then \
|
||||
${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
|
||||
fi ; \
|
||||
}; \
|
||||
}; \
|
||||
$$ignore_logdir || { \
|
||||
echo '<?xml version="1.0"?>' > $@.xml ; \
|
||||
echo '<report-collection>' >> $@.xml ; \
|
||||
for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
|
||||
sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
|
||||
done ; \
|
||||
echo >> $@.xml ; \
|
||||
echo '</report-collection>' >> $@.xml ; \
|
||||
rm -rf "$$GTESTER_LOGDIR"/ ; \
|
||||
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
|
||||
}
|
||||
.PHONY: test test-report perf-report full-report
|
||||
# run make test as part of make check
|
||||
check-local: test
|
158
README
Normal file
158
README
Normal file
@@ -0,0 +1,158 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 2.8.2. GTK+ is a multi-platform toolkit for
|
||||
creating graphical user interfaces. Offering a complete set of widgets,
|
||||
GTK+ is suitable for projects ranging from small one-off projects to
|
||||
complete application suites.
|
||||
|
||||
GTK+ is free software and part of the GNU Project. However, the
|
||||
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
|
||||
developers, including those developing proprietary software, without any
|
||||
license fees or royalties.
|
||||
|
||||
The official ftp site is:
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
|
||||
The official web site is:
|
||||
http://www.gtk.org/
|
||||
|
||||
Information about mailing lists can be found at
|
||||
http://www.gtk.org/mailinglists.html
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
Release notes
|
||||
=============
|
||||
|
||||
* GTK+ 2.6 supports clipboard persistency. To make use of this feature,
|
||||
a clipboard manager following the specification at
|
||||
http://www.freedesktop.org/wiki/Standards/clipboard-manager-spec
|
||||
must be running. A sample implementation of such a clipboard manager
|
||||
is available at
|
||||
http://people.imendio.com/andersca/archives/clipboard-manager-0.3.tar.gz
|
||||
Applications can use the function gdk_display_supports_clipboard_persistence()
|
||||
to find out if clipboard persistence is available.
|
||||
|
||||
* Notification on clipboard ownership changes via GdkOwnerChange events
|
||||
requires the XFIXES X extension. Applications can use the function
|
||||
gdk_display_supports_selection_notification() to find out if ownerchip
|
||||
change notification is available.
|
||||
|
||||
* The icon theme code in GTK+ 2.6 follows the freedesktop.org icon theme
|
||||
specification. Setting the XDG_DATA_DIRS environtment variable may be
|
||||
necessary if your icons aren't installed in the default location
|
||||
/usr/share/icons.
|
||||
|
||||
* The icon theme code in GTK+ 2.6 can make use of mmap()able cache files
|
||||
to avoid a lot of disk searching overhead. GTK+ includes a utility named
|
||||
gtk-update-icon-cache to generate these cache files. For further details,
|
||||
see the gtk-update-icon-cache man page or the GTK+ documentation.
|
||||
|
||||
* To reduce code size and improve efficiency, GTK+, when compiled
|
||||
with the GNU toolchain, has separate internal and external entry
|
||||
points for exported functions. The internal names, which begin with
|
||||
IA__, may be seen when debugging a GTK+ program.
|
||||
|
||||
* The following functions have been deprecated in GTK+ 2.6:
|
||||
gdk_pango_context_set_colormap
|
||||
gtk_cell_renderer_editing_canceled
|
||||
|
||||
* The new GtkFileChooser widget emphasizes simplicity and thus does
|
||||
not provide a navigation entry by default when opening files.
|
||||
Experienced command line users will likely want to make heavy use of
|
||||
the location dialog brought up by the Control-L key shortcut.
|
||||
|
||||
* The GTK+ libraries use an '_' prefix to indicate private symbols that
|
||||
must not be used by applications. On some platforms, symbols beginning
|
||||
with prefixes such as _gtk, _gdk, and _pango will be exported
|
||||
from the library, on others not. In no case can applications
|
||||
use these private symbols. In addition to that, GTK+ 2.6 makes several
|
||||
symbols private which were not in any installed header files and
|
||||
were never intended to be exported.
|
||||
|
||||
* The gdk_pixbuf_xlib library included in the contrib/ directory
|
||||
and the framebuffer GDK backend included in the gdk/linux-fb directory
|
||||
of GTK+ are provided on an as-is basis and have not been tested at all.
|
||||
No guarantees about the degree of workingness or about future
|
||||
compatibility are provided.
|
||||
|
||||
* On Unix, the assumption of GLib and GTK+ by default is that filenames on
|
||||
the filesystem are encoded in UTF-8 rather than the encoding of the locale;
|
||||
the GTK+ developers consider that having filenames whose interpretation
|
||||
depends on the current locale is fundamentally a bad idea.
|
||||
|
||||
If you have filenames encoded in the encoding of your locale, then you
|
||||
may want to set the G_FILENAME_ENCODING environment variable:
|
||||
|
||||
G_FILENAME_ENCODING=@locale
|
||||
export G_FILENAME_ENCODING
|
||||
|
||||
(Earlier versions of GLib 2.x required a different environment variable
|
||||
setting; G_BROKEN_FILENAMES=1 to achieve the same effect; this
|
||||
is still supported, but G_FILENAME_ENCODING is preferred.)
|
||||
Best integration of GTK+ 2.6 with the environment is achieved by
|
||||
using a UTF-8 locale.
|
||||
|
||||
On Windows, filenames passed to GTK+ should always be in UTF-8, as
|
||||
in GLib 2.6. This is different than in previous versions of GTK+
|
||||
where the system codepage was used. As in GLib, for DLL ABI
|
||||
stability, applications built against previous versions of GTK+ will
|
||||
use entry points providing the old semantics.
|
||||
|
||||
When compiling against GTK+ 2.6, applications intended to be
|
||||
portable to Windows must take the UTF-8 file name encoding into
|
||||
consideration, and use the gstdio wrappers to access files whose
|
||||
names have been constructed from strings returned from GTK+ or GLib.
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
||||
Bugs should be reported to the GNOME bug tracking system.
|
||||
(http://bugzilla.gnome.org, product gtk+.) You will need to create an
|
||||
account for yourself.
|
||||
|
||||
In the bug report please include:
|
||||
|
||||
* Information about your system. For instance:
|
||||
|
||||
- What operating system and version
|
||||
- What version of X
|
||||
- For Linux, what version of the C library
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
||||
If you can reproduce it with one of the tests or demos built with GTK+,
|
||||
such as demos/gtk-demo/gtk-demo, that would be most convenient. Otherwise,
|
||||
please include a short test program that exhibits the behavior. As a
|
||||
last resort, you can also provide a pointer to a larger piece of software
|
||||
that can be downloaded.
|
||||
|
||||
* If the bug was a crash, the exact text that was printed out when the
|
||||
crash occured.
|
||||
|
||||
* Further information such as stack traces may be useful, but is not
|
||||
necessary. If you do send a stack trace, and the error is an X error,
|
||||
it will be more useful if the stacktrace is produced running the test
|
||||
program with the --sync command line option.
|
||||
|
||||
Patches
|
||||
=======
|
||||
|
||||
Patches should also be submitted to bugzilla.gnome.org. If the patch
|
||||
fixes an existing bug, add the patch as an attachment to that bug
|
||||
report.
|
||||
|
||||
Otherwise, enter a new bug report that describes the patch, and attach
|
||||
the patch to that bug report.
|
||||
|
||||
Bug reports containing patches should include the PATCH keyword in their
|
||||
keyword fields. If the patch adds to or changes the GTK+ programming
|
||||
interface, the API keyword should also be included.
|
||||
|
||||
Patches should be in unified diff form. (The -u option to GNU diff.)
|
@@ -1,72 +0,0 @@
|
||||
GTK+ is part of the GNOME git repository. At the current time, any
|
||||
person with write access to the GNOME repository, can make changes to
|
||||
GTK+. This is a good thing, in that it encourages many people to work
|
||||
on GTK+, and progress can be made quickly. However, GTK+ is a fairly
|
||||
large and complicated package that many other things depend on, so to
|
||||
avoid unnecessary breakage, and to take advantage of the knowledge
|
||||
about GTK+ that has been built up over the years, we'd like to ask
|
||||
people committing to GTK+ to follow a few rules:
|
||||
|
||||
0) Ask first. If your changes are major, or could possibly break existing
|
||||
code, you should always ask. If your change is minor and you've
|
||||
been working on GTK+ for a while it probably isn't necessary
|
||||
to ask. But when in doubt, ask. Even if your change is correct,
|
||||
somebody may know a better way to do things.
|
||||
|
||||
If you are making changes to GTK+, you should be subscribed
|
||||
to gtk-devel-list@gnome.org. (Subscription address:
|
||||
gtk-devel-list-request@gnome.org.) This is a good place to ask
|
||||
about intended changes.
|
||||
|
||||
#gtk+ on GIMPNet (irc.gimp.org, irc.us.gimp.org, irc.eu.gimp.org, ...)
|
||||
is also a good place to find GTK+ developers to discuss changes with,
|
||||
however, email to gtk-devel-list is the most certain and preferred
|
||||
method.
|
||||
|
||||
1) Ask _first_.
|
||||
|
||||
2) With git, we no longer maintain a ChangeLog file, but you are expected
|
||||
to produce a meaningful commit message. Changes without a sufficient
|
||||
commit message will be reverted. See below for the expected format
|
||||
of commit messages.
|
||||
|
||||
Notes:
|
||||
|
||||
* When developing larger features or complicated bug fixes, it is
|
||||
advisable to work in a branch in your own cloned GTK+ repository.
|
||||
You may even consider making your repository publically available
|
||||
so that others can easily test and review your changes.
|
||||
|
||||
* The expected format for git commit messages is as follows:
|
||||
|
||||
=== begin example commit ===
|
||||
Short explanation of the commit
|
||||
|
||||
Longer explanation explaining exactly what's changed, whether any
|
||||
external or private interfaces changed, what bugs were fixed (with bug
|
||||
tracker reference if applicable) and so forth. Be concise but not too brief.
|
||||
=== end example commit ===
|
||||
|
||||
- Always add a brief description of the commit to the _first_ line of
|
||||
the commit and terminate by two newlines (it will work without the
|
||||
second newline, but that is not nice for the interfaces).
|
||||
|
||||
- First line (the brief description) must only be one sentence and
|
||||
should start with a capital letter unless it starts with a lowercase
|
||||
symbol or identifier. Don't use a trailing period either. Don't exceed
|
||||
72 characters.
|
||||
|
||||
- The main description (the body) is normal prose and should use normal
|
||||
punctuation and capital letters where appropriate. Normally, for patches
|
||||
sent to a mailing list it's copied from there.
|
||||
|
||||
- When committing code on behalf of others use the --author option, e.g.
|
||||
git commit -a --author "Joe Coder <joe@coder.org>" and --signoff.
|
||||
|
||||
|
||||
Owen Taylor
|
||||
13 Aug 1998
|
||||
17 Apr 2001
|
||||
|
||||
Matthias Clasen
|
||||
31 Mar 2009
|
54
README.cvs-commits
Normal file
54
README.cvs-commits
Normal file
@@ -0,0 +1,54 @@
|
||||
GTK+ is part of the GNOME CVS repository. At the current time, any
|
||||
person with write access to the GNOME repository, can make changes to
|
||||
GTK+. This is a good thing, in that it encourages many people to work
|
||||
on GTK+, and progress can be made quickly. However, GTK+ is a fairly
|
||||
large and complicated package that many other things depend on, so to
|
||||
avoid unnecessary breakage, and to take advantage of the knowledge
|
||||
about GTK+ that has been built up over the last 4 years, we'd like
|
||||
to ask people commiting to GTK+ to follow a few rules:
|
||||
|
||||
0) Ask first. If your changes are major, or could possibly break existing
|
||||
code, you should always ask. If your change is minor and you've
|
||||
been working on GTK+ for a while it probably isn't necessary
|
||||
to ask. But when in doubt, ask. Even if your change is correct,
|
||||
somebody may know a better way to do things.
|
||||
|
||||
If you are making changes to GTK+, you should be subscribed
|
||||
to gtk-devel-list@gnome.org. (Subscription address:
|
||||
gtk-devel-list-request@gnome.org.) This is a good place to ask
|
||||
about intended changes.
|
||||
|
||||
#gtk+ on GIMPNet (irc.gimp.org, irc.us.gimp.org, irc.eu.gimp.org, ...)
|
||||
is also a good place to find GTK+ developers to discuss changes with,
|
||||
however, email to gtk-devel-list is the most certain and preferred
|
||||
method.
|
||||
|
||||
1) Ask _first_.
|
||||
|
||||
2) There must be a ChangeLog for every commit. (If you discover that
|
||||
you only committed half the files you meant to and need to fix that
|
||||
up, or something, you don't need a new ChangeLog entry. But in general,
|
||||
ChangeLog entries are mandatory.) Changes without ChangeLog entries
|
||||
will be reverted.
|
||||
|
||||
3) There _must_ be a ChangeLog for every commit.
|
||||
|
||||
Notes:
|
||||
|
||||
* If you are going to be changing many files in an experimental fashion,
|
||||
it probably is a good idea to create a separate branch for your changes.
|
||||
|
||||
* The ChangeLog entries should preferably match in date format
|
||||
with the existing entries. You can set how emacs does this
|
||||
by using customize mode:
|
||||
|
||||
- M-x customize
|
||||
- set Programming/Tools/ChangeLog/Add Log Time Format to
|
||||
'Old Format'
|
||||
|
||||
Or, set the add-log-time-format to 'current-time-string in
|
||||
your .emacs file.
|
||||
|
||||
Owen Taylor
|
||||
13 Aug 1998
|
||||
17 Apr 2001
|
302
README.in
302
README.in
@@ -20,223 +20,11 @@ The official web site is:
|
||||
Information about mailing lists can be found at
|
||||
http://www.gtk.org/mailinglists.html
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
|
||||
Release notes for 2.20
|
||||
======================
|
||||
|
||||
* GtkStatusbar now has a message area (see gtk_status_bar_get_message_area)
|
||||
which makes it easy to place additional widgets inside the statusbar
|
||||
frame or to replace the label widgets. Previously, this was only possible
|
||||
by accessing the innards of the statusbar widget directly. Applications
|
||||
which are doing so may need some adjustments, since the addition of the
|
||||
message area changed the internal widget hierarchy.
|
||||
|
||||
* GtkBuilder no longer sets the "name" property of widgets to the ID
|
||||
attribute of the <object>. Use gtk_buildable_get_name() instead of
|
||||
gtk_widget_get_name() to obtain the ID.
|
||||
|
||||
* GTK+ now includes introspection data, as a consequence, it gained a
|
||||
dependency on gobject-introspection. It is possible to build without
|
||||
introspection by passing --disable-introspection to configure.
|
||||
|
||||
|
||||
Release notes for 2.18
|
||||
======================
|
||||
|
||||
* gtk_tooltip_set_custom now accept a NULL custom_widget to unset the
|
||||
old custom_widget. Custom_widget does not get destroyed when the
|
||||
tooltip goes away.
|
||||
|
||||
* JPEG2000 support is no longer enabled by default. It must be
|
||||
explicitly turned on, by passing --with-libjasper to configure.
|
||||
|
||||
* GDK has been reworked to implement 'client-side windows'. This offers
|
||||
exciting new possibilities, such as transformed, offscreen rendering,
|
||||
but it breaks some long-standing assumptions that applications may
|
||||
have about GDK windows. Setting the environment variable
|
||||
GDK_NATIVE_WINDOWS makes GDK create a native X11 window for each
|
||||
GDK window, which might make problematic applications work better.
|
||||
|
||||
* GTK+ calls signal (SIGPIPE, SIG_IGN) during initialization, to ignore
|
||||
SIGPIPE signals, since these are almost never wanted in graphical
|
||||
applications. If you do need to handle SIGPIPE for some reason, reset
|
||||
the handler after gtk_init(), but notice that other libraries (e.g.
|
||||
libdbus or gvfs) might do similar things.
|
||||
|
||||
Release notes for 2.16
|
||||
======================
|
||||
|
||||
* Password entries now display a caps-lock warning. This can be turned off
|
||||
with the caps-lock-warning property.
|
||||
|
||||
* Various orientation-related functions have been deprecated in favour
|
||||
of the new GtkOrientable interface: gtk_scale_button_get_orientation,
|
||||
gtk_scale_button_set_orientation, gtk_toolbar_set_orientation.
|
||||
|
||||
* The action-proxy interaction has been changed. Widgets that operate as
|
||||
proxies have to implement the GtkActivatable interface now. GtkActivatable
|
||||
implementation are responsible for syncing their appearance with the
|
||||
action and for activating the action. All GTK+ widgets that are commonly
|
||||
used as proxies implement the GtkActivatable interface.
|
||||
|
||||
* The handling of keyboard shortcuts has been changed, to help with a
|
||||
longstanding complaint about the way GTK+ handles multiple layouts. GTK+
|
||||
now only uses keys from groups other than the current group if they are
|
||||
not present in the current group.
|
||||
|
||||
Release notes for 2.14
|
||||
======================
|
||||
|
||||
* gtkitemfactory.h is now completely deprecated.
|
||||
As gtkactiongroup.h and gtkstock.h no longer include the gtkitemfactory.h
|
||||
header, this might break application using gtk_item_factory_* symbols
|
||||
without including gtkitemfactory.h - even though this behaviour has never
|
||||
been supported in the first place.
|
||||
|
||||
* The GtkFileSystem semi-private interface has been removed.
|
||||
The GTK+ filechooser implementation now uses GIO directly, which has
|
||||
rendered external filesystem implementations unnecessary. Consequently,
|
||||
the GtkFileSystem interface is no longer available, nor the filechooser
|
||||
will load any GtkFileSystem implementation.
|
||||
|
||||
* GtkComboBox now renders the popdown button insensitive when
|
||||
the model is empty. Applications which want to populate the list
|
||||
only before displaying it can set gtk_combo_box_set_button_sensitivity
|
||||
to GTK_SENSITIVITY_ON, so that the button is always sensitive or
|
||||
GTK_SENSITIVITY_OFF to make it insensitive respectively.
|
||||
|
||||
* In the early 2.14.x releases, GtkAdjustment was changed to enforce
|
||||
that values are restricted to the range [lower, upper - page_size].
|
||||
This has always been the documented behaviour, and the recommended
|
||||
practice is to set page_size to 0 when using adjustments for simple
|
||||
scalar values, like in a slider or spin button.
|
||||
Due to the large number of applications that are affected by this
|
||||
change, the behaviour has been reverted to the old behaviour in
|
||||
2.14.3, with an explicit warning that this change will be
|
||||
reintroduced in 2.90.
|
||||
|
||||
* gdk-pixbuf will use GIO for mime type detection if possible. For
|
||||
this to work, shared-mime-info needs to be installed and XDG_DATA_DIRS
|
||||
set accordingly at configure time. Otherwise, gdk-pixbuf falls
|
||||
back to its built-in sniffing implementation.
|
||||
|
||||
Release notes for 2.12
|
||||
======================
|
||||
|
||||
* gtk_about_dialog_get/set_name() were deprecated in favour of
|
||||
gtk_about_dialog_get/set_program_name(), the GtkAboutDialog now uses the
|
||||
"program-name" property instead of the conflicting "name" property.
|
||||
|
||||
* The gdk-pixbuf tiff loader now requires libtiff 3.6.0 or later.
|
||||
|
||||
* Support for Windows 9x/ME has officially been removed. It hasn't worked
|
||||
since 2.6 anyway.
|
||||
|
||||
* The GtkTextBufferTargetInfo enumeration values have been changed from
|
||||
G_MAXUINT-0, G_MAXUINT-1, G_MAXUINT-2, etc, to -1, -2, -3 to stay within
|
||||
ANSI C limits.
|
||||
|
||||
* A change in the handling of _NET_WM_USER_TIME properties on toplevel
|
||||
windows can cause deadlock problems with window managers that are using
|
||||
GDK for drawing decorations. In particular, metacity <= 2.18.0 is affected
|
||||
by this. The problem has been fixed in metacity 2.18.1.
|
||||
|
||||
* Semi-private GtkTextLayout api has changed: new GtkTextLayout method
|
||||
invalidate_cursors(), and new functions gtk_text_layout_invalidate_cursors()
|
||||
and gtk_text_layout_cursors_changed(), which should be used in place of
|
||||
gtk_text_layout_invalidate() and gtk_text_layout_changed() if invalidation
|
||||
is due to marks moved or changed selection; new GtkTextLineDisplay structure
|
||||
member. Source compatibility is preserved; binary compatibility may break
|
||||
only if GtkTextLineDisplay structure was created on stack or as a part
|
||||
of another structure (in particular GnomeCanvas and its clones do not need
|
||||
recompiling).
|
||||
|
||||
* Another new signal has been added to GtkNotebook. The new signal
|
||||
is called create-window, so this name can no longer be used for signals
|
||||
in objects derived from GtkNotebook.
|
||||
|
||||
* The gtk_notebook_set/get_group_id() functions were found to be insufficient
|
||||
and have been deprecated in favour of gtk_notebook_set/get_group().
|
||||
|
||||
* The move-focus signal has been moved to GtkWidget, to unify the
|
||||
various implementations of this signal in specific widgets. Great care
|
||||
has been taken to make sure that all code using this signal continues
|
||||
to work.
|
||||
|
||||
* An unused and hardly visible GtkFrame has been removed from the menu
|
||||
widget hierarchy when GtkComboBox::appears-as-list style property is
|
||||
set. Any RC file applying a different style to any widget below the
|
||||
widget path "gtk-combobox-popup-window.GtkFrame" should take into
|
||||
account that the frame no longer exists.
|
||||
|
||||
* The external print preview application used by GtkPrintOperationPreview
|
||||
is now passed the print settings on the command line with the
|
||||
--print-settings parameter pointing to a temp file containing the
|
||||
settings. The preview application assumes ownership of the file and
|
||||
should delete it once it does not need it anymore. The --print-settings
|
||||
commandline option is understood by Evince 0.9.0 and newer. To use a
|
||||
different print preview application, change the gtk-print-preview-command
|
||||
setting in your gtkrc file, e.g. gtk-print-preview-command = "ggv %f"
|
||||
|
||||
* GtkMenuShell is now defined as an abstract type. It was already
|
||||
documented as an abstract class, and there is little reason to
|
||||
instantiate it.
|
||||
|
||||
* The GtkTooltips struct (this is the old tooltips API) is now considered
|
||||
private. Code that used to access this struct, in particular the
|
||||
tips_data_list field, will need to change. All of the old tooltips
|
||||
API has been deprecated in favour of a new implementation and
|
||||
API. This affects all of the gtk_tooltips_ functions, and functions
|
||||
which take a GtkTooltips argument, such as gtk_tool_item_set_tooltip()
|
||||
and gtk_menu_tool_button_set_arrow_tooltip().
|
||||
|
||||
* The memory management of the GtkRecentManager object has been changed,
|
||||
as using the screen didn't guarantee that the singleton instance was
|
||||
correctly destroyed. The screen-related functions have been deprecated,
|
||||
and should not be used anymore; the GtkRecentManager instance returned by
|
||||
the gtk_recent_manager_get_default() function is guaranteed to be valid
|
||||
for the entire lifetime of an application.
|
||||
|
||||
* A number of interfaces that have been superseded by newer interfaces for
|
||||
a long time have finally been deprecated. This includes
|
||||
gtk_widget_ref/unref(), gtk_rc_style_ref/unref() and the old file selector.
|
||||
|
||||
* The various coordinate systems in use in GtkTreeView widgets have
|
||||
been clarified in the documentation, and in the cause of doing so,
|
||||
the functions gtk_tree_view_widget_to_tree_coords() and
|
||||
gtk_tree_view_tree_to_widget_coords() have been deprecated in
|
||||
favour of a new family of gtk_tree_view_convert_ functions.
|
||||
|
||||
* gtk_menu_item_remove_submenu() has been deprecated in favour of
|
||||
gtk_menu_item_set_submenu (..., NULL).
|
||||
|
||||
* gtk_default_draw_check() has been fixed to really decrease the
|
||||
indicator size by one pixel to ensure an odd size instead of
|
||||
accidentially increasing it.
|
||||
Consequently, gtk_cell_renderer_toggle_render() could be fixed to
|
||||
not subtract 1 from the size passed to gtk_paint_option(), which
|
||||
was just a workaround for above off-by-two for even sizes (theme
|
||||
engines now get the real indicator size passed).
|
||||
The default toggle size of GtkCheckMenuItem and GtkCellRendererToggle
|
||||
has been changed to 13 to be consistent with GtkCheckButton.
|
||||
The only visible change with default settings is that the indicator in
|
||||
GtkCellRendererToggle has changed its size from 11 to 13 and is now
|
||||
consistent with menus and toggle buttons.
|
||||
|
||||
* GTK+ has always required that gtk_init() (or a variant thereof) is
|
||||
called before any other GTK+ function. Some applications call functions
|
||||
like gtk_clipboard_get() to check if they need to call gtk_init(),
|
||||
anyway. A change in GLib 2.14 has recently broken this unsupported
|
||||
practise. It is worth pointing out that calling gtk_init() twice
|
||||
does no harm.
|
||||
|
||||
|
||||
Release notes for 2.10
|
||||
======================
|
||||
|
||||
@@ -257,84 +45,10 @@ Release notes for 2.10
|
||||
* GtkObject now uses the "floating reference" support in GObject.
|
||||
GTK_OBJECT_IS_FLOATING() will still work, but direct checking
|
||||
of the GTK_FLOATING flag will no longer detect the floating
|
||||
reference. Details about floating references can be found in the docs:
|
||||
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#floating-ref
|
||||
|
||||
* Accelerators like (_F) are now stripped from labels when they are
|
||||
displayed in toolbars. If this is not wanted, the feature can be
|
||||
suppressed by inserting a Unicode control character, e.g ZWNJ.
|
||||
|
||||
* The pixbuf theme engine can now customize expanders (in GtkTreeView
|
||||
and GtkExpander) and resize grips, using the new EXPANDER and
|
||||
RESIZE_GRIP function values.
|
||||
|
||||
* Dialogs created by gtk_about_dialog_new() no longer hide automatically
|
||||
when the user clicks close. It is the applications responsibility to
|
||||
hide or destroy the dialog.
|
||||
|
||||
* Several new signals have been added to GtkNotebook. Care has been taken
|
||||
to choose signal names which do not collide with signals added by well-known
|
||||
derived classes. The names which can no longer be used for signals in
|
||||
objects derived from GtkNotebook are page-reordered, page-removed and
|
||||
page-added.
|
||||
|
||||
* Due to the interface changes in the file chooser backend interface,
|
||||
the GTK+ ABI version has been bumped to 2.10.0. Third-party filesystem
|
||||
backends have to be ported to the new interface, other modules, such as
|
||||
theme engines, input method modules or pixbuf loaders have to be rebuilt
|
||||
so that they are installed in the right place for GTK+ to find them.
|
||||
|
||||
|
||||
Release notes for 2.8
|
||||
=====================
|
||||
|
||||
* GTK+ 2.8 and Pango 1.10 require the cairo library.
|
||||
|
||||
* The default theme has been renamed to "Raleigh". Existing configurations
|
||||
specifying the "Default" theme name should still work.
|
||||
|
||||
* The GtkTreeView::enable-search property has been changed to control
|
||||
only typeahead search, not the C-f keybinding to start an interactive
|
||||
search. To turn off interactive searching completely, you have to
|
||||
set GtkTreeView::search-column to -1.
|
||||
|
||||
* The restriction on using the same cell renderer in multiple columns
|
||||
of a GtkTreeView is now more strictly enforced.
|
||||
|
||||
* In GTK+ 2.8, GtkCalendar uses nl_langinfo() (if available) to determine
|
||||
the first day of the week. Thus, it is possible to select the first day
|
||||
of the week independently from the language, by setting LC_TIME.
|
||||
|
||||
* In GTK+ 2.8, the gtk-update-icon-cache utility includes image data
|
||||
in the icon caches, which will make the icon cache files larger than
|
||||
the one produced by GTK+ 2.6. This change will reduce the memory
|
||||
overhead of icon themes at runtime, since all GTK+ applications can
|
||||
share the image data in memory.
|
||||
|
||||
* In 2.8, GDK emits GdkEventGrabBroken events when a keyboard or pointer
|
||||
grab is broken. On X11, this can happen if the same application grabs
|
||||
again, or if the window used for the grab becomes unviewable. It happens
|
||||
more often on Win32. Applications which use grabs should pay attention
|
||||
to these events and do the necessary cleanups when the grab is lost.
|
||||
* The GIOChannel code for sockets on win32 has been rewritten.
|
||||
Applications who make non-trivial use of GIOChannels on win32 should
|
||||
be watched for possible problems.
|
||||
|
||||
* GLib 2.8 uses atomic operations to implement reference counting, thus
|
||||
g_object_ref/unref, g_closure_ref/sink/unref and g_iochannel_ref/unref
|
||||
can be used without locking in multithreaded applications. Note that
|
||||
other modifications, like concurrent setting of properties still require
|
||||
locking.
|
||||
|
||||
* g_convert() and related character set conversion functions have been
|
||||
fixed to emit pending shift states and to not cache iconv descriptors
|
||||
across multiple calls, since that is problematic for some encodings.
|
||||
Note that these functions are not suitable for streaming conversions;
|
||||
use g_iconv() to do streaming conversion.
|
||||
|
||||
|
||||
Release notes for 2.6
|
||||
=====================
|
||||
reference.
|
||||
|
||||
Release notes
|
||||
=============
|
||||
|
||||
* GTK+ 2.6 supports clipboard persistency. To make use of this feature,
|
||||
a clipboard manager following the specification at
|
||||
@@ -416,7 +130,6 @@ Release notes for 2.6
|
||||
consideration, and use the gstdio wrappers to access files whose
|
||||
names have been constructed from strings returned from GTK+ or GLib.
|
||||
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
||||
@@ -450,7 +163,6 @@ In the bug report please include:
|
||||
it will be more useful if the stacktrace is produced running the test
|
||||
program with the --sync command line option.
|
||||
|
||||
|
||||
Patches
|
||||
=======
|
||||
|
||||
@@ -461,4 +173,8 @@ report.
|
||||
Otherwise, enter a new bug report that describes the patch, and attach
|
||||
the patch to that bug report.
|
||||
|
||||
Patches should be in unified diff form. (The -up option to GNU diff.)
|
||||
Bug reports containing patches should include the PATCH keyword in their
|
||||
keyword fields. If the patch adds to or changes the GTK+ programming
|
||||
interface, the API keyword should also be included.
|
||||
|
||||
Patches should be in unified diff form. (The -u option to GNU diff.)
|
||||
|
277
README.win32
277
README.win32
@@ -1,184 +1,93 @@
|
||||
The Win32 backend in GTK+ is not as stable or correct as the X11 one.
|
||||
|
||||
For prebuilt runtime and developer packages see
|
||||
http://ftp.gnome.org/pub/gnome/binaries/win32/
|
||||
|
||||
Building GTK+ on Win32
|
||||
======================
|
||||
|
||||
First you obviously need developer packages for the compile-time
|
||||
dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng,
|
||||
zlib, libtiff at least. See
|
||||
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
|
||||
|
||||
After installing the dependencies, there are two ways to build GTK+
|
||||
for win32.
|
||||
|
||||
1) GNU tools, ./configure && make install
|
||||
-----------------------------------------
|
||||
|
||||
This requires you have mingw and MSYS.
|
||||
|
||||
Use the configure script, and the resulting Makefiles (which use
|
||||
libtool and gcc to do the compilation). I use this myself, but it can
|
||||
be hard to setup correctly.
|
||||
|
||||
The full script I run to build GTK+ 2.16 unpacked from a source
|
||||
distribution is as below. This is from bulding GTK+ 2.16.5. I don't
|
||||
use any script like this to build the development branch, as I don't
|
||||
distribute any binaries from development branches.
|
||||
|
||||
# This is a shell script that calls functions and scripts from
|
||||
# tml@iki.fi's personal work env<6E>ronment. It is not expected to be
|
||||
# usable unmodified by others, and is included only for reference.
|
||||
|
||||
MOD=gtk+
|
||||
VER=2.16.5
|
||||
REV=1
|
||||
ARCH=win32
|
||||
|
||||
THIS=${MOD}_${VER}-${REV}_${ARCH}
|
||||
|
||||
RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
|
||||
DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
|
||||
|
||||
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
|
||||
TARGET=c:/devel/target/$HEX
|
||||
|
||||
usedev
|
||||
usemsvs6
|
||||
|
||||
(
|
||||
|
||||
set -x
|
||||
|
||||
DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
|
||||
PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
|
||||
|
||||
PKG_CONFIG_PATH=
|
||||
for D in $DEPS; do
|
||||
PATH=/devel/dist/${ARCH}/$D/bin:$PATH
|
||||
[ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
done
|
||||
|
||||
LIBPNG=`latest --arch=${ARCH} libpng`
|
||||
ZLIB=`latest --arch=${ARCH} zlib`
|
||||
LIBTIFF=`latest --arch=${ARCH} libtiff`
|
||||
JPEG=`latest --arch=${ARCH} jpeg`
|
||||
|
||||
patch -p0 <<'EOF'
|
||||
EOF
|
||||
|
||||
lt_cv_deplibs_check_method='pass_all' \
|
||||
CC='gcc -mtune=pentium3 -mthreads' \
|
||||
CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
|
||||
-I/devel/dist/${ARCH}/${ZLIB}/include \
|
||||
-I/devel/dist/${ARCH}/${LIBTIFF}/include \
|
||||
-I/devel/dist/${ARCH}/${JPEG}/include \
|
||||
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
|
||||
LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
|
||||
-L/devel/dist/${ARCH}/${ZLIB}/lib \
|
||||
-L/devel/dist/${ARCH}/${LIBTIFF}/lib \
|
||||
-L/devel/dist/${ARCH}/${JPEG}/lib \
|
||||
-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
|
||||
-Wl,--enable-auto-image-base" \
|
||||
LIBS=-lintl \
|
||||
CFLAGS=-O2 \
|
||||
./configure \
|
||||
--with-gdktarget=win32 \
|
||||
--disable-gdiplus \
|
||||
--with-included-immodules \
|
||||
--without-libjasper \
|
||||
--enable-debug=yes \
|
||||
--enable-explicit-deps=no \
|
||||
--disable-gtk-doc \
|
||||
--disable-static \
|
||||
--prefix=$TARGET &&
|
||||
|
||||
libtoolcacheize &&
|
||||
rm gtk/gtk.def &&
|
||||
(PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&
|
||||
|
||||
PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&
|
||||
|
||||
grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
|
||||
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
|
||||
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
|
||||
mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
|
||||
|
||||
./gtk-zip.sh &&
|
||||
|
||||
mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
|
||||
mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP
|
||||
|
||||
) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
|
||||
|
||||
(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
|
||||
manifestify /tmp/$RUNZIP /tmp/$DEVZIP
|
||||
|
||||
You should not just copy the above blindly. There are some things in
|
||||
the script that are very specific to *my* build setup on *my* current
|
||||
machine. For instance the "latest" command, the "usedev" and
|
||||
"usemsvs6" shell functions, the /devel/dist folder. The above script
|
||||
is really just meant for reference, to give an idea. You really need
|
||||
to understand what things like PKG_CONFIG_PATH are and set them up
|
||||
properly after installing the dependencies before building GTK+.
|
||||
|
||||
As you see above, after running configure, one can just say "make
|
||||
install", like on Unix. A post-build fix is needed, running
|
||||
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
|
||||
file.
|
||||
|
||||
For a 64-bit build you need to remove the gtk/gtk.def file and let it
|
||||
be regenerated by the makefilery. This is because the 64-bit GTK dll
|
||||
has a slightly different list of exported function names. This is on
|
||||
purpose and not a bug. The API is the same at the source level, and
|
||||
the same #defines of some function names to actually have a _utf8
|
||||
suffix is used (just to keep the header simpler). But the
|
||||
corresponding non-suffixed function to maintain ABI stability are not
|
||||
needed in the 64-bit case (because there are no older EXEs around that
|
||||
would require such for ABI stability).
|
||||
|
||||
|
||||
2) Microsoft's tools
|
||||
--------------------
|
||||
|
||||
Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
|
||||
makefile.msc in gdk and gtk. Be prepared to manually edit various
|
||||
makefile.msc files, and the makefile snippets in build/win32.
|
||||
|
||||
Alternative 1 also generates Microsoft import libraries (.lib), if you
|
||||
have lib.exe available. It might also work for cross-compilation from
|
||||
Unix.
|
||||
|
||||
I use method 1 myself. Hans Breuer has been taking care of the MSVC
|
||||
makefiles. At times, we disagree a bit about various issues, and for
|
||||
instance the makefile.msc files might not produce identically named
|
||||
DLLs and import libraries as the "autoconfiscated" makefiles and
|
||||
libtool do. If this bothers you, you will have to fix the makefiles.
|
||||
|
||||
Using GTK+ on Win32
|
||||
===================
|
||||
|
||||
To use GTK+ on Win32, you also need either one of the above mentioned
|
||||
compilers. Other compilers might work, but don't count on it. Look for
|
||||
prebuilt developer packages (DLLs, import libraries, headers) on the
|
||||
above website.
|
||||
|
||||
Multi-threaded use of GTK+ on Win32
|
||||
===================================
|
||||
|
||||
Multi-threaded GTK+ programs might work on Windows in special simple
|
||||
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
|
||||
in the same thread, it might work. Otherwise, probably not at
|
||||
all. Possible ways to fix this are being investigated.
|
||||
|
||||
Wintab
|
||||
======
|
||||
|
||||
The tablet support uses the Wintab API. The Wintab development kit is
|
||||
no longer required. The wintab.h header file is bundled with GTK+
|
||||
sources. Unfortunately it seems that only Wacom tablets come with
|
||||
support for the Wintab API nowadays.
|
||||
|
||||
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
|
||||
The Win32 backend in GTK+ is not as stable or correct as the X11
|
||||
one.
|
||||
|
||||
For prebuilt runtime and developer packages see
|
||||
http://www.gimp.org/win32/downloads.html .
|
||||
|
||||
There is also a gtk-1-3-win32-production branch of GTK+ that was
|
||||
branched off from before the addition of the no-flicker and other
|
||||
functionality that was new in GTK+ 2.0.0. The vesion number used for
|
||||
that branch is 1.3.0. It corresponds most closely to GTK 1.2.7 on
|
||||
Unix. For new code, you shouldn't be using that.
|
||||
|
||||
Building GTK+ on Win32
|
||||
======================
|
||||
|
||||
There are two ways to build GTK+ for win32.
|
||||
|
||||
1) Use the autoconf-generated configure script, and the resulting
|
||||
Makefiles (which use libtool and gcc to do the compilation). I use
|
||||
this myself, but it can be hard to setup correctly.
|
||||
|
||||
Personally I run configure with:
|
||||
CC='gcc -mpentium -fnative-struct' CPPFLAGS='-I/target/include' CFLAGS=-O2 LDFLAGS='-L/target/lib' ./configure --disable-static --prefix=/target --with-gdktarget=win32 --with-wintab=/src/wtkit126 --with-ie55=/src/workshop/ie55_lib --host=i386-pc-mingw32
|
||||
|
||||
Then, in theory, you can just say "make", like on Unix. In reality,
|
||||
there are a few hickups that require manual intervention, and it's
|
||||
best to run make separately in each subdirectory. At least for me,
|
||||
when libtool creates an .exe file, it puts the real .exe in the .libs
|
||||
directory, and leaves a wrapper .exe in the work directory. For some
|
||||
reason that wrapper doesn't work for me, it doesn't do anything. So, I
|
||||
always do a "cp .libs/*.exe ." after running a make that has produced
|
||||
some exes.
|
||||
|
||||
Another issue is with the gdk-pixbuf.loaders file. It's probably best
|
||||
to do a "make install" in the gdk-pixbuf directory, and let that set
|
||||
up a mostly correct gdk-pixbuf.loaders in the target directory. Then
|
||||
copy that back to the source directory. It's needed in gtk/stock-icons
|
||||
where make runs gdk-pixbuf-csource.
|
||||
|
||||
Etc, you get the idea. It can be a bit of a pain.
|
||||
|
||||
2) Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
|
||||
makefile.msc in gdk and gtk. Be prepared to manually edit various
|
||||
makefile.msc files, and the makefile snippets in build/win32.
|
||||
|
||||
Alternative 1 also generates Microsoft import libraries (.lib), if you
|
||||
have lib.exe available. It might also work for cross-compilation from
|
||||
Unix.
|
||||
|
||||
Note that I use method 1 myself. Hans Breuer has been taking care of
|
||||
the MSVC makefiles. At times, we disagree a bit about various issues,
|
||||
and for instance the makefile.msc files will not produce identically
|
||||
named DLLs and import libraries as the "autoconfiscated" makefiles and
|
||||
libtool do. If this bothers you, you will have to fix the makefiles.
|
||||
|
||||
Using GTK+ on Win32
|
||||
===================
|
||||
|
||||
To use GTK+ on Win32, you also need either one of the above mentioned
|
||||
compilers. Other compilers might work, but don't count on it. Look for
|
||||
prebuilt developer packages (DLLs, import libraries, headers) on the
|
||||
above website.
|
||||
|
||||
Multi-threaded use of GTK+ on Win32
|
||||
===================================
|
||||
|
||||
Multi-threaded GTK+ programs might work on Windows in special simple
|
||||
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
|
||||
in the same thread, it might work. Otherwise, probably not at
|
||||
all. Possible ways to fix this are being investigated.
|
||||
|
||||
Wintab
|
||||
======
|
||||
|
||||
The tablet support uses the Wintab API. The Wintab development kit can
|
||||
be downloaded from http://www.pointing.com. Pass the --with-wintab
|
||||
flag to configure if you use that. If you use nmake and you don't care
|
||||
for Wintab, undefine HAVE_WINTAB in config.h.win32 and remove
|
||||
references to the wntab32x library from the makefile before building.
|
||||
|
||||
ActiveIMM
|
||||
=========
|
||||
|
||||
If you want to build a GTK+ that supports ActiveIMM (the Input Method
|
||||
Manager for non-EastAsia locales that can be used on Win9x/NT4), you
|
||||
need the dimm.h header file. That is somewhat difficult to find, but
|
||||
http://msdn.microsoft.com/downloads/samples/internet/wizard/ seems to
|
||||
be a good place to look nowadays. If you use "autoconfiscated" build,
|
||||
pass the --with-ie55 flag to configure specifying the location of the
|
||||
ie55_lib directory created by downloading the IE5.5 headers and libs
|
||||
from the above URL.
|
||||
|
||||
--Tor Lillqvist <tml@iki.fi>
|
||||
|
78
acconfig.h
Normal file
78
acconfig.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* Other stuff */
|
||||
#undef ENABLE_NLS
|
||||
#undef GTK_COMPILED_WITH_DEBUGGING
|
||||
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_DIMM_H
|
||||
#undef HAVE_GETTEXT
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_PROGRESSIVE_JPEG
|
||||
#undef HAVE_PWD_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_STPCPY
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SOLARIS_XINERAMA
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_XFREE_XINERAMA
|
||||
#undef HAVE_XINERAMA
|
||||
#undef HAVE_WINTAB
|
||||
#undef HAVE_XCONVERTCASE
|
||||
#undef HAVE_XFT
|
||||
|
||||
#undef HAVE_SIGSETJMP
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
||||
#undef USE_GMODULE
|
||||
#undef USE_MMX
|
||||
|
||||
/* Define to use XKB extension */
|
||||
#undef HAVE_XKB
|
||||
|
||||
/* Define to use shadowfb in the linux-fb port */
|
||||
#undef ENABLE_SHADOW_FB
|
||||
|
||||
/* Define to use a fb manager in the linux-fb port */
|
||||
#undef ENABLE_FB_MANAGER
|
||||
|
||||
#undef XINPUT_NONE
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Most machines will be happy with int or void. IRIX requires '...' */
|
||||
#undef SIGNAL_ARG_TYPE
|
||||
|
||||
#undef GETTEXT_PACKAGE
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
26
autogen.sh
26
autogen.sh
@@ -14,12 +14,9 @@ DIE=0
|
||||
|
||||
have_libtool=false
|
||||
if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
|
||||
libtool_version=`libtoolize --version |
|
||||
head -1 |
|
||||
sed -e 's/^\(.*\)([^)]*)\(.*\)$/\1\2/g' \
|
||||
-e 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
|
||||
libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
|
||||
case $libtool_version in
|
||||
1.4*|1.5*|2.2*)
|
||||
1.4*|1.5*)
|
||||
have_libtool=true
|
||||
;;
|
||||
esac
|
||||
@@ -48,24 +45,16 @@ fi
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if automake-1.11 --version < /dev/null > /dev/null 2>&1 ; then
|
||||
AUTOMAKE=automake-1.11
|
||||
ACLOCAL=aclocal-1.11
|
||||
else if automake-1.10 --version < /dev/null > /dev/null 2>&1 ; then
|
||||
AUTOMAKE=automake-1.10
|
||||
ACLOCAL=aclocal-1.10
|
||||
else if automake-1.7 --version < /dev/null > /dev/null 2>&1 ; then
|
||||
if automake-1.7 --version < /dev/null > /dev/null 2>&1 ; then
|
||||
AUTOMAKE=automake-1.7
|
||||
ACLOCAL=aclocal-1.7
|
||||
else
|
||||
echo
|
||||
echo "You must have automake 1.7.x, 1,10.x or 1.11.x installed to compile $PROJECT."
|
||||
echo "You must have automake 1.7.x installed to compile $PROJECT."
|
||||
echo "Install the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
|
||||
DIE=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
@@ -104,12 +93,7 @@ fi
|
||||
|
||||
rm -rf autom4te.cache
|
||||
|
||||
# README and INSTALL are required by automake, but may be deleted by clean
|
||||
# up rules. to get automake to work, simply touch these here, they will be
|
||||
# regenerated from their corresponding *.in files by ./configure anyway.
|
||||
touch README INSTALL
|
||||
|
||||
$ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
|
||||
$ACLOCAL $ACLOCAL_FLAGS || exit $?
|
||||
|
||||
libtoolize --force || exit $?
|
||||
gtkdocize || exit $?
|
||||
|
@@ -1,21 +1,95 @@
|
||||
/* config.h.win32.in. Merged from two versions generated by configure for gcc and MSVC. */
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* Other stuff */
|
||||
#define ENABLE_NLS 1
|
||||
#define GTK_COMPILED_WITH_DEBUGGING "yes"
|
||||
|
||||
/* #undef HAVE_CATGETS */
|
||||
/* #undef HAVE_DIMM_H */
|
||||
#define HAVE_GETTEXT 1
|
||||
/* #undef HAVE_IPC_H */
|
||||
/* #undef HAVE_LC_MESSAGES */
|
||||
#define HAVE_PROGRESSIVE_JPEG 1
|
||||
/* #undef HAVE_PWD_H */
|
||||
/* #undef HAVE_SHM_H */
|
||||
/* #undef HAVE_STPCPY */
|
||||
/* #undef HAVE_XSHM_H */
|
||||
/* #undef HAVE_SHAPE_EXT */
|
||||
/* #undef HAVE_SOLARIS_XINERAMA */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_SYS_TIME_H */
|
||||
#endif /* _MSC_VER */
|
||||
/* #undef HAVE_XFREE_XINERAMA */
|
||||
/* #undef HAVE_XINERAMA */
|
||||
#define HAVE_WINTAB 1
|
||||
/* #undef HAVE_XCONVERTCASE */
|
||||
/* #undef HAVE_XFT */
|
||||
|
||||
/* #undef HAVE_SIGSETJMP */
|
||||
|
||||
#define NO_FD_SET 1
|
||||
|
||||
/* #undef RESOURCE_BASE */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define USE_GMODULE 1
|
||||
#define USE_MMX 1
|
||||
#endif
|
||||
|
||||
/* Define to use XKB extension */
|
||||
/* #undef HAVE_XKB */
|
||||
|
||||
/* Define to use shadowfb in the linux-fb port */
|
||||
/* #undef ENABLE_SHADOW_FB */
|
||||
|
||||
/* Define to use a fb manager in the linux-fb port */
|
||||
/* #undef ENABLE_FB_MANAGER */
|
||||
|
||||
/* #undef XINPUT_NONE */
|
||||
/* #undef XINPUT_GXI */
|
||||
/* #undef XINPUT_XFREE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Most machines will be happy with int or void. IRIX requires '...' */
|
||||
/* #undef SIGNAL_ARG_TYPE */
|
||||
|
||||
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
||||
|
||||
/* always defined to indicate that i18n is enabled */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* Define if gio can sniff image data */
|
||||
/* #undef GDK_PIXBUF_USE_GIO_MIME */
|
||||
|
||||
/* The prefix for our gettext translation domains. */
|
||||
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
|
||||
|
||||
/* Define if debugging is enabled */
|
||||
#define GTK_COMPILED_WITH_DEBUGGING "yes"
|
||||
|
||||
/* Define the location where the catalogs will be installed */
|
||||
#define GTK_LOCALEDIR "NONE/share/locale"
|
||||
#define GTK_LOCALEDIR "UNUSED"
|
||||
|
||||
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
|
||||
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
|
||||
@@ -23,12 +97,6 @@
|
||||
/* Is the wctype implementation broken */
|
||||
/* #undef HAVE_BROKEN_WCTYPE */
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
/* #undef HAVE_CRT_EXTERNS_H */
|
||||
|
||||
/* Define to 1 if CUPS 1.2 API is available */
|
||||
/* #undef HAVE_CUPS_API_1_2 */
|
||||
|
||||
/* Define to 1 if you have the `dcgettext' function. */
|
||||
#define HAVE_DCGETTEXT 1
|
||||
|
||||
@@ -38,18 +106,12 @@
|
||||
/* Define to 1 if you have the `flockfile' function. */
|
||||
/* #undef HAVE_FLOCKFILE */
|
||||
|
||||
/* Define to 1 if you have the <ftw.h> header file. */
|
||||
/* #undef HAVE_FTW_H */
|
||||
|
||||
/* Define to 1 if you have the `getc_unlocked' function. */
|
||||
/* #undef HAVE_GETC_UNLOCKED */
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
#else
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_GETPAGESIZE */
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Define to 1 if you have the `getresuid' function. */
|
||||
/* #undef HAVE_GETRESUID */
|
||||
@@ -57,24 +119,12 @@
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
#define HAVE_GETTEXT 1
|
||||
|
||||
/* Have GNU ftw */
|
||||
/* #undef HAVE_GNU_FTW */
|
||||
|
||||
/* Define to 1 if you have the `httpGetAuthString' function. */
|
||||
/* #undef HAVE_HTTPGETAUTHSTRING */
|
||||
|
||||
/* Define if cups http_t authstring field is accessible */
|
||||
/* #undef HAVE_HTTP_AUTHSTRING */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#else
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
#endif
|
||||
|
||||
/* Define to 1 if ipc.h is available */
|
||||
/* #undef HAVE_IPC_H */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
/* #undef HAVE_LC_MESSAGES */
|
||||
@@ -82,9 +132,6 @@
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
/* #undef HAVE_LOCALTIME_R */
|
||||
|
||||
/* Define to 1 if you have the `lstat' function. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
@@ -100,64 +147,37 @@
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define to 1 if libpapi available */
|
||||
/* #undef HAVE_PAPI */
|
||||
|
||||
/* Define to 1 is libjpeg supports progressive JPEG */
|
||||
/* #undef HAVE_PROGRESSIVE_JPEG */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
/* #undef HAVE_PWD_H */
|
||||
|
||||
/* Have the Xrandr extension library */
|
||||
/* #undef HAVE_RANDR */
|
||||
|
||||
/* Define to 1 if shm.h is available */
|
||||
/* #undef HAVE_SHM_H */
|
||||
|
||||
/* Define to 1 if sigsetjmp is available */
|
||||
/* #undef HAVE_SIGSETJMP */
|
||||
|
||||
/* Have the sockaddr_un.sun_len member */
|
||||
/* #undef HAVE_SOCKADDR_UN_SUN_LEN */
|
||||
|
||||
/* Define to 1 if solaris xinerama is available */
|
||||
/* #undef HAVE_SOLARIS_XINERAMA */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_STDINT_H 1
|
||||
#else
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_STDINT_H */
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
/* #undef HAVE_STRINGS_H */
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if sys/select.h is available */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if sys/sysinfo.h is available */
|
||||
/* #undef HAVE_SYS_SYSINFO_H */
|
||||
|
||||
/* Define to 1 if sys/systeminfo.h is available */
|
||||
/* #undef HAVE_SYS_SYSTEMINFO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_SYS_TIME_H */
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
@@ -168,9 +188,9 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_UNISTD_H 1
|
||||
#else
|
||||
#else /* _MSC_VER */
|
||||
/* #undef HAVE_UNISTD_H */
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Have uxtheme.h include file */
|
||||
#define HAVE_UXTHEME_H 1
|
||||
@@ -184,71 +204,27 @@
|
||||
/* Define if we have X11R6 */
|
||||
/* #undef HAVE_X11R6 */
|
||||
|
||||
/* Have the XCOMPOSITE X extension */
|
||||
/* #undef HAVE_XCOMPOSITE */
|
||||
|
||||
/* Define to 1 if you have the `XConvertCase' function. */
|
||||
/* #undef HAVE_XCONVERTCASE */
|
||||
|
||||
/* Have the Xcursor library */
|
||||
/* #undef HAVE_XCURSOR */
|
||||
|
||||
/* Have the XDAMAGE X extension */
|
||||
/* #undef HAVE_XDAMAGE */
|
||||
|
||||
/* Have the XFIXES X extension */
|
||||
/* #undef HAVE_XFIXES */
|
||||
|
||||
/* Define to 1 if XFree Xinerama is available */
|
||||
/* #undef HAVE_XFREE_XINERAMA */
|
||||
|
||||
/* Define to 1 if xinerama is available */
|
||||
/* #undef HAVE_XINERAMA */
|
||||
|
||||
/* Define to 1 if you have the `XInternAtoms' function. */
|
||||
/* #undef HAVE_XINTERNATOMS */
|
||||
|
||||
/* Define to use XKB extension */
|
||||
/* #undef HAVE_XKB */
|
||||
|
||||
/* Define to 1 if xshm.h is available */
|
||||
/* #undef HAVE_XSHM_H */
|
||||
|
||||
/* Have the SYNC extension library */
|
||||
/* #undef HAVE_XSYNC */
|
||||
|
||||
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
|
||||
/* #undef HAVE__NL_MEASUREMENT_MEASUREMENT */
|
||||
|
||||
/* Define if _NL_PAPER_HEIGHT is available */
|
||||
/* #undef HAVE__NL_PAPER_HEIGHT */
|
||||
|
||||
/* Define if _NL_PAPER_WIDTH is available */
|
||||
/* #undef HAVE__NL_PAPER_WIDTH */
|
||||
|
||||
/* Define if _NL_TIME_FIRST_WEEKDAY is available */
|
||||
/* #undef HAVE__NL_TIME_FIRST_WEEKDAY */
|
||||
|
||||
/* Define to 1 if you have the `_NSGetEnviron' function. */
|
||||
/* #undef HAVE__NSGETENVIRON */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define if <X11/extensions/XIproto.h> needed for xReply */
|
||||
/* #undef NEED_XIPROTO_H_FOR_XREPLY */
|
||||
|
||||
/* Define to 1 if fd_set is not available */
|
||||
#define NO_FD_SET 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#ifndef _MSC_VER
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
#else
|
||||
#define NO_MINUS_C_MINUS_O 1
|
||||
#endif
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B"
|
||||
|
||||
@@ -256,7 +232,7 @@
|
||||
#define PACKAGE_NAME "gtk+"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "gtk+ @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@"
|
||||
#define PACKAGE_STRING "gtk+ 2.9.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "gtk+"
|
||||
@@ -270,31 +246,9 @@
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if gmodule works and should be used */
|
||||
#define USE_GMODULE 1
|
||||
|
||||
/* Whether to load modules via .la files rather than directly */
|
||||
/* #undef USE_LA_MODULES */
|
||||
|
||||
/* Define to 1 if medialib is available and should be used */
|
||||
/* #undef USE_MEDIALIB */
|
||||
|
||||
/* Define to 1 if medialib 2.5 is available */
|
||||
/* #undef USE_MEDIALIB25 */
|
||||
|
||||
/* Define to 1 if XXM is available and should be used */
|
||||
#ifndef _MSC_VER
|
||||
# define USE_MMX 1
|
||||
#else
|
||||
# undef USE_MMX
|
||||
#endif
|
||||
|
||||
/* Define to 1 if no XInput should be used */
|
||||
/* #undef XINPUT_NONE */
|
||||
|
||||
/* Define to 1 if XFree XInput should be used */
|
||||
/* #undef XINPUT_XFREE */
|
||||
|
||||
/* Define to 1 if the X Window System is missing or not being used. */
|
||||
/* #undef X_DISPLAY_MISSING */
|
||||
|
||||
|
1049
configure.in
1049
configure.in
File diff suppressed because it is too large
Load Diff
2
contrib/.cvsignore
Normal file
2
contrib/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
@@ -1,8 +1,5 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS =
|
||||
if USE_X11
|
||||
SUBDIRS += gdk-pixbuf-xlib
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
7
contrib/gdk-pixbuf-xlib/.cvsignore
Normal file
7
contrib/gdk-pixbuf-xlib/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.la
|
||||
*.lo
|
||||
.libs
|
||||
.deps
|
||||
gdk-pixbuf-xlib-2.0.pc
|
@@ -1,159 +1,3 @@
|
||||
=== ChangeLog discontinued ===
|
||||
|
||||
With the move to git, GTK+ is switching from a ChangeLog file
|
||||
to relying on commit messages to provide change history. Please
|
||||
see README.commits for guidance on the expected message format.
|
||||
|
||||
2009-03-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.16.0 ===
|
||||
|
||||
2009-03-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.5 ===
|
||||
|
||||
2009-02-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.4 ===
|
||||
|
||||
2009-02-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.3 ===
|
||||
|
||||
2009-01-27 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.2 ===
|
||||
|
||||
2009-01-23 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.1 ===
|
||||
|
||||
2009-01-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.15.0 ===
|
||||
|
||||
2008-09-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.14.2 ===
|
||||
|
||||
2008-09-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.14.1 ===
|
||||
|
||||
2008-09-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.14.0 ===
|
||||
|
||||
2008-08-18 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* ==== Released 2.13.7 ===
|
||||
|
||||
2008-08-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.6 ===
|
||||
|
||||
2008-07-21 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.5 ===
|
||||
|
||||
2008-07-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.4 ===
|
||||
|
||||
2008-06-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.3 ===
|
||||
|
||||
2008-06-03 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.2 ===
|
||||
|
||||
2008-05-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.1 ===
|
||||
|
||||
2008-05-26 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gdk-pixbuf-xlib.h
|
||||
* gdk-pixbuf-xlibrgb.h: use G_BEGIN/END_DECLS.
|
||||
|
||||
2008-02-16 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.13.0 ===
|
||||
|
||||
2007-10-16 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.12.1 ===
|
||||
|
||||
2007-09-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.12.0 ===
|
||||
|
||||
2007-07-21 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.6 ===
|
||||
|
||||
2007-07-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.5 ===
|
||||
|
||||
2007-06-19 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.4 ===
|
||||
|
||||
2007-06-15 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.3 ===
|
||||
|
||||
2007-06-06 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.2 ===
|
||||
|
||||
2007-06-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.1 ===
|
||||
|
||||
2007-05-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.11.0 ===
|
||||
|
||||
2006-10-08 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk-pixbuf-xlib.c: Apply a cleanup patch by
|
||||
Kjartan Maraas (#341812)
|
||||
|
||||
2006-08-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.10.2 ===
|
||||
|
||||
2006-07-23 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.10.1 ===
|
||||
|
||||
2006-07-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.10.0 ===
|
||||
|
||||
2006-06-21 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.9.4 ===
|
||||
|
||||
2006-06-12 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.9.3 ===
|
||||
|
||||
2006-06-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.9.2 ===
|
||||
|
||||
2006-05-16 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.9.1 ====
|
||||
|
||||
2006-05-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* === Released 2.9.0 ===
|
||||
|
||||
2005-11-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk-pixbuf-xlib-drawable.c:
|
||||
|
@@ -1,20 +1,15 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
if PLATFORM_WIN32
|
||||
no_undefined = -no-undefined
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES=libgdk_pixbuf_xlib-2.0.la
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) -I$(top_builddir) \
|
||||
-I$(top_srcdir)/gdk-pixbuf \
|
||||
-I$(top_srcdir)/contrib \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
$(GDK_PIXBUF_XLIB_DEP_CFLAGS)
|
||||
|
||||
libgdk_pixbuf_xlib_2_0_la_LDFLAGS = \
|
||||
-export-dynamic \
|
||||
$(no_undefined) \
|
||||
-version-info $(LT_VERSION_INFO)
|
||||
|
||||
libgdk_pixbuf_xlib_2_0_la_LIBADD = \
|
||||
@@ -37,6 +32,4 @@ libgdk_pixbuf_xlibinclude_HEADERS = \
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = gdk-pixbuf-xlib-2.0.pc
|
||||
|
||||
EXTRA_DIST += gdk-pixbuf-xlib-2.0.pc.in
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
EXTRA_DIST = gdk-pixbuf-xlib-2.0.pc.in
|
||||
|
@@ -26,7 +26,7 @@
|
||||
/* Ported to Xlib by John Harper <john@dcs.warwick.ac.uk> */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-private.h>
|
||||
@@ -152,9 +152,10 @@ rgb1 (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
int xx, yy;
|
||||
int width, height;
|
||||
int bpl;
|
||||
guint8 *s;
|
||||
register guint8 data;
|
||||
guint8 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
d (printf ("1 bits/pixel\n"));
|
||||
|
||||
@@ -166,6 +167,7 @@ rgb1 (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
bpl = image->bytes_per_line;
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
s = srow;
|
||||
o = orow;
|
||||
|
||||
for (xx = 0; xx < width; xx ++) {
|
||||
@@ -189,9 +191,10 @@ rgb1a (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
int xx, yy;
|
||||
int width, height;
|
||||
int bpl;
|
||||
guint8 *s;
|
||||
register guint8 data;
|
||||
guint8 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
guint32 remap[2];
|
||||
|
||||
d (printf ("1 bits/pixel\n"));
|
||||
@@ -218,6 +221,7 @@ rgb1a (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
}
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
s = srow;
|
||||
o = orow;
|
||||
|
||||
for (xx = 0; xx < width; xx ++) {
|
||||
@@ -241,7 +245,7 @@ rgb8 (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
int bpl;
|
||||
guint32 mask;
|
||||
register guint32 data;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
register guint8 *s;
|
||||
register guint8 *o;
|
||||
|
||||
@@ -282,7 +286,7 @@ rgb8a (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
|
||||
guint32 remap[256];
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
register guint32 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -336,7 +340,7 @@ rgb565lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -407,7 +411,7 @@ rgb565msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -479,7 +483,7 @@ rgb565alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
#endif
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -536,7 +540,7 @@ rgb565amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
#endif
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -592,7 +596,7 @@ rgb555lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -663,7 +667,7 @@ rgb555msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -735,7 +739,7 @@ rgb555alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
#endif
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -792,7 +796,7 @@ rgb555amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
#endif
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -840,7 +844,7 @@ rgb888alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
|
||||
guint8 *s; /* for byte order swapping */
|
||||
guint8 *o;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
@@ -871,7 +875,7 @@ rgb888lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
int width, height;
|
||||
int bpl;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
guint8 *o, *s;
|
||||
|
||||
width = image->width;
|
||||
@@ -901,7 +905,7 @@ rgb888amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colorma
|
||||
int width, height;
|
||||
int bpl;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
#ifdef LITTLE
|
||||
guint32 *o;
|
||||
guint32 *s;
|
||||
@@ -949,7 +953,7 @@ rgb888msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap
|
||||
int width, height;
|
||||
int bpl;
|
||||
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
guint8 *s;
|
||||
guint8 *o;
|
||||
|
||||
@@ -983,7 +987,8 @@ convert_real_slow (XImage *image, guchar *pixels, int rowstride, xlib_colormap *
|
||||
int xx, yy;
|
||||
int width, height;
|
||||
int bpl;
|
||||
guint8 *srow = (guint8 *)image->data, *orow = pixels;
|
||||
guint8 *srow = image->data, *orow = pixels;
|
||||
guint8 *s;
|
||||
guint8 *o;
|
||||
guint32 pixel;
|
||||
Visual *v;
|
||||
@@ -1006,6 +1011,7 @@ convert_real_slow (XImage *image, guchar *pixels, int rowstride, xlib_colormap *
|
||||
red_prec, green_prec, blue_prec));
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
s = srow;
|
||||
o = orow;
|
||||
for (xx = 0; xx < width; xx++) {
|
||||
pixel = XGetPixel (image, xx, yy);
|
||||
@@ -1134,7 +1140,7 @@ xlib_window_is_viewable (Window w)
|
||||
|
||||
while (w != 0) {
|
||||
Window parent, root, *children;
|
||||
guint nchildren;
|
||||
int nchildren;
|
||||
|
||||
XGetWindowAttributes (gdk_pixbuf_dpy, w, &wa);
|
||||
if (wa.map_state != IsViewable)
|
||||
@@ -1223,7 +1229,7 @@ gdk_pixbuf_xlib_get_from_drawable (GdkPixbuf *dest,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height)
|
||||
{
|
||||
guint src_width, src_height;
|
||||
int src_width, src_height;
|
||||
XImage *image;
|
||||
int rowstride, bpp, alpha;
|
||||
XWindowAttributes wa;
|
||||
@@ -1260,8 +1266,7 @@ gdk_pixbuf_xlib_get_from_drawable (GdkPixbuf *dest,
|
||||
src_height = wa.height;
|
||||
} else {
|
||||
Window root;
|
||||
int tx, ty;
|
||||
guint bwidth, depth;
|
||||
int tx, ty, bwidth, depth;
|
||||
XGetGeometry (gdk_pixbuf_dpy, src, &root, &tx, &ty,
|
||||
&src_width, &src_height, &bwidth, &depth);
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
/* Trivially ported to Xlib(RGB) by John Harper. */
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-xlib-private.h"
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-private.h>
|
||||
#include "gdk-pixbuf-xlib-private.h"
|
||||
|
@@ -21,11 +21,12 @@
|
||||
#ifndef GDK_PIXBUF_XLIB_H
|
||||
#define GDK_PIXBUF_XLIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
|
||||
@@ -82,6 +83,9 @@ GdkPixbuf *gdk_pixbuf_xlib_get_from_drawable (GdkPixbuf *dest,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
|
||||
G_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* GDK_PIXBUF_XLIB_H */
|
||||
|
@@ -51,13 +51,15 @@
|
||||
#ifndef __XLIB_RGB_H__
|
||||
#define __XLIB_RGB_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _XlibRgbCmap XlibRgbCmap;
|
||||
|
||||
struct _XlibRgbCmap {
|
||||
@@ -183,6 +185,9 @@ xlib_rgb_get_display (void);
|
||||
Screen *
|
||||
xlib_rgb_get_screen (void);
|
||||
|
||||
G_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __XLIB_RGB_H__ */
|
||||
|
11
demos/.cvsignore
Normal file
11
demos/.cvsignore
Normal file
@@ -0,0 +1,11 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.libs
|
||||
.deps
|
||||
testanimation
|
||||
test-inline-pixbufs.h
|
||||
testpixbuf-drawable
|
||||
testpixbuf-scale
|
||||
testpixbuf-save
|
||||
testpixbuf
|
||||
pixbuf-demo
|
@@ -1,14 +1,15 @@
|
||||
## Makefile.am for gtk+/demos
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = gtk-demo
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GTK_DEP_CFLAGS)
|
||||
|
||||
DEPS = \
|
||||
@@ -19,14 +20,11 @@ DEPS = \
|
||||
LDADDS = \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
|
||||
$(top_builddir)/gdk/$(gdktargetlib) \
|
||||
$(top_builddir)/gtk/$(gtktargetlib) \
|
||||
$(GTK_DEP_LIBS) \
|
||||
$(MATH_LIB)
|
||||
$(top_builddir)/gtk/$(gtktargetlib)
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
testpixbuf-drawable \
|
||||
testanimation \
|
||||
testpixbuf-color \
|
||||
testpixbuf-save \
|
||||
testpixbuf-scale \
|
||||
pixbuf-demo
|
||||
@@ -55,7 +53,6 @@ test-inline-pixbufs.h: $(pixbuf_csource_deps) apple-red.png gnome-foot.png
|
||||
testpixbuf_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_drawable_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_save_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_color_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_scale_DEPENDENCIES = $(DEPS)
|
||||
testanimation_DEPENDENCIES = $(DEPS)
|
||||
pixbuf_demo_DEPENDENCIES = $(DEPS)
|
||||
@@ -63,7 +60,6 @@ pixbuf_demo_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_LDADD = $(LDADDS)
|
||||
testpixbuf_drawable_LDADD = $(LDADDS)
|
||||
testpixbuf_save_LDADD = $(LDADDS)
|
||||
testpixbuf_color_LDADD = $(LDADDS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS)
|
||||
testanimation_LDADD = $(LDADDS)
|
||||
pixbuf_demo_LDADD = $(LDADDS)
|
||||
@@ -71,12 +67,11 @@ pixbuf_demo_LDADD = $(LDADDS)
|
||||
testpixbuf_SOURCES = testpixbuf.c pixbuf-init.c
|
||||
testpixbuf_drawable_SOURCES = testpixbuf-drawable.c pixbuf-init.c
|
||||
testpixbuf_save_SOURCES = testpixbuf-save.c
|
||||
testpixbuf_color_SOURCES = testpixbuf-color.c
|
||||
testpixbuf_scale_SOURCES = testpixbuf-scale.c pixbuf-init.c
|
||||
testanimation_SOURCES = testanimation.c pixbuf-init.c
|
||||
pixbuf_demo_SOURCES = pixbuf-demo.c pixbuf-init.c
|
||||
|
||||
EXTRA_DIST += \
|
||||
EXTRA_DIST = \
|
||||
apple-red.png \
|
||||
background.jpg \
|
||||
gnome-applets.png \
|
||||
@@ -88,5 +83,3 @@ EXTRA_DIST += \
|
||||
gnu-keys.png
|
||||
|
||||
DISTCLEANFILES = test-inline-pixbufs.h
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
7
demos/gtk-demo/.cvsignore
Normal file
7
demos/gtk-demo/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.libs
|
||||
.deps
|
||||
gtk-demo
|
||||
demos.h
|
||||
geninclude.pl
|
@@ -1,14 +1,11 @@
|
||||
## Makefile.am for gtk+/demos
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
democodedir=$(datadir)/gtk-2.0/demo
|
||||
|
||||
## These should be in the order you want them to appear in the
|
||||
## These should be in the order you want them to appear in the
|
||||
## demo app, which means alphabetized by demo title, not filename
|
||||
demos = \
|
||||
appwindow.c \
|
||||
assistant.c \
|
||||
builder.c \
|
||||
button_box.c \
|
||||
changedisplay.c \
|
||||
clipboard.c \
|
||||
@@ -17,41 +14,33 @@ demos = \
|
||||
dialog.c \
|
||||
drawingarea.c \
|
||||
editable_cells.c \
|
||||
entry_buffer.c \
|
||||
entry_completion.c \
|
||||
expander.c \
|
||||
hypertext.c \
|
||||
iconview.c \
|
||||
iconview_edit.c \
|
||||
images.c \
|
||||
infobar.c \
|
||||
links.c \
|
||||
list_store.c \
|
||||
menus.c \
|
||||
offscreen_window.c \
|
||||
offscreen_window2.c \
|
||||
panes.c \
|
||||
pickers.c \
|
||||
pixbufs.c \
|
||||
printing.c \
|
||||
rotated_text.c \
|
||||
search_entry.c \
|
||||
sizegroup.c \
|
||||
spinner.c \
|
||||
stock_browser.c \
|
||||
textview.c \
|
||||
textscroll.c \
|
||||
toolpalette.c \
|
||||
tree_store.c \
|
||||
ui_manager.c
|
||||
|
||||
INCLUDES = \
|
||||
-DDEMOCODEDIR="\"$(democodedir)\"" \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
-DDEMOCODEDIR="\"$(democodedir)\"" \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GTK_DEP_CFLAGS)
|
||||
|
||||
DEPS = \
|
||||
@@ -62,16 +51,14 @@ DEPS = \
|
||||
LDADDS = \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
|
||||
$(top_builddir)/gdk/$(gdktargetlib) \
|
||||
$(top_builddir)/gtk/$(gtktargetlib) \
|
||||
$(GTK_DEP_LIBS)
|
||||
$(top_builddir)/gtk/$(gtktargetlib)
|
||||
|
||||
bin_PROGRAMS = gtk-demo
|
||||
|
||||
BUILT_SOURCES = demos.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(IMAGEFILES) \
|
||||
demo.ui
|
||||
EXTRA_DIST = \
|
||||
$(IMAGEFILES)
|
||||
|
||||
demos.h: @REBUILD@ $(demos) geninclude.pl
|
||||
(here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
||||
@@ -84,7 +71,6 @@ gtk_demo_SOURCES = \
|
||||
|
||||
gtk_demo_DEPENDENCIES = $(DEPS)
|
||||
gtk_demo_LDADD = $(LDADDS)
|
||||
gtk_demo_LDFLAGS = -export-dynamic
|
||||
|
||||
IMAGEFILES= alphatest.png \
|
||||
apple-red.png \
|
||||
@@ -101,8 +87,6 @@ IMAGEFILES= alphatest.png \
|
||||
gnu-keys.png \
|
||||
gtk-logo-rgb.gif
|
||||
|
||||
democode_DATA = $(demos) $(IMAGEFILES) demo.ui
|
||||
democode_DATA = $(demos) $(IMAGEFILES)
|
||||
|
||||
DISTCLEANFILES = demos.h
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *infobar = NULL;
|
||||
static GtkWidget *messagelabel = NULL;
|
||||
|
||||
static void
|
||||
activate_action (GtkAction *action)
|
||||
@@ -18,7 +16,7 @@ activate_action (GtkAction *action)
|
||||
const gchar *typename = G_OBJECT_TYPE_NAME (action);
|
||||
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
@@ -31,7 +29,7 @@ activate_action (GtkAction *action)
|
||||
"response",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL);
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
@@ -43,32 +41,37 @@ activate_radio_action (GtkAction *action, GtkRadioAction *current)
|
||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current));
|
||||
gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
|
||||
|
||||
if (active)
|
||||
if (active)
|
||||
{
|
||||
gchar *text;
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"You activated radio action: \"%s\" of type \"%s\".\n"
|
||||
"Current value: %d",
|
||||
name, typename, value);
|
||||
|
||||
text = g_strdup_printf ("You activated radio action: \"%s\" of type \"%s\".\n"
|
||||
"Current value: %d",
|
||||
name, typename, value);
|
||||
gtk_label_set_text (GTK_LABEL (messagelabel), text);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), (GtkMessageType)value);
|
||||
gtk_widget_show (infobar);
|
||||
g_free (text);
|
||||
/* Close dialog on user response */
|
||||
g_signal_connect (dialog,
|
||||
"response",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
activate_email (GtkAboutDialog *about,
|
||||
const gchar *link,
|
||||
gpointer data)
|
||||
{
|
||||
gchar *text;
|
||||
text = g_strdup_printf ("send mail to %s", link);
|
||||
g_print ("%s\n", text);
|
||||
g_free (text);
|
||||
g_print ("send mail to %s\n", link);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
activate_url (GtkAboutDialog *about,
|
||||
const gchar *link,
|
||||
gpointer data)
|
||||
@@ -129,32 +132,31 @@ about_cb (GtkAction *action,
|
||||
gtk_about_dialog_set_email_hook (activate_email, NULL, NULL);
|
||||
gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
|
||||
gtk_show_about_dialog (GTK_WINDOW (window),
|
||||
"program-name", "GTK+ Code Demos",
|
||||
"name", "GTK+ Code Demos",
|
||||
"version", PACKAGE_VERSION,
|
||||
"copyright", "(C) 1997-2009 The GTK+ Team",
|
||||
"copyright", "(C) 1997-2005 The GTK+ Team",
|
||||
"license", license,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK+ functions.",
|
||||
"authors", authors,
|
||||
"documenters", documentors,
|
||||
"logo", transparent,
|
||||
"title", "About GTK+ Code Demos",
|
||||
NULL);
|
||||
|
||||
g_object_unref (transparent);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkAction action;
|
||||
} ToolMenuAction;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkActionClass parent_class;
|
||||
} ToolMenuActionClass;
|
||||
|
||||
G_DEFINE_TYPE(ToolMenuAction, tool_menu_action, GTK_TYPE_ACTION)
|
||||
G_DEFINE_TYPE(ToolMenuAction, tool_menu_action, GTK_TYPE_ACTION);
|
||||
|
||||
static void
|
||||
tool_menu_action_class_init (ToolMenuActionClass *class)
|
||||
@@ -176,30 +178,30 @@ static GtkActionEntry entries[] = {
|
||||
{ "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
|
||||
{ "New", GTK_STOCK_NEW, /* name, stock id */
|
||||
"_New", "<control>N", /* label, accelerator */
|
||||
"Create a new file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
"Create a new file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "File1", NULL, /* name, stock id */
|
||||
"File1", NULL, /* label, accelerator */
|
||||
"File1", NULL, /* label, accelerator */
|
||||
"Open first file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "Save", GTK_STOCK_SAVE, /* name, stock id */
|
||||
"_Save","<control>S", /* label, accelerator */
|
||||
"_Save","<control>S", /* label, accelerator */
|
||||
"Save current file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
|
||||
"Save _As...", NULL, /* label, accelerator */
|
||||
"Save _As...", NULL, /* label, accelerator */
|
||||
"Save to a file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "Quit", GTK_STOCK_QUIT, /* name, stock id */
|
||||
"_Quit", "<control>Q", /* label, accelerator */
|
||||
"_Quit", "<control>Q", /* label, accelerator */
|
||||
"Quit", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "About", NULL, /* name, stock id */
|
||||
"_About", "<control>A", /* label, accelerator */
|
||||
"About", /* tooltip */
|
||||
"_About", "<control>A", /* label, accelerator */
|
||||
"About", /* tooltip */
|
||||
G_CALLBACK (about_cb) },
|
||||
{ "Logo", "demo-gtk-logo", /* name, stock id */
|
||||
NULL, NULL, /* label, accelerator */
|
||||
NULL, NULL, /* label, accelerator */
|
||||
"GTK+", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
};
|
||||
@@ -208,9 +210,9 @@ static guint n_entries = G_N_ELEMENTS (entries);
|
||||
|
||||
static GtkToggleActionEntry toggle_entries[] = {
|
||||
{ "Bold", GTK_STOCK_BOLD, /* name, stock id */
|
||||
"_Bold", "<control>B", /* label, accelerator */
|
||||
"_Bold", "<control>B", /* label, accelerator */
|
||||
"Bold", /* tooltip */
|
||||
G_CALLBACK (activate_action),
|
||||
G_CALLBACK (activate_action),
|
||||
TRUE }, /* is_active */
|
||||
};
|
||||
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
|
||||
@@ -223,13 +225,13 @@ enum {
|
||||
|
||||
static GtkRadioActionEntry color_entries[] = {
|
||||
{ "Red", NULL, /* name, stock id */
|
||||
"_Red", "<control>R", /* label, accelerator */
|
||||
"_Red", "<control>R", /* label, accelerator */
|
||||
"Blood", COLOR_RED }, /* tooltip, value */
|
||||
{ "Green", NULL, /* name, stock id */
|
||||
"_Green", "<control>G", /* label, accelerator */
|
||||
"_Green", "<control>G", /* label, accelerator */
|
||||
"Grass", COLOR_GREEN }, /* tooltip, value */
|
||||
{ "Blue", NULL, /* name, stock id */
|
||||
"_Blue", "<control>B", /* label, accelerator */
|
||||
"_Blue", "<control>B", /* label, accelerator */
|
||||
"Sky", COLOR_BLUE }, /* tooltip, value */
|
||||
};
|
||||
static guint n_color_entries = G_N_ELEMENTS (color_entries);
|
||||
@@ -242,18 +244,18 @@ enum {
|
||||
|
||||
static GtkRadioActionEntry shape_entries[] = {
|
||||
{ "Square", NULL, /* name, stock id */
|
||||
"_Square", "<control>S", /* label, accelerator */
|
||||
"_Square", "<control>S", /* label, accelerator */
|
||||
"Square", SHAPE_SQUARE }, /* tooltip, value */
|
||||
{ "Rectangle", NULL, /* name, stock id */
|
||||
"_Rectangle", "<control>R", /* label, accelerator */
|
||||
"_Rectangle", "<control>R", /* label, accelerator */
|
||||
"Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
|
||||
{ "Oval", NULL, /* name, stock id */
|
||||
"_Oval", "<control>O", /* label, accelerator */
|
||||
"Egg", SHAPE_OVAL }, /* tooltip, value */
|
||||
"_Oval", "<control>O", /* label, accelerator */
|
||||
"Egg", SHAPE_OVAL }, /* tooltip, value */
|
||||
};
|
||||
static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
|
||||
|
||||
static const gchar *ui_info =
|
||||
static const gchar *ui_info =
|
||||
"<ui>"
|
||||
" <menubar name='MenuBar'>"
|
||||
" <menu action='FileMenu'>"
|
||||
@@ -285,7 +287,7 @@ static const gchar *ui_info =
|
||||
" <toolitem action='Open'>"
|
||||
" <menu action='OpenMenu'>"
|
||||
" <menuitem action='File1'/>"
|
||||
" </menu>"
|
||||
" </menu>"
|
||||
" </toolitem>"
|
||||
" <toolitem action='Quit'/>"
|
||||
" <separator action='Sep1'/>"
|
||||
@@ -305,7 +307,7 @@ static void
|
||||
register_stock_icons (void)
|
||||
{
|
||||
static gboolean registered = FALSE;
|
||||
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -317,17 +319,17 @@ register_stock_icons (void)
|
||||
"_GTK!",
|
||||
0, 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
registered = TRUE;
|
||||
|
||||
/* Register our stock items */
|
||||
gtk_stock_add (items, G_N_ELEMENTS (items));
|
||||
|
||||
|
||||
/* Add our custom icon factory to the list of defaults */
|
||||
factory = gtk_icon_factory_new ();
|
||||
gtk_icon_factory_add_default (factory);
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -347,7 +349,7 @@ register_stock_icons (void)
|
||||
|
||||
/* The gtk-logo-rgb icon has a white background, make it transparent */
|
||||
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
||||
|
||||
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (transparent);
|
||||
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
@@ -356,7 +358,7 @@ register_stock_icons (void)
|
||||
}
|
||||
else
|
||||
g_warning ("failed to load GTK logo for toolbar");
|
||||
|
||||
|
||||
/* Drop our reference to the factory, GTK will hold a reference. */
|
||||
g_object_unref (factory);
|
||||
}
|
||||
@@ -370,9 +372,9 @@ update_statusbar (GtkTextBuffer *buffer,
|
||||
gint row, col;
|
||||
gint count;
|
||||
GtkTextIter iter;
|
||||
|
||||
gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
|
||||
* underflow is allowed
|
||||
|
||||
gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
|
||||
* underflow is allowed
|
||||
*/
|
||||
|
||||
count = gtk_text_buffer_get_char_count (buffer);
|
||||
@@ -406,21 +408,21 @@ update_resize_grip (GtkWidget *widget,
|
||||
GdkEventWindowState *event,
|
||||
GtkStatusbar *statusbar)
|
||||
{
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN))
|
||||
{
|
||||
gboolean maximized;
|
||||
|
||||
maximized = event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
maximized = event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN);
|
||||
gtk_statusbar_set_has_resize_grip (statusbar, !maximized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_appwindow (GtkWidget *do_widget)
|
||||
{
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *table;
|
||||
@@ -435,10 +437,10 @@ do_appwindow (GtkWidget *do_widget)
|
||||
GError *error = NULL;
|
||||
|
||||
register_stock_icons ();
|
||||
|
||||
|
||||
/* Create the toplevel window
|
||||
*/
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@@ -450,46 +452,45 @@ do_appwindow (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
table = gtk_table_new (1, 5, FALSE);
|
||||
|
||||
table = gtk_table_new (1, 4, FALSE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
|
||||
/* Create the menubar and toolbar
|
||||
*/
|
||||
|
||||
|
||||
action_group = gtk_action_group_new ("AppWindowActions");
|
||||
open_action = g_object_new (tool_menu_action_get_type (),
|
||||
open_action = g_object_new (tool_menu_action_get_type (),
|
||||
"name", "Open",
|
||||
"label", "_Open",
|
||||
"tooltip", "Open a file",
|
||||
"stock-id", GTK_STOCK_OPEN,
|
||||
NULL);
|
||||
gtk_action_group_add_action (action_group, open_action);
|
||||
g_object_unref (open_action);
|
||||
gtk_action_group_add_actions (action_group,
|
||||
entries, n_entries,
|
||||
gtk_action_group_add_actions (action_group,
|
||||
entries, n_entries,
|
||||
window);
|
||||
gtk_action_group_add_toggle_actions (action_group,
|
||||
toggle_entries, n_toggle_entries,
|
||||
gtk_action_group_add_toggle_actions (action_group,
|
||||
toggle_entries, n_toggle_entries,
|
||||
NULL);
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
color_entries, n_color_entries,
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
color_entries, n_color_entries,
|
||||
COLOR_RED,
|
||||
G_CALLBACK (activate_radio_action),
|
||||
G_CALLBACK (activate_radio_action),
|
||||
NULL);
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
shape_entries, n_shape_entries,
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
shape_entries, n_shape_entries,
|
||||
SHAPE_SQUARE,
|
||||
G_CALLBACK (activate_radio_action),
|
||||
G_CALLBACK (activate_radio_action),
|
||||
NULL);
|
||||
|
||||
merge = gtk_ui_manager_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
|
||||
g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
|
||||
g_object_unref);
|
||||
gtk_ui_manager_insert_action_group (merge, action_group, 0);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
||||
gtk_ui_manager_get_accel_group (merge));
|
||||
|
||||
|
||||
if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
|
||||
{
|
||||
g_message ("building menus failed: %s", error->message);
|
||||
@@ -499,16 +500,17 @@ do_appwindow (GtkWidget *do_widget)
|
||||
bar = gtk_ui_manager_get_widget (merge, "/MenuBar");
|
||||
gtk_widget_show (bar);
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
bar,
|
||||
bar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
|
||||
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
|
||||
gtk_toolbar_set_tooltips (GTK_TOOLBAR (bar), TRUE);
|
||||
gtk_widget_show (bar);
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
bar,
|
||||
bar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
@@ -517,25 +519,6 @@ do_appwindow (GtkWidget *do_widget)
|
||||
/* Create document
|
||||
*/
|
||||
|
||||
infobar = gtk_info_bar_new ();
|
||||
gtk_widget_set_no_show_all (infobar, TRUE);
|
||||
messagelabel = gtk_label_new ("");
|
||||
gtk_widget_show (messagelabel);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar))),
|
||||
messagelabel,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK);
|
||||
g_signal_connect (infobar, "response",
|
||||
G_CALLBACK (gtk_widget_hide), NULL);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
infobar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
@@ -544,20 +527,20 @@ do_appwindow (GtkWidget *do_widget)
|
||||
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
sw,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 3, 4,
|
||||
0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
200, 200);
|
||||
|
||||
|
||||
contents = gtk_text_view_new ();
|
||||
gtk_widget_grab_focus (contents);
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw),
|
||||
contents);
|
||||
|
||||
@@ -567,7 +550,7 @@ do_appwindow (GtkWidget *do_widget)
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
statusbar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 4, 5,
|
||||
0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
|
||||
@@ -586,25 +569,23 @@ do_appwindow (GtkWidget *do_widget)
|
||||
statusbar,
|
||||
0);
|
||||
|
||||
g_signal_connect_object (window,
|
||||
"window_state_event",
|
||||
g_signal_connect_object (window,
|
||||
"window_state_event",
|
||||
G_CALLBACK (update_resize_grip),
|
||||
statusbar,
|
||||
0);
|
||||
|
||||
|
||||
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
infobar = NULL;
|
||||
messagelabel = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
|
@@ -1,165 +0,0 @@
|
||||
/* Assistant
|
||||
*
|
||||
* Demonstrates a sample multistep assistant. Assistants are used to divide
|
||||
* an operation into several simpler sequential steps, and to guide the user
|
||||
* through these steps.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *assistant = NULL;
|
||||
|
||||
static void
|
||||
on_assistant_apply (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
/* Apply here changes, this is a fictional
|
||||
example, so we just do nothing here */
|
||||
}
|
||||
|
||||
static void
|
||||
on_assistant_close_cancel (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkWidget **assistant = (GtkWidget **) data;
|
||||
|
||||
gtk_widget_destroy (*assistant);
|
||||
*assistant = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
|
||||
{
|
||||
gint current_page, n_pages;
|
||||
gchar *title;
|
||||
|
||||
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
|
||||
n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
|
||||
|
||||
title = g_strdup_printf ("Sample assistant (%d of %d)", current_page + 1, n_pages);
|
||||
gtk_window_set_title (GTK_WINDOW (widget), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT (data);
|
||||
GtkWidget *current_page;
|
||||
gint page_number;
|
||||
const gchar *text;
|
||||
|
||||
page_number = gtk_assistant_get_current_page (assistant);
|
||||
current_page = gtk_assistant_get_nth_page (assistant, page_number);
|
||||
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
|
||||
if (text && *text)
|
||||
gtk_assistant_set_page_complete (assistant, current_page, TRUE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, current_page, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
create_page1 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *box, *label, *entry;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
|
||||
label = gtk_label_new ("You must fill out this entry to continue:");
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
|
||||
g_signal_connect (G_OBJECT (entry), "changed",
|
||||
G_CALLBACK (on_entry_changed), assistant);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 1");
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
create_page2 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *box, *checkbutton;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_vbox_new (12, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
|
||||
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
||||
"even if you do not check this");
|
||||
gtk_box_pack_start (GTK_BOX (box), checkbutton, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
create_page3 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), label, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
do_assistant (GtkWidget *do_widget)
|
||||
{
|
||||
if (!assistant)
|
||||
{
|
||||
assistant = gtk_assistant_new ();
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, 300);
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (assistant),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
|
||||
create_page1 (assistant);
|
||||
create_page2 (assistant);
|
||||
create_page3 (assistant);
|
||||
|
||||
g_signal_connect (G_OBJECT (assistant), "cancel",
|
||||
G_CALLBACK (on_assistant_close_cancel), &assistant);
|
||||
g_signal_connect (G_OBJECT (assistant), "close",
|
||||
G_CALLBACK (on_assistant_close_cancel), &assistant);
|
||||
g_signal_connect (G_OBJECT (assistant), "apply",
|
||||
G_CALLBACK (on_assistant_apply), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "prepare",
|
||||
G_CALLBACK (on_assistant_prepare), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (assistant))
|
||||
gtk_widget_show (assistant);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (assistant);
|
||||
assistant = NULL;
|
||||
}
|
||||
|
||||
return assistant;
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
/* Builder
|
||||
*
|
||||
* Demonstrates an interface loaded from a XML description.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkBuilder *builder;
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
quit_activate (GtkAction *action)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
about_activate (GtkAction *action)
|
||||
{
|
||||
GtkWidget *about_dlg;
|
||||
|
||||
about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
|
||||
gtk_dialog_run (GTK_DIALOG (about_dlg));
|
||||
gtk_widget_hide (about_dlg);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GError *err = NULL;
|
||||
gchar *filename;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
filename = demo_find_file ("demo.ui", NULL);
|
||||
gtk_builder_add_from_file (builder, filename, &err);
|
||||
g_free (filename);
|
||||
if (err)
|
||||
{
|
||||
g_error ("ERROR: %s\n", err->message);
|
||||
return NULL;
|
||||
}
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
|
||||
return window;
|
||||
}
|
@@ -113,7 +113,7 @@ do_button_box (GtkWidget *do_widget)
|
||||
TRUE, TRUE, 5);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Change Display
|
||||
*
|
||||
*
|
||||
* Demonstrates migrating a window between different displays and
|
||||
* screens. A display is a mouse and keyboard with some number of
|
||||
* associated monitors. A screen is a set of monitors grouped
|
||||
@@ -21,7 +21,7 @@
|
||||
* - Changing the screen for a window
|
||||
*
|
||||
* - Letting the user choose a window by clicking on it
|
||||
*
|
||||
*
|
||||
* - Using GtkListStore and GtkTreeView
|
||||
*
|
||||
* - Using GtkDialog
|
||||
@@ -45,7 +45,7 @@ struct _ChangeDisplayInfo
|
||||
GtkTreeModel *display_model;
|
||||
GtkTreeModel *screen_model;
|
||||
GtkTreeSelection *screen_selection;
|
||||
|
||||
|
||||
GdkDisplay *current_display;
|
||||
GdkScreen *current_screen;
|
||||
};
|
||||
@@ -81,11 +81,7 @@ find_toplevel_at_pointer (GdkDisplay *display)
|
||||
* to the widget that created it.
|
||||
*/
|
||||
if (pointer_window)
|
||||
{
|
||||
gpointer widget_ptr;
|
||||
gdk_window_get_user_data (pointer_window, &widget_ptr);
|
||||
widget = widget_ptr;
|
||||
}
|
||||
gdk_window_get_user_data (pointer_window, (gpointer*) &widget);
|
||||
|
||||
return widget ? gtk_widget_get_toplevel (widget) : NULL;
|
||||
}
|
||||
@@ -111,23 +107,23 @@ query_for_toplevel (GdkScreen *screen,
|
||||
GtkWidget *popup, *label, *frame;
|
||||
GdkCursor *cursor;
|
||||
GtkWidget *toplevel = NULL;
|
||||
|
||||
|
||||
popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_screen (GTK_WINDOW (popup), screen);
|
||||
gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
|
||||
gtk_window_set_position (GTK_WINDOW (popup), GTK_WIN_POS_CENTER);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add (GTK_CONTAINER (popup), frame);
|
||||
|
||||
|
||||
label = gtk_label_new (prompt);
|
||||
gtk_misc_set_padding (GTK_MISC (label), 10, 10);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
|
||||
|
||||
gtk_widget_show_all (popup);
|
||||
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
|
||||
|
||||
|
||||
if (gdk_pointer_grab (popup->window, FALSE,
|
||||
GDK_BUTTON_RELEASE_MASK,
|
||||
NULL,
|
||||
@@ -135,26 +131,26 @@ query_for_toplevel (GdkScreen *screen,
|
||||
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
|
||||
{
|
||||
gboolean clicked = FALSE;
|
||||
|
||||
|
||||
g_signal_connect (popup, "button-release-event",
|
||||
G_CALLBACK (button_release_event_cb), &clicked);
|
||||
|
||||
|
||||
/* Process events until clicked is set by button_release_event_cb.
|
||||
* We pass in may_block=TRUE since we want to wait if there
|
||||
* are no events currently.
|
||||
*/
|
||||
while (!clicked)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
|
||||
toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
|
||||
if (toplevel == popup)
|
||||
toplevel = NULL;
|
||||
}
|
||||
|
||||
|
||||
gdk_cursor_unref (cursor);
|
||||
gtk_widget_destroy (popup);
|
||||
gdk_flush (); /* Really release the grab */
|
||||
|
||||
|
||||
return toplevel;
|
||||
}
|
||||
|
||||
@@ -188,12 +184,12 @@ fill_screens (ChangeDisplayInfo *info)
|
||||
{
|
||||
gint n_screens = gdk_display_get_n_screens (info->current_display);
|
||||
gint i;
|
||||
|
||||
|
||||
for (i = 0; i < n_screens; i++)
|
||||
{
|
||||
GdkScreen *screen = gdk_display_get_screen (info->current_display, i);
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (info->screen_model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (info->screen_model), &iter,
|
||||
SCREEN_COLUMN_NUMBER, i,
|
||||
@@ -234,7 +230,7 @@ open_display_cb (GtkWidget *button,
|
||||
GtkWidget *dialog_label;
|
||||
gchar *new_screen_name = NULL;
|
||||
GdkDisplay *result = NULL;
|
||||
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Open Display",
|
||||
GTK_WINDOW (info->window),
|
||||
GTK_DIALOG_MODAL,
|
||||
@@ -253,13 +249,13 @@ open_display_cb (GtkWidget *button,
|
||||
|
||||
gtk_widget_grab_focus (display_entry);
|
||||
gtk_widget_show_all (GTK_BIN (dialog)->child);
|
||||
|
||||
|
||||
while (!result)
|
||||
{
|
||||
gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
if (response_id != GTK_RESPONSE_OK)
|
||||
break;
|
||||
|
||||
|
||||
new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
|
||||
0, -1);
|
||||
|
||||
@@ -278,7 +274,7 @@ open_display_cb (GtkWidget *button,
|
||||
g_free (new_screen_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
@@ -304,8 +300,6 @@ display_changed_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (info->current_display)
|
||||
g_object_unref (info->current_display);
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
gtk_tree_model_get (model, &iter,
|
||||
DISPLAY_COLUMN_DISPLAY, &info->current_display,
|
||||
@@ -326,8 +320,6 @@ screen_changed_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (info->current_screen)
|
||||
g_object_unref (info->current_screen);
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
gtk_tree_model_get (model, &iter,
|
||||
SCREEN_COLUMN_SCREEN, &info->current_screen,
|
||||
@@ -351,7 +343,7 @@ create_frame (ChangeDisplayInfo *info,
|
||||
GtkTreeSelection *selection;
|
||||
GtkWidget *scrollwin;
|
||||
GtkWidget *hbox;
|
||||
|
||||
|
||||
*frame = gtk_frame_new (title);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
@@ -377,7 +369,7 @@ create_frame (ChangeDisplayInfo *info,
|
||||
|
||||
if (!info->size_group)
|
||||
info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
|
||||
gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
|
||||
}
|
||||
|
||||
@@ -413,7 +405,7 @@ create_display_frame (ChangeDisplayInfo *info)
|
||||
button = left_align_button_new ("_Open...");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
|
||||
gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
button = left_align_button_new ("_Close");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
|
||||
gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
|
||||
@@ -484,7 +476,7 @@ display_closed_cb (GdkDisplay *display,
|
||||
valid = gtk_tree_model_iter_next (info->display_model, &iter))
|
||||
{
|
||||
GdkDisplay *tmp_display;
|
||||
|
||||
|
||||
gtk_tree_model_get (info->display_model, &iter,
|
||||
DISPLAY_COLUMN_DISPLAY, &tmp_display,
|
||||
-1);
|
||||
@@ -506,7 +498,7 @@ add_display (ChangeDisplayInfo *info,
|
||||
{
|
||||
const gchar *name = gdk_display_get_name (display);
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
|
||||
DISPLAY_COLUMN_NAME, name,
|
||||
@@ -514,7 +506,7 @@ add_display (ChangeDisplayInfo *info,
|
||||
-1);
|
||||
|
||||
g_signal_connect (display, "closed",
|
||||
G_CALLBACK (display_closed_cb), info);
|
||||
G_CALLBACK (display_closed_cb), info);
|
||||
}
|
||||
|
||||
/* Called when a new display is opened
|
||||
@@ -543,7 +535,7 @@ initialize_displays (ChangeDisplayInfo *info)
|
||||
|
||||
g_slist_free (tmp_list);
|
||||
|
||||
g_signal_connect (manager, "display-opened",
|
||||
g_signal_connect (manager, "display_opened",
|
||||
G_CALLBACK (display_opened_cb), info);
|
||||
}
|
||||
|
||||
@@ -566,18 +558,10 @@ destroy_info (ChangeDisplayInfo *info)
|
||||
g_signal_handlers_disconnect_by_func (tmp_list->data,
|
||||
display_closed_cb,
|
||||
info);
|
||||
|
||||
|
||||
g_slist_free (tmp_list);
|
||||
|
||||
g_object_unref (info->size_group);
|
||||
g_object_unref (info->display_model);
|
||||
g_object_unref (info->screen_model);
|
||||
|
||||
if (info->current_display)
|
||||
g_object_unref (info->current_display);
|
||||
if (info->current_screen)
|
||||
g_object_unref (info->current_screen);
|
||||
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
@@ -605,7 +589,7 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
info = g_new0 (ChangeDisplayInfo, 1);
|
||||
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
|
||||
GTK_WINDOW (do_widget),
|
||||
GTK_WINDOW (do_widget),
|
||||
GTK_DIALOG_NO_SEPARATOR,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
@@ -620,13 +604,13 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->window)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
frame = create_display_frame (info);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
frame = create_screen_frame (info);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/* Clipboard
|
||||
*
|
||||
* GtkClipboard is used for clipboard handling. This demo shows how to
|
||||
* copy and paste text to and from the clipboard.
|
||||
* copy and paste text to and from the clipboard.
|
||||
*
|
||||
* It also shows how to transfer images via the clipboard or via
|
||||
* It also shows how to transfer images via the clipboard or via
|
||||
* drag-and-drop, and how to make clipboard contents persist after
|
||||
* the application exits. Clipboard persistence requires a clipboard
|
||||
* manager to run.
|
||||
@@ -22,7 +22,7 @@ copy_button_clicked (GtkWidget *button,
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
entry = GTK_WIDGET (user_data);
|
||||
|
||||
|
||||
/* Get the clipboard object */
|
||||
clipboard = gtk_widget_get_clipboard (entry,
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
@@ -39,7 +39,7 @@ paste_received (GtkClipboard *clipboard,
|
||||
GtkWidget *entry;
|
||||
|
||||
entry = GTK_WIDGET (user_data);
|
||||
|
||||
|
||||
/* Set the entry text */
|
||||
if(text)
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
@@ -53,7 +53,7 @@ paste_button_clicked (GtkWidget *button,
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
entry = GTK_WIDGET (user_data);
|
||||
|
||||
|
||||
/* Get the clipboard object */
|
||||
clipboard = gtk_widget_get_clipboard (entry,
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
@@ -80,7 +80,7 @@ get_image_pixbuf (GtkImage *image)
|
||||
return gtk_widget_render_icon (GTK_WIDGET (image),
|
||||
stock_id, size, NULL);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
return NULL;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ drag_begin (GtkWidget *widget,
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
@@ -171,12 +171,12 @@ button_press (GtkWidget *widget,
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
|
||||
|
||||
if (button->button != 3)
|
||||
return FALSE;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
|
||||
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
|
||||
g_signal_connect (item, "activate", G_CALLBACK (copy_image), data);
|
||||
gtk_widget_show (item);
|
||||
@@ -201,22 +201,18 @@ do_clipboard (GtkWidget *do_widget)
|
||||
GtkWidget *entry, *button;
|
||||
GtkWidget *ebox, *image;
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
|
||||
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
@@ -226,7 +222,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
/* Create the first entry */
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
/* Create the button */
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_COPY);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
@@ -243,13 +239,13 @@ do_clipboard (GtkWidget *do_widget)
|
||||
/* Create the second entry */
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
/* Create the button */
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_PASTE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paste_button_clicked), entry);
|
||||
|
||||
|
||||
label = gtk_label_new ("Images can be transferred via the clipboard, too");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
@@ -258,7 +254,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the first image */
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
ebox = gtk_event_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER (ebox), image);
|
||||
@@ -267,24 +263,24 @@ do_clipboard (GtkWidget *do_widget)
|
||||
/* make ebox a drag source */
|
||||
gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
|
||||
gtk_drag_source_add_image_targets (ebox);
|
||||
g_signal_connect (ebox, "drag-begin",
|
||||
g_signal_connect (ebox, "drag_begin",
|
||||
G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (ebox, "drag-data-get",
|
||||
g_signal_connect (ebox, "drag_data_get",
|
||||
G_CALLBACK (drag_data_get), image);
|
||||
|
||||
|
||||
/* accept drops on ebox */
|
||||
gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
|
||||
gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
|
||||
NULL, 0, GDK_ACTION_COPY);
|
||||
gtk_drag_dest_add_image_targets (ebox);
|
||||
g_signal_connect (ebox, "drag-data-received",
|
||||
g_signal_connect (ebox, "drag_data_received",
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
|
||||
/* context menu on ebox */
|
||||
g_signal_connect (ebox, "button-press-event",
|
||||
g_signal_connect (ebox, "button_press_event",
|
||||
G_CALLBACK (button_press), image);
|
||||
|
||||
/* Create the second image */
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_STOP,
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
ebox = gtk_event_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER (ebox), image);
|
||||
@@ -293,28 +289,28 @@ do_clipboard (GtkWidget *do_widget)
|
||||
/* make ebox a drag source */
|
||||
gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
|
||||
gtk_drag_source_add_image_targets (ebox);
|
||||
g_signal_connect (ebox, "drag-begin",
|
||||
g_signal_connect (ebox, "drag_begin",
|
||||
G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (ebox, "drag-data-get",
|
||||
g_signal_connect (ebox, "drag_data_get",
|
||||
G_CALLBACK (drag_data_get), image);
|
||||
|
||||
|
||||
/* accept drops on ebox */
|
||||
gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
|
||||
gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
|
||||
NULL, 0, GDK_ACTION_COPY);
|
||||
gtk_drag_dest_add_image_targets (ebox);
|
||||
g_signal_connect (ebox, "drag-data-received",
|
||||
g_signal_connect (ebox, "drag_data_received",
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
|
||||
/* context menu on ebox */
|
||||
g_signal_connect (ebox, "button-press-event",
|
||||
g_signal_connect (ebox, "button_press_event",
|
||||
G_CALLBACK (button_press), image);
|
||||
|
||||
|
||||
/* tell the clipboard manager to make the data persistent */
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
gtk_clipboard_set_can_store (clipboard, NULL, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
|
@@ -15,9 +15,7 @@ static GtkWidget *frame;
|
||||
/* Expose callback for the drawing area
|
||||
*/
|
||||
static gboolean
|
||||
expose_event_callback (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
if (widget->window)
|
||||
{
|
||||
@@ -125,7 +123,7 @@ do_colorsel (GtkWidget *do_widget)
|
||||
G_CALLBACK (change_color_callback), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -74,7 +74,6 @@ create_stock_icon_store (void)
|
||||
PIXBUF_COL, pixbuf,
|
||||
TEXT_COL, label,
|
||||
-1);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (label);
|
||||
}
|
||||
else
|
||||
@@ -246,87 +245,11 @@ fill_combo_entry (GtkWidget *entry)
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (entry), "Three");
|
||||
}
|
||||
|
||||
|
||||
/* A simple validating entry */
|
||||
|
||||
#define TYPE_MASK_ENTRY (mask_entry_get_type ())
|
||||
#define MASK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MASK_ENTRY, MaskEntry))
|
||||
#define MASK_ENTRY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TYPE_MASK_ENTRY, MaskEntryClass))
|
||||
#define IS_MASK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MASK_ENTRY))
|
||||
#define IS_MASK_ENTRY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TYPE_MASK_ENTRY))
|
||||
#define MASK_ENTRY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TYPE_MASK_ENTRY, MaskEntryClass))
|
||||
|
||||
|
||||
typedef struct _MaskEntry MaskEntry;
|
||||
struct _MaskEntry
|
||||
{
|
||||
GtkEntry entry;
|
||||
gchar *mask;
|
||||
};
|
||||
|
||||
typedef struct _MaskEntryClass MaskEntryClass;
|
||||
struct _MaskEntryClass
|
||||
{
|
||||
GtkEntryClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
static void mask_entry_editable_init (GtkEditableClass *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||
mask_entry_editable_init));
|
||||
|
||||
|
||||
static void
|
||||
mask_entry_set_background (MaskEntry *entry)
|
||||
{
|
||||
static const GdkColor error_color = { 0, 65535, 60000, 60000 };
|
||||
|
||||
if (entry->mask)
|
||||
{
|
||||
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
|
||||
{
|
||||
gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, &error_color);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mask_entry_changed (GtkEditable *editable)
|
||||
{
|
||||
mask_entry_set_background (MASK_ENTRY (editable));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mask_entry_init (MaskEntry *entry)
|
||||
{
|
||||
entry->mask = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mask_entry_class_init (MaskEntryClass *klass)
|
||||
{ }
|
||||
|
||||
|
||||
static void
|
||||
mask_entry_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
iface->changed = mask_entry_changed;
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_combobox (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *vbox, *frame, *box, *combo, *entry;
|
||||
GtkWidget *vbox, *frame, *box, *combo;
|
||||
GtkTreeModel *model;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreePath *path;
|
||||
@@ -419,7 +342,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_tree_path_free (path);
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
|
||||
|
||||
/* A GtkComboBoxEntry with validation.
|
||||
/* A GtkComboBoxEntry
|
||||
*/
|
||||
frame = gtk_frame_new ("Editable");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
@@ -432,15 +355,9 @@ do_combobox (GtkWidget *do_widget)
|
||||
fill_combo_entry (combo);
|
||||
gtk_container_add (GTK_CONTAINER (box), combo);
|
||||
|
||||
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
|
||||
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (combo), GTK_BIN (combo)->child);
|
||||
gtk_container_add (GTK_CONTAINER (combo), entry);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,258 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<interface domain="gtk20">
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
<column type="gchararray"/>
|
||||
<column type="gint"/>
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">John</col>
|
||||
<col id="1" translatable="yes">Doe</col>
|
||||
<col id="2">25</col>
|
||||
<col id="3" translatable="yes">This is the John Doe row</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Mary</col>
|
||||
<col id="1" translatable="yes">Unknown</col>
|
||||
<col id="2">50</col>
|
||||
<col id="3" translatable="yes">This is the Mary Unknown row</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkUIManager" id="uimanager">
|
||||
<child>
|
||||
<object class="GtkActionGroup" id="DefaultActions">
|
||||
<child>
|
||||
<object class="GtkAction" id="Copy">
|
||||
<property name="name">Copy</property>
|
||||
<property name="tooltip" translatable="yes">Copy selected object into the clipboard</property>
|
||||
<property name="stock_id">gtk-copy</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="Cut">
|
||||
<property name="name">Cut</property>
|
||||
<property name="tooltip" translatable="yes">Cut selected object into the clipboard</property>
|
||||
<property name="stock_id">gtk-cut</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="EditMenu">
|
||||
<property name="name">EditMenu</property>
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="FileMenu">
|
||||
<property name="name">FileMenu</property>
|
||||
<property name="label" translatable="yes">_File</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="New">
|
||||
<property name="name">New</property>
|
||||
<property name="tooltip" translatable="yes">Create a new file</property>
|
||||
<property name="stock_id">gtk-new</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="Open">
|
||||
<property name="name">Open</property>
|
||||
<property name="tooltip" translatable="yes">Open a file</property>
|
||||
<property name="stock_id">gtk-open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="Paste">
|
||||
<property name="name">Paste</property>
|
||||
<property name="tooltip" translatable="yes">Paste object from the Clipboard</property>
|
||||
<property name="stock_id">gtk-paste</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="Quit">
|
||||
<property name="name">Quit</property>
|
||||
<property name="tooltip" translatable="yes">Quit the program</property>
|
||||
<property name="stock_id">gtk-quit</property>
|
||||
<signal handler="quit_activate" name="activate"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="Save">
|
||||
<property name="name">Save</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="tooltip" translatable="yes">Save a file</property>
|
||||
<property name="stock_id">gtk-save</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="SaveAs">
|
||||
<property name="name">SaveAs</property>
|
||||
<property name="tooltip" translatable="yes">Save with a different name</property>
|
||||
<property name="stock_id">gtk-save-as</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="HelpMenu">
|
||||
<property name="name">HelpMenu</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAction" id="About">
|
||||
<property name="name">About</property>
|
||||
<property name="stock_id">gtk-about</property>
|
||||
<signal handler="about_activate" name="activate"/>
|
||||
</object>
|
||||
<accelerator key="F1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<ui>
|
||||
<menubar name="menubar1">
|
||||
<menu action="FileMenu" name="FileMenu">
|
||||
<menuitem action="New" name="New"/>
|
||||
<menuitem action="Open" name="Open"/>
|
||||
<menuitem action="Save" name="Save"/>
|
||||
<menuitem action="SaveAs" name="SaveAs"/>
|
||||
<separator/>
|
||||
<menuitem action="Quit" name="Quit"/>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<menuitem action="Copy" name="Copy"/>
|
||||
<menuitem action="Cut" name="Cut"/>
|
||||
<menuitem action="Paste" name="Paste"/>
|
||||
</menu>
|
||||
<menu action="HelpMenu" name="HelpMenu">
|
||||
<menuitem action="About" name="About"/>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="toolbar1">
|
||||
<toolitem action="New" name="New"/>
|
||||
<toolitem action="Open" name="Open"/>
|
||||
<toolitem action="Save" name="Save"/>
|
||||
<separator/>
|
||||
<toolitem action="Copy" name="Copy"/>
|
||||
<toolitem action="Cut" name="Cut"/>
|
||||
<toolitem action="Paste" name="Paste"/>
|
||||
</toolbar>
|
||||
</ui>
|
||||
</object>
|
||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||
<property name="program-name" translatable="yes">GtkBuilder demo</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_width">440</property>
|
||||
<property name="title">GtkBuilder demo</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object constructor="uimanager" class="GtkMenuBar" id="menubar1">
|
||||
<property name="visible">True</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-menubar">
|
||||
<property name="AtkObject::accessible-name">The menubar</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object constructor="uimanager" class="GtkToolbar" id="toolbar1">
|
||||
<property name="visible">True</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-toolbar">
|
||||
<property name="AtkObject::accessible-name">The toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="tooltip-column">3</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-treeview">
|
||||
<property name="AtkObject::accessible-name">Name list</property>
|
||||
<property name="AtkObject::accessible-description">
|
||||
A list of person with name, surname and age columns
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column1">
|
||||
<property name="title">Name</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column2">
|
||||
<property name="title">Surname</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer2"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column3">
|
||||
<property name="title">Age</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer3"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<action action_name="move-cursor" description="Move the cursor to select another person."/>
|
||||
</accessibility>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="statusbar1">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@@ -167,7 +167,7 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry2);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -21,25 +21,25 @@ static GdkPixmap *pixmap = NULL;
|
||||
|
||||
/* Create a new pixmap of the appropriate size to store our scribbles */
|
||||
static gboolean
|
||||
scribble_configure_event (GtkWidget *widget,
|
||||
GdkEventConfigure *event,
|
||||
gpointer data)
|
||||
scribble_configure_event (GtkWidget *widget,
|
||||
GdkEventConfigure *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (pixmap)
|
||||
g_object_unref (pixmap);
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height,
|
||||
-1);
|
||||
widget->allocation.width,
|
||||
widget->allocation.height,
|
||||
-1);
|
||||
|
||||
/* Initialize the pixmap to white */
|
||||
gdk_draw_rectangle (pixmap,
|
||||
widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
/* We've handled the configure event, no need for further processing. */
|
||||
return TRUE;
|
||||
@@ -48,30 +48,30 @@ scribble_configure_event (GtkWidget *widget,
|
||||
/* Redraw the screen from the pixmap */
|
||||
static gboolean
|
||||
scribble_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
/* We use the "foreground GC" for the widget since it already exists,
|
||||
* but honestly any GC would work. The only thing to worry about
|
||||
* is whether the GC has an inappropriate clip region set.
|
||||
*/
|
||||
|
||||
|
||||
gdk_draw_drawable (widget->window,
|
||||
widget->style->fg_gc[gtk_widget_get_state (widget)],
|
||||
pixmap,
|
||||
/* Only copy the area that was exposed. */
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||
pixmap,
|
||||
/* Only copy the area that was exposed. */
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Draw a rectangle on the screen */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GdkRectangle update_rect;
|
||||
|
||||
@@ -82,25 +82,25 @@ draw_brush (GtkWidget *widget,
|
||||
|
||||
/* Paint to the pixmap, where we store our state */
|
||||
gdk_draw_rectangle (pixmap,
|
||||
widget->style->black_gc,
|
||||
TRUE,
|
||||
update_rect.x, update_rect.y,
|
||||
update_rect.width, update_rect.height);
|
||||
widget->style->black_gc,
|
||||
TRUE,
|
||||
update_rect.x, update_rect.y,
|
||||
update_rect.width, update_rect.height);
|
||||
|
||||
/* Now invalidate the affected region of the drawing area. */
|
||||
gdk_window_invalidate_rect (widget->window,
|
||||
&update_rect,
|
||||
FALSE);
|
||||
&update_rect,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scribble_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
scribble_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (pixmap == NULL)
|
||||
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
|
||||
|
||||
|
||||
if (event->button == 1)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
|
||||
@@ -109,9 +109,9 @@ scribble_button_press_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scribble_motion_notify_event (GtkWidget *widget,
|
||||
GdkEventMotion *event,
|
||||
gpointer data)
|
||||
scribble_motion_notify_event (GtkWidget *widget,
|
||||
GdkEventMotion *event,
|
||||
gpointer data)
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
@@ -129,9 +129,9 @@ scribble_motion_notify_event (GtkWidget *widget,
|
||||
* we avoid getting a huge number of events faster than we
|
||||
* can cope.
|
||||
*/
|
||||
|
||||
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
|
||||
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
draw_brush (widget, x, y);
|
||||
|
||||
@@ -141,17 +141,17 @@ scribble_motion_notify_event (GtkWidget *widget,
|
||||
|
||||
|
||||
static gboolean
|
||||
checkerboard_expose (GtkWidget *da,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
checkerboard_expose (GtkWidget *da,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
gint i, j, xcount, ycount;
|
||||
GdkGC *gc1, *gc2;
|
||||
GdkColor color;
|
||||
|
||||
|
||||
#define CHECK_SIZE 10
|
||||
#define SPACING 2
|
||||
|
||||
|
||||
/* At the start of an expose handler, a clip region of event->area
|
||||
* is set on the window, and event->area has been cleared to the
|
||||
* widget's background color. The docs for
|
||||
@@ -174,7 +174,7 @@ checkerboard_expose (GtkWidget *da,
|
||||
color.green = 65535;
|
||||
color.blue = 65535;
|
||||
gdk_gc_set_rgb_fg_color (gc2, &color);
|
||||
|
||||
|
||||
xcount = 0;
|
||||
i = SPACING;
|
||||
while (i < da->allocation.width)
|
||||
@@ -182,52 +182,42 @@ checkerboard_expose (GtkWidget *da,
|
||||
j = SPACING;
|
||||
ycount = xcount % 2; /* start with even/odd depending on row */
|
||||
while (j < da->allocation.height)
|
||||
{
|
||||
GdkGC *gc;
|
||||
{
|
||||
GdkGC *gc;
|
||||
|
||||
if (ycount % 2)
|
||||
gc = gc1;
|
||||
else
|
||||
gc = gc2;
|
||||
|
||||
if (ycount % 2)
|
||||
gc = gc1;
|
||||
else
|
||||
gc = gc2;
|
||||
/* If we're outside event->area, this will do nothing.
|
||||
* It might be mildly more efficient if we handled
|
||||
* the clipping ourselves, but again we're feeling lazy.
|
||||
*/
|
||||
gdk_draw_rectangle (da->window,
|
||||
gc,
|
||||
TRUE,
|
||||
i, j,
|
||||
CHECK_SIZE,
|
||||
CHECK_SIZE);
|
||||
|
||||
/* If we're outside event->area, this will do nothing.
|
||||
* It might be mildly more efficient if we handled
|
||||
* the clipping ourselves, but again we're feeling lazy.
|
||||
*/
|
||||
gdk_draw_rectangle (da->window,
|
||||
gc,
|
||||
TRUE,
|
||||
i, j,
|
||||
CHECK_SIZE,
|
||||
CHECK_SIZE);
|
||||
|
||||
j += CHECK_SIZE + SPACING;
|
||||
++ycount;
|
||||
}
|
||||
j += CHECK_SIZE + SPACING;
|
||||
++ycount;
|
||||
}
|
||||
|
||||
i += CHECK_SIZE + SPACING;
|
||||
++xcount;
|
||||
}
|
||||
|
||||
|
||||
g_object_unref (gc1);
|
||||
g_object_unref (gc2);
|
||||
|
||||
|
||||
/* return TRUE because we've handled this event, so no
|
||||
* further processing is required.
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
close_window (void)
|
||||
{
|
||||
window = NULL;
|
||||
|
||||
if (pixmap)
|
||||
g_object_unref (pixmap);
|
||||
pixmap = NULL;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_drawingarea (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -235,15 +225,15 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *da;
|
||||
GtkWidget *label;
|
||||
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
@@ -254,38 +244,38 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
/*
|
||||
* Create the checkerboard area
|
||||
*/
|
||||
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Checkerboard pattern</u>");
|
||||
"<u>Checkerboard pattern</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (checkerboard_expose), NULL);
|
||||
g_signal_connect (da, "expose_event",
|
||||
G_CALLBACK (checkerboard_expose), NULL);
|
||||
|
||||
/*
|
||||
* Create the scribble area
|
||||
*/
|
||||
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Scribble area</u>");
|
||||
"<u>Scribble area</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
@@ -293,35 +283,40 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (scribble_expose_event), NULL);
|
||||
g_signal_connect (da,"configure-event",
|
||||
G_CALLBACK (scribble_configure_event), NULL);
|
||||
|
||||
|
||||
g_signal_connect (da, "expose_event",
|
||||
G_CALLBACK (scribble_expose_event), NULL);
|
||||
g_signal_connect (da,"configure_event",
|
||||
G_CALLBACK (scribble_configure_event), NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
g_signal_connect (da, "motion-notify-event",
|
||||
G_CALLBACK (scribble_motion_notify_event), NULL);
|
||||
g_signal_connect (da, "button-press-event",
|
||||
G_CALLBACK (scribble_button_press_event), NULL);
|
||||
|
||||
g_signal_connect (da, "motion_notify_event",
|
||||
G_CALLBACK (scribble_motion_notify_event), NULL);
|
||||
g_signal_connect (da, "button_press_event",
|
||||
G_CALLBACK (scribble_button_press_event), NULL);
|
||||
|
||||
|
||||
/* Ask to receive events the drawing area doesn't normally
|
||||
* subscribe to
|
||||
*/
|
||||
gtk_widget_set_events (da, gtk_widget_get_events (da)
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -121,10 +121,7 @@ create_numbers_model (void)
|
||||
/* add numbers */
|
||||
for (i = 0; i < N_NUMBERS; i++)
|
||||
{
|
||||
char str[2];
|
||||
|
||||
str[0] = '0' + i;
|
||||
str[1] = '\0';
|
||||
char str[2] = { '0' + i, '\0' };
|
||||
|
||||
gtk_list_store_append (model, &iter);
|
||||
|
||||
@@ -381,7 +378,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/* Entry/Entry Buffer
|
||||
*
|
||||
* GtkEntryBuffer provides the text content in a GtkEntry.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_entry_buffer (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
GtkEntryBuffer *buffer;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
GTK_STOCK_CLOSE,
|
||||
GTK_RESPONSE_NONE,
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Entries share a buffer. Typing in one is reflected in the other.");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
/* Create a buffer */
|
||||
buffer = gtk_entry_buffer_new (NULL, 0);
|
||||
|
||||
/* Create our first entry */
|
||||
entry = gtk_entry_new_with_buffer (buffer);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the second entry */
|
||||
entry = gtk_entry_new_with_buffer (buffer);
|
||||
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
|
||||
|
||||
g_object_unref (buffer);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* Entry/Entry Completion
|
||||
/* Entry Completion
|
||||
*
|
||||
* GtkEntryCompletion provides a mechanism for adding support for
|
||||
* completion in GtkEntry.
|
||||
@@ -86,7 +86,7 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
gtk_entry_completion_set_text_column (completion, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
@@ -47,7 +47,7 @@ do_expander (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (expander), label);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
static void
|
||||
insert_link (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
gchar *text,
|
||||
gint page)
|
||||
GtkTextIter *iter,
|
||||
gchar *text,
|
||||
gint page)
|
||||
{
|
||||
GtkTextTag *tag;
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"foreground", "blue",
|
||||
"underline", PANGO_UNDERLINE_SINGLE,
|
||||
NULL);
|
||||
"foreground", "blue",
|
||||
"underline", PANGO_UNDERLINE_SINGLE,
|
||||
NULL);
|
||||
g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));
|
||||
gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ insert_link (GtkTextBuffer *buffer,
|
||||
*/
|
||||
static void
|
||||
show_page (GtkTextBuffer *buffer,
|
||||
gint page)
|
||||
gint page)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
|
||||
@@ -52,12 +52,12 @@ show_page (GtkTextBuffer *buffer,
|
||||
else if (page == 2)
|
||||
{
|
||||
gtk_text_buffer_insert (buffer, &iter,
|
||||
"A tag is an attribute that can be applied to some range of text. "
|
||||
"For example, a tag might be called \"bold\" and make the text inside "
|
||||
"the tag bold. However, the tag concept is more general than that; "
|
||||
"tags don't have to affect appearance. They can instead affect the "
|
||||
"behavior of mouse and key presses, \"lock\" a range of text so the "
|
||||
"user can't edit it, or countless other things.\n", -1);
|
||||
"A tag is an attribute that can be applied to some range of text. "
|
||||
"For example, a tag might be called \"bold\" and make the text inside "
|
||||
"the tag bold. However, the tag concept is more general than that; "
|
||||
"tags don't have to affect appearance. They can instead affect the "
|
||||
"behavior of mouse and key presses, \"lock\" a range of text so the "
|
||||
"user can't edit it, or countless other things.\n", -1);
|
||||
insert_link (buffer, &iter, "Go back", 1);
|
||||
}
|
||||
else if (page == 3)
|
||||
@@ -65,12 +65,12 @@ show_page (GtkTextBuffer *buffer,
|
||||
GtkTextTag *tag;
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext:\n", -1, tag, NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter,
|
||||
"machine-readable text that is not sequential but is organized "
|
||||
"so that related items of information are connected.\n", -1);
|
||||
"machine-readable text that is not sequential but is organized "
|
||||
"so that related items of information are connected.\n", -1);
|
||||
insert_link (buffer, &iter, "Go back", 1);
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ show_page (GtkTextBuffer *buffer,
|
||||
*/
|
||||
static void
|
||||
follow_if_link (GtkWidget *text_view,
|
||||
GtkTextIter *iter)
|
||||
GtkTextIter *iter)
|
||||
{
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
|
||||
@@ -93,8 +93,8 @@ follow_if_link (GtkWidget *text_view,
|
||||
|
||||
if (page != 0)
|
||||
{
|
||||
show_page (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), page);
|
||||
break;
|
||||
show_page (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), page);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ follow_if_link (GtkWidget *text_view,
|
||||
*/
|
||||
static gboolean
|
||||
key_press_event (GtkWidget *text_view,
|
||||
GdkEventKey *event)
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
@@ -132,7 +132,7 @@ key_press_event (GtkWidget *text_view,
|
||||
*/
|
||||
static gboolean
|
||||
event_after (GtkWidget *text_view,
|
||||
GdkEvent *ev)
|
||||
GdkEvent *ev)
|
||||
{
|
||||
GtkTextIter start, end, iter;
|
||||
GtkTextBuffer *buffer;
|
||||
@@ -165,9 +165,9 @@ event_after (GtkWidget *text_view,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean hovering_over_link = FALSE;
|
||||
static GdkCursor *hand_cursor = NULL;
|
||||
static GdkCursor *regular_cursor = NULL;
|
||||
gboolean hovering_over_link = FALSE;
|
||||
GdkCursor *hand_cursor = NULL;
|
||||
GdkCursor *regular_cursor = NULL;
|
||||
|
||||
/* Looks at all tags covering the position (x, y) in the text view,
|
||||
* and if one of them is a link, change the cursor to the "hands" cursor
|
||||
@@ -179,9 +179,12 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
gint y)
|
||||
{
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
gboolean hovering = FALSE;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (text_view);
|
||||
|
||||
gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
|
||||
|
||||
tags = gtk_text_iter_get_tags (&iter);
|
||||
@@ -215,7 +218,7 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
*/
|
||||
static gboolean
|
||||
motion_notify_event (GtkWidget *text_view,
|
||||
GdkEventMotion *event)
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
gint x, y;
|
||||
|
||||
@@ -234,7 +237,7 @@ motion_notify_event (GtkWidget *text_view,
|
||||
*/
|
||||
static gboolean
|
||||
visibility_notify_event (GtkWidget *text_view,
|
||||
GdkEventVisibility *event)
|
||||
GdkEventVisibility *event)
|
||||
{
|
||||
gint wx, wy, bx, by;
|
||||
|
||||
@@ -265,12 +268,12 @@ do_hypertext (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
450, 450);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
@@ -278,20 +281,20 @@ do_hypertext (GtkWidget *do_widget)
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
g_signal_connect (view, "key-press-event",
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
g_signal_connect (view, "event-after",
|
||||
G_CALLBACK (event_after), NULL);
|
||||
G_CALLBACK (event_after), NULL);
|
||||
g_signal_connect (view, "motion-notify-event",
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
g_signal_connect (view, "visibility-notify-event",
|
||||
G_CALLBACK (visibility_notify_event), NULL);
|
||||
G_CALLBACK (visibility_notify_event), NULL);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
@@ -300,7 +303,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_widget_show_all (sw);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* Icon View/Icon View Basics
|
||||
*
|
||||
* The GtkIconView widget is used to display and manipulate icons.
|
||||
* It uses a GtkTreeModel for data storage, so the list store
|
||||
* The GtkIconView widget is used to display and manipulate icons.
|
||||
* It uses a GtkTreeModel for data storage, so the list store
|
||||
* example might be helpful.
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ load_pixbufs (GError **error)
|
||||
if (file_pixbuf)
|
||||
return TRUE; /* already loaded earlier */
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -47,10 +47,10 @@ load_pixbufs (GError **error)
|
||||
|
||||
file_pixbuf = gdk_pixbuf_new_from_file (filename, error);
|
||||
g_free (filename);
|
||||
|
||||
|
||||
if (!file_pixbuf)
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
|
||||
|
||||
filename = demo_find_file (FOLDER_NAME, error);
|
||||
if (!filename)
|
||||
return FALSE; /* note that "error" was filled in and returned */
|
||||
@@ -67,7 +67,7 @@ fill_store (GtkListStore *store)
|
||||
GDir *dir;
|
||||
const gchar *name;
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
||||
/* First clear the store */
|
||||
gtk_list_store_clear (store);
|
||||
|
||||
@@ -82,14 +82,14 @@ fill_store (GtkListStore *store)
|
||||
{
|
||||
gchar *path, *display_name;
|
||||
gboolean is_dir;
|
||||
|
||||
|
||||
/* We ignore hidden files that start with a '.' */
|
||||
if (name[0] != '.')
|
||||
{
|
||||
path = g_build_filename (parent, name, NULL);
|
||||
|
||||
is_dir = g_file_test (path, G_FILE_TEST_IS_DIR);
|
||||
|
||||
|
||||
display_name = g_filename_to_utf8 (name, -1, NULL, NULL, NULL);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
@@ -103,7 +103,7 @@ fill_store (GtkListStore *store)
|
||||
g_free (display_name);
|
||||
}
|
||||
|
||||
name = g_dir_read_name (dir);
|
||||
name = g_dir_read_name (dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ sort_func (GtkTreeModel *model,
|
||||
* folders before files.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
gtk_tree_model_get (model, a,
|
||||
COL_IS_DIRECTORY, &is_dir_a,
|
||||
COL_DISPLAY_NAME, &name_a,
|
||||
@@ -153,12 +153,12 @@ create_store (void)
|
||||
GtkListStore *store;
|
||||
|
||||
store = gtk_list_store_new (NUM_COLS,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
GDK_TYPE_PIXBUF,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
/* Set sort column and function */
|
||||
/* Set sort column and function */
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
|
||||
sort_func,
|
||||
NULL, NULL);
|
||||
@@ -178,7 +178,7 @@ item_activated (GtkIconView *icon_view,
|
||||
gchar *path;
|
||||
GtkTreeIter iter;
|
||||
gboolean is_dir;
|
||||
|
||||
|
||||
store = GTK_LIST_STORE (user_data);
|
||||
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (store),
|
||||
@@ -193,7 +193,7 @@ item_activated (GtkIconView *icon_view,
|
||||
g_free (path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Replace parent with path and re-fill the model*/
|
||||
g_free (parent);
|
||||
parent = path;
|
||||
@@ -215,7 +215,7 @@ up_clicked (GtkToolItem *item,
|
||||
|
||||
dir_name = g_path_get_dirname (parent);
|
||||
g_free (parent);
|
||||
|
||||
|
||||
parent = dir_name;
|
||||
|
||||
fill_store (store);
|
||||
@@ -243,34 +243,22 @@ home_clicked (GtkToolItem *item,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static void close_window(void)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
|
||||
g_object_unref (file_pixbuf);
|
||||
file_pixbuf = NULL;
|
||||
|
||||
g_object_unref (folder_pixbuf);
|
||||
folder_pixbuf = NULL;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_iconview (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GError *error;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
error = NULL;
|
||||
if (!load_pixbufs (&error))
|
||||
@@ -299,13 +287,13 @@ do_iconview (GtkWidget *do_widget)
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *tool_bar;
|
||||
GtkToolItem *home_button;
|
||||
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
tool_bar = gtk_toolbar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), tool_bar, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
up_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);
|
||||
gtk_tool_item_set_is_important (up_button, TRUE);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
|
||||
@@ -314,17 +302,17 @@ do_iconview (GtkWidget *do_widget)
|
||||
home_button = gtk_tool_button_new_from_stock (GTK_STOCK_HOME);
|
||||
gtk_tool_item_set_is_important (home_button, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), home_button, -1);
|
||||
|
||||
|
||||
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
/* Create the store and fill it with the contents of '/' */
|
||||
parent = g_strdup ("/");
|
||||
store = create_store ();
|
||||
@@ -334,7 +322,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
|
||||
GTK_SELECTION_MULTIPLE);
|
||||
g_object_unref (store);
|
||||
|
||||
|
||||
/* Connect to the "clicked" signal of the "Up" tool button */
|
||||
g_signal_connect (up_button, "clicked",
|
||||
G_CALLBACK (up_clicked), store);
|
||||
@@ -342,23 +330,23 @@ do_iconview (GtkWidget *do_widget)
|
||||
/* Connect to the "clicked" signal of the "Home" tool button */
|
||||
g_signal_connect (home_button, "clicked",
|
||||
G_CALLBACK (home_clicked), store);
|
||||
|
||||
|
||||
/* We now set which model columns that correspond to the text
|
||||
* and pixbuf of each item
|
||||
*/
|
||||
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_DISPLAY_NAME);
|
||||
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);
|
||||
|
||||
/* Connect to the "item-activated" signal */
|
||||
g_signal_connect (icon_view, "item-activated",
|
||||
/* Connect to the "item_activated" signal */
|
||||
g_signal_connect (icon_view, "item_activated",
|
||||
G_CALLBACK (item_activated), store);
|
||||
gtk_container_add (GTK_CONTAINER (sw), icon_view);
|
||||
|
||||
gtk_widget_grab_focus (icon_view);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
|
@@ -64,8 +64,6 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
(color.green >> 8) << 16 |
|
||||
(color.blue >> 8) << 8;
|
||||
|
||||
g_free (text);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 24, 24);
|
||||
gdk_pixbuf_fill (pixbuf, pixel);
|
||||
|
||||
@@ -146,7 +144,7 @@ do_iconview_edit (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (window), icon_view);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
|
@@ -31,14 +31,14 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
GtkWidget *image;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
|
||||
/* Avoid displaying random memory contents, since the pixbuf
|
||||
* isn't filled in yet.
|
||||
*/
|
||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
|
||||
/* We know the pixbuf inside the GtkImage has changed, but the image
|
||||
@@ -61,7 +61,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
* the pixbuf on the display, then we could queue a draw for only
|
||||
* the updated area of the image.
|
||||
*/
|
||||
|
||||
|
||||
gtk_widget_queue_draw (image);
|
||||
}
|
||||
|
||||
@@ -71,24 +71,24 @@ progressive_timeout (gpointer data)
|
||||
GtkWidget *image;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
|
||||
|
||||
/* This shows off fully-paranoid error handling, so looks scary.
|
||||
* You could factor out the error handling code into a nice separate
|
||||
* function to make things nicer.
|
||||
*/
|
||||
|
||||
|
||||
if (image_stream)
|
||||
{
|
||||
size_t bytes_read;
|
||||
guchar buf[256];
|
||||
GError *error = NULL;
|
||||
|
||||
|
||||
bytes_read = fread (buf, 1, 256, image_stream);
|
||||
|
||||
if (ferror (image_stream))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
@@ -103,7 +103,7 @@ progressive_timeout (gpointer data)
|
||||
image_stream = NULL;
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
|
||||
load_timeout = 0;
|
||||
|
||||
return FALSE; /* uninstall the timeout */
|
||||
@@ -114,7 +114,7 @@ progressive_timeout (gpointer data)
|
||||
&error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
@@ -123,13 +123,13 @@ progressive_timeout (gpointer data)
|
||||
error->message);
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
fclose (image_stream);
|
||||
image_stream = NULL;
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
load_timeout = 0;
|
||||
@@ -151,29 +151,29 @@ progressive_timeout (gpointer data)
|
||||
&error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Failed to load image: %s",
|
||||
error->message);
|
||||
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_object_unref (pixbuf_loader);
|
||||
pixbuf_loader = NULL;
|
||||
|
||||
|
||||
load_timeout = 0;
|
||||
|
||||
|
||||
return FALSE; /* uninstall the timeout */
|
||||
}
|
||||
|
||||
|
||||
g_object_unref (pixbuf_loader);
|
||||
pixbuf_loader = NULL;
|
||||
}
|
||||
@@ -182,9 +182,9 @@ progressive_timeout (gpointer data)
|
||||
{
|
||||
gchar *filename;
|
||||
gchar *error_message = NULL;
|
||||
GError *error = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -207,7 +207,7 @@ progressive_timeout (gpointer data)
|
||||
if (image_stream == NULL)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
@@ -217,7 +217,7 @@ progressive_timeout (gpointer data)
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
load_timeout = 0;
|
||||
@@ -231,13 +231,13 @@ progressive_timeout (gpointer data)
|
||||
g_object_unref (pixbuf_loader);
|
||||
pixbuf_loader = NULL;
|
||||
}
|
||||
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-prepared",
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area_prepared",
|
||||
G_CALLBACK (progressive_prepared_callback), image);
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-updated",
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area_updated",
|
||||
G_CALLBACK (progressive_updated_callback), image);
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ start_progressive_loading (GtkWidget *image)
|
||||
* The timeout simply simulates a slow data source by inserting
|
||||
* pauses in the reading process.
|
||||
*/
|
||||
load_timeout = gdk_threads_add_timeout (150,
|
||||
load_timeout = g_timeout_add (150,
|
||||
progressive_timeout,
|
||||
image);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ cleanup_callback (GtkObject *object,
|
||||
g_source_remove (load_timeout);
|
||||
load_timeout = 0;
|
||||
}
|
||||
|
||||
|
||||
if (pixbuf_loader)
|
||||
{
|
||||
gdk_pixbuf_loader_close (pixbuf_loader, NULL);
|
||||
@@ -289,7 +289,7 @@ toggle_sensitivity_callback (GtkWidget *togglebutton,
|
||||
GtkContainer *container = user_data;
|
||||
GList *list;
|
||||
GList *tmp;
|
||||
|
||||
|
||||
list = gtk_container_get_children (container);
|
||||
|
||||
tmp = list;
|
||||
@@ -299,13 +299,13 @@ toggle_sensitivity_callback (GtkWidget *togglebutton,
|
||||
if (GTK_WIDGET (tmp->data) != togglebutton)
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (tmp->data),
|
||||
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)));
|
||||
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_images (GtkWidget *do_widget)
|
||||
@@ -319,7 +319,7 @@ do_images (GtkWidget *do_widget)
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
char *filename;
|
||||
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
@@ -342,7 +342,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Image loaded from a file</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
/* The alignment keeps the frame from growing when users resize
|
||||
@@ -352,7 +352,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (align), frame);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -373,7 +373,7 @@ do_images (GtkWidget *do_widget)
|
||||
* be displayed instead.
|
||||
*/
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
@@ -381,13 +381,13 @@ do_images (GtkWidget *do_widget)
|
||||
"Unable to open image file 'gtk-logo-rgb.gif': %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
@@ -399,7 +399,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Animation loaded from a file</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
/* The alignment keeps the frame from growing when users resize
|
||||
@@ -414,16 +414,16 @@ do_images (GtkWidget *do_widget)
|
||||
g_free (filename);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
|
||||
|
||||
|
||||
/* Progressive */
|
||||
|
||||
|
||||
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Progressive image loading</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
/* The alignment keeps the frame from growing when users resize
|
||||
@@ -450,7 +450,7 @@ do_images (GtkWidget *do_widget)
|
||||
vbox);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,104 +0,0 @@
|
||||
/* Info bar
|
||||
*
|
||||
* Info bar widgets are used to report important messages to the user.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
on_bar_response (GtkInfoBar *info_bar,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"You clicked a button on an info bar");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
"Your response has id %d", response_id);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_infobar (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *bar;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *label;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Info Bars");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
bar = gtk_info_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
|
||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
|
||||
|
||||
bar = gtk_info_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
|
||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
|
||||
|
||||
bar = gtk_info_bar_new_with_buttons (GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
|
||||
g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
|
||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
|
||||
|
||||
bar = gtk_info_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
|
||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
|
||||
|
||||
bar = gtk_info_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
|
||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new ("Info bars");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 8);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
|
||||
/* Standard message dialog */
|
||||
label = gtk_label_new ("An example of different info bars");
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
/* Links
|
||||
*
|
||||
* GtkLabel can show hyperlinks. The default action is to call
|
||||
* gtk_show_uri() on their URI, but it is possible to override
|
||||
* this with a custom handler.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkWidget *label,
|
||||
const gchar *uri,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_strcmp0 (uri, "keynav") == 0)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *parent;
|
||||
|
||||
parent = gtk_widget_get_toplevel (label);
|
||||
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"The term <i>keynav</i> is a shorthand for "
|
||||
"keyboard navigation and refers to the process of using "
|
||||
"a program (exclusively) via keyboard input.");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_links (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Links");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
|
||||
"title=\"plain text\">text</a> may be marked up\n"
|
||||
"as hyperlinks, which can be clicked\n"
|
||||
"or activated via <a href=\"keynav\">keynav</a>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), label);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -10,8 +10,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkTreeModel *model = NULL;
|
||||
static guint timeout = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -28,8 +26,6 @@ enum
|
||||
COLUMN_NUMBER,
|
||||
COLUMN_SEVERITY,
|
||||
COLUMN_DESCRIPTION,
|
||||
COLUMN_PULSE,
|
||||
COLUMN_ACTIVE,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
@@ -51,33 +47,6 @@ static Bug data[] =
|
||||
{ FALSE, 1, "Normal", "First bug :=)" },
|
||||
};
|
||||
|
||||
static gboolean
|
||||
spinner_timeout (gpointer data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
guint pulse;
|
||||
|
||||
if (model == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_tree_model_get_iter_first (model, &iter);
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_PULSE, &pulse,
|
||||
-1);
|
||||
if (pulse == G_MAXUINT)
|
||||
pulse = 0;
|
||||
else
|
||||
pulse++;
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model),
|
||||
&iter,
|
||||
COLUMN_PULSE, pulse,
|
||||
COLUMN_ACTIVE, TRUE,
|
||||
-1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkTreeModel *
|
||||
create_model (void)
|
||||
{
|
||||
@@ -87,25 +56,21 @@ create_model (void)
|
||||
|
||||
/* create list store */
|
||||
store = gtk_list_store_new (NUM_COLUMNS,
|
||||
G_TYPE_BOOLEAN,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_BOOLEAN);
|
||||
G_TYPE_BOOLEAN,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
/* add data to the list store */
|
||||
for (i = 0; i < G_N_ELEMENTS (data); i++)
|
||||
{
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COLUMN_FIXED, data[i].fixed,
|
||||
COLUMN_NUMBER, data[i].number,
|
||||
COLUMN_SEVERITY, data[i].severity,
|
||||
COLUMN_DESCRIPTION, data[i].description,
|
||||
COLUMN_PULSE, 0,
|
||||
COLUMN_ACTIVE, FALSE,
|
||||
-1);
|
||||
COLUMN_FIXED, data[i].fixed,
|
||||
COLUMN_NUMBER, data[i].number,
|
||||
COLUMN_SEVERITY, data[i].severity,
|
||||
COLUMN_DESCRIPTION, data[i].description,
|
||||
-1);
|
||||
}
|
||||
|
||||
return GTK_TREE_MODEL (store);
|
||||
@@ -113,8 +78,8 @@ create_model (void)
|
||||
|
||||
static void
|
||||
fixed_toggled (GtkCellRendererToggle *cell,
|
||||
gchar *path_str,
|
||||
gpointer data)
|
||||
gchar *path_str,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = (GtkTreeModel *)data;
|
||||
GtkTreeIter iter;
|
||||
@@ -145,75 +110,48 @@ add_columns (GtkTreeView *treeview)
|
||||
/* column for fixed toggles */
|
||||
renderer = gtk_cell_renderer_toggle_new ();
|
||||
g_signal_connect (renderer, "toggled",
|
||||
G_CALLBACK (fixed_toggled), model);
|
||||
G_CALLBACK (fixed_toggled), model);
|
||||
|
||||
column = gtk_tree_view_column_new_with_attributes ("Fixed?",
|
||||
renderer,
|
||||
"active", COLUMN_FIXED,
|
||||
NULL);
|
||||
renderer,
|
||||
"active", COLUMN_FIXED,
|
||||
NULL);
|
||||
|
||||
/* set this column to a fixed sizing (of 50 pixels) */
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
|
||||
/* column for bug numbers */
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Bug number",
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_NUMBER,
|
||||
NULL);
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_NUMBER,
|
||||
NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
|
||||
/* column for severities */
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Severity",
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_SEVERITY,
|
||||
NULL);
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_SEVERITY,
|
||||
NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, COLUMN_SEVERITY);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
|
||||
/* column for description */
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Description",
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_DESCRIPTION,
|
||||
NULL);
|
||||
renderer,
|
||||
"text",
|
||||
COLUMN_DESCRIPTION,
|
||||
NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, COLUMN_DESCRIPTION);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
|
||||
/* column for spinner */
|
||||
renderer = gtk_cell_renderer_spinner_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Spinning",
|
||||
renderer,
|
||||
"pulse",
|
||||
COLUMN_PULSE,
|
||||
"active",
|
||||
COLUMN_ACTIVE,
|
||||
NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, COLUMN_PULSE);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_closed (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
model = NULL;
|
||||
window = NULL;
|
||||
if (timeout != 0)
|
||||
{
|
||||
g_source_remove (timeout);
|
||||
timeout = 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -224,16 +162,17 @@ do_list_store (GtkWidget *do_widget)
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *sw;
|
||||
GtkTreeModel *model;
|
||||
GtkWidget *treeview;
|
||||
|
||||
/* create window, etc */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
@@ -244,10 +183,10 @@ do_list_store (GtkWidget *do_widget)
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
|
||||
|
||||
/* create tree model */
|
||||
@@ -257,7 +196,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
treeview = gtk_tree_view_new_with_model (model);
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
|
||||
gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
|
||||
COLUMN_DESCRIPTION);
|
||||
COLUMN_DESCRIPTION);
|
||||
|
||||
g_object_unref (model);
|
||||
|
||||
@@ -268,27 +207,14 @@ do_list_store (GtkWidget *do_widget)
|
||||
|
||||
/* finish & show */
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 280, 250);
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (window_closed), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
if (timeout == 0) {
|
||||
/* FIXME this should use the animation-duration instead */
|
||||
timeout = g_timeout_add (80, spinner_timeout, NULL);
|
||||
}
|
||||
}
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
if (timeout != 0)
|
||||
{
|
||||
g_source_remove (timeout);
|
||||
timeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return window;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "demos.h"
|
||||
#include <demos.h>
|
||||
|
||||
static GtkTextBuffer *info_buffer;
|
||||
static GtkTextBuffer *source_buffer;
|
||||
@@ -19,7 +19,7 @@ enum {
|
||||
TITLE_COLUMN,
|
||||
FILENAME_COLUMN,
|
||||
FUNC_COLUMN,
|
||||
STYLE_COLUMN,
|
||||
ITALIC_COLUMN,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ get_democodedir (void)
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
result = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
result = g_win32_get_package_installation_directory (NULL, NULL);
|
||||
if (result == NULL)
|
||||
result = "unknown-location";
|
||||
|
||||
@@ -94,15 +94,15 @@ window_closed_cb (GtkWidget *window, gpointer data)
|
||||
{
|
||||
CallbackData *cbdata = data;
|
||||
GtkTreeIter iter;
|
||||
PangoStyle style;
|
||||
gboolean italic;
|
||||
|
||||
gtk_tree_model_get_iter (cbdata->model, &iter, cbdata->path);
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (cbdata->model), &iter,
|
||||
STYLE_COLUMN, &style,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
if (style == PANGO_STYLE_ITALIC)
|
||||
if (italic)
|
||||
gtk_tree_store_set (GTK_TREE_STORE (cbdata->model), &iter,
|
||||
STYLE_COLUMN, PANGO_STYLE_NORMAL,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
|
||||
gtk_tree_path_free (cbdata->path);
|
||||
@@ -195,12 +195,11 @@ static gchar *types[] =
|
||||
"const ",
|
||||
"void",
|
||||
"gint",
|
||||
" int ",
|
||||
" char ",
|
||||
"int ",
|
||||
"char ",
|
||||
"gchar ",
|
||||
"gfloat",
|
||||
"float",
|
||||
"double",
|
||||
"gint8",
|
||||
"gint16",
|
||||
"gint32",
|
||||
@@ -235,87 +234,6 @@ static gchar *types[] =
|
||||
"GdkPixbuf ",
|
||||
"GError",
|
||||
"size_t",
|
||||
"GtkAboutDialog ",
|
||||
"GtkAction ",
|
||||
"GtkActionEntry ",
|
||||
"GtkRadioActionEntry ",
|
||||
"GtkIconFactory ",
|
||||
"GtkStockItem ",
|
||||
"GtkIconSet ",
|
||||
"GtkTextBuffer ",
|
||||
"GtkStatusbar ",
|
||||
"GtkTextIter ",
|
||||
"GtkTextMark ",
|
||||
"GdkEventWindowState ",
|
||||
"GtkActionGroup ",
|
||||
"GtkUIManager ",
|
||||
"GtkRadioAction ",
|
||||
"GtkActionClass ",
|
||||
"GtkToggleActionEntry ",
|
||||
"GtkAssistant ",
|
||||
"GtkBuilder ",
|
||||
"GtkSizeGroup ",
|
||||
"GtkTreeModel ",
|
||||
"GtkTreeSelection ",
|
||||
"GdkDisplay ",
|
||||
"GdkScreen ",
|
||||
"GdkWindow ",
|
||||
"GdkEventButton ",
|
||||
"GdkCursor ",
|
||||
"GtkTreeIter ",
|
||||
"GtkTreeViewColumn ",
|
||||
"GdkDisplayManager ",
|
||||
"GtkClipboard ",
|
||||
"GtkIconSize ",
|
||||
"GtkImage ",
|
||||
"GdkDragContext ",
|
||||
"GtkSelectionData ",
|
||||
"GtkDialog ",
|
||||
"GtkMenuItem ",
|
||||
"GtkListStore ",
|
||||
"GtkCellLayout ",
|
||||
"GtkCellRenderer ",
|
||||
"GtkTreePath ",
|
||||
"GtkTreeStore ",
|
||||
"GtkEntry ",
|
||||
"GtkEditable ",
|
||||
"GtkEditableClass ",
|
||||
"GdkPixmap ",
|
||||
"GdkEventConfigure ",
|
||||
"GdkEventMotion ",
|
||||
"GdkModifierType ",
|
||||
"GtkEntryCompletion ",
|
||||
"GtkToolItem ",
|
||||
"GDir ",
|
||||
"GtkIconView ",
|
||||
"GtkCellRendererText ",
|
||||
"GtkContainer ",
|
||||
"GtkAccelGroup ",
|
||||
"GtkPaned ",
|
||||
"GtkPrintOperation ",
|
||||
"GtkPrintContext ",
|
||||
"cairo_t ",
|
||||
"PangoLayout "
|
||||
"PangoFontDescription ",
|
||||
"PangoRenderer ",
|
||||
"PangoMatrix ",
|
||||
"PangoContext ",
|
||||
"PangoLayout ",
|
||||
"GtkTable ",
|
||||
"GtkToggleButton ",
|
||||
"GString ",
|
||||
"GtkIconSize ",
|
||||
"GtkTreeView ",
|
||||
"GtkTextTag ",
|
||||
"GdkEvent ",
|
||||
"GdkEventKey ",
|
||||
"GtkTextView ",
|
||||
"GdkEventVisibility ",
|
||||
"GdkBitmap ",
|
||||
"GtkTextChildAnchor ",
|
||||
"GArray ",
|
||||
"GtkCellEditable ",
|
||||
"GtkCellRendererToggle ",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -390,8 +308,7 @@ parse_chars (gchar *text,
|
||||
}
|
||||
/* check for types */
|
||||
for (i = 0; types[i] != NULL; i++)
|
||||
if (!strncmp (text, types[i], strlen (types[i])) ||
|
||||
(start && types[i][0] == ' ' && !strncmp (text, types[i] + 1, strlen (types[i]) - 1)))
|
||||
if (!strncmp (text, types[i], strlen (types[i])))
|
||||
{
|
||||
*end_ptr = text + strlen (types[i]);
|
||||
*tag = "type";
|
||||
@@ -658,8 +575,6 @@ load_file (const gchar *filename)
|
||||
}
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
|
||||
fontify ();
|
||||
|
||||
g_string_free (buffer, TRUE);
|
||||
@@ -671,7 +586,7 @@ row_activated_cb (GtkTreeView *tree_view,
|
||||
GtkTreeViewColumn *column)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
PangoStyle style;
|
||||
gboolean italic;
|
||||
GDoDemoFunc func;
|
||||
GtkWidget *window;
|
||||
GtkTreeModel *model;
|
||||
@@ -682,14 +597,14 @@ row_activated_cb (GtkTreeView *tree_view,
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
STYLE_COLUMN, &style,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
|
||||
if (func)
|
||||
{
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
STYLE_COLUMN, (style == PANGO_STYLE_ITALIC ? PANGO_STYLE_NORMAL : PANGO_STYLE_ITALIC),
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
window = (func) (gtk_widget_get_toplevel (GTK_WIDGET (tree_view)));
|
||||
|
||||
@@ -785,7 +700,7 @@ create_tree (void)
|
||||
|
||||
Demo *d = testgtk_demos;
|
||||
|
||||
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT);
|
||||
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
tree_view = gtk_tree_view_new ();
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
@@ -808,7 +723,7 @@ create_tree (void)
|
||||
TITLE_COLUMN, d->title,
|
||||
FILENAME_COLUMN, d->filename,
|
||||
FUNC_COLUMN, d->func,
|
||||
STYLE_COLUMN, PANGO_STYLE_NORMAL,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
|
||||
d++;
|
||||
@@ -827,7 +742,7 @@ create_tree (void)
|
||||
TITLE_COLUMN, children->title,
|
||||
FILENAME_COLUMN, children->filename,
|
||||
FUNC_COLUMN, children->func,
|
||||
STYLE_COLUMN, PANGO_STYLE_NORMAL,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
|
||||
children++;
|
||||
@@ -836,10 +751,14 @@ create_tree (void)
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
|
||||
g_object_set (cell,
|
||||
"style", PANGO_STYLE_ITALIC,
|
||||
NULL);
|
||||
|
||||
column = gtk_tree_view_column_new_with_attributes ("Widget (double click for demo)",
|
||||
cell,
|
||||
"text", TITLE_COLUMN,
|
||||
"style", STYLE_COLUMN,
|
||||
"style_set", ITALIC_COLUMN,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
@@ -867,8 +786,6 @@ create_tree (void)
|
||||
|
||||
gtk_widget_grab_focus (tree_view);
|
||||
|
||||
g_object_unref (model);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
@@ -952,7 +869,7 @@ main (int argc, char **argv)
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GTK+ Code Demos");
|
||||
g_signal_connect_after (window, "destroy",
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
@@ -968,18 +885,16 @@ main (int argc, char **argv)
|
||||
create_text (&info_buffer, FALSE),
|
||||
gtk_label_new_with_mnemonic ("_Info"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title",
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
g_object_unref (info_buffer);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&source_buffer, TRUE),
|
||||
gtk_label_new_with_mnemonic ("_Source"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title",
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (source_buffer, "comment",
|
||||
"foreground", "DodgerBlue",
|
||||
"foreground", "red",
|
||||
NULL);
|
||||
tag = gtk_text_buffer_create_tag (source_buffer, "type",
|
||||
"foreground", "ForestGreen",
|
||||
@@ -999,7 +914,6 @@ main (int argc, char **argv)
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"foreground", "DarkGoldenrod4",
|
||||
NULL);
|
||||
g_object_unref (source_buffer);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
@@ -2,10 +2,10 @@
|
||||
*
|
||||
* There are several widgets involved in displaying menus. The
|
||||
* GtkMenuBar widget is a menu bar, which normally appears horizontally
|
||||
* at the top of an application, but can also be layed out vertically.
|
||||
* The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
|
||||
* and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
|
||||
* menu items (GtkMenuItem). Each menu item contains text and/or images
|
||||
* at the top of an application, but can also be layed out vertically.
|
||||
* The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
|
||||
* and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
|
||||
* menu items (GtkMenuItem). Each menu item contains text and/or images
|
||||
* and can be selected by the user.
|
||||
*
|
||||
* There are several kinds of menu item, including plain GtkMenuItem,
|
||||
@@ -22,6 +22,7 @@
|
||||
* GtkUIManager provides a higher-level interface for creating menu bars
|
||||
* and menus; while you can construct menus manually, most people don't
|
||||
* do that. There's a separate demo for GtkUIManager.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -117,35 +118,37 @@ change_orientation (GtkWidget *button,
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_menus (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *button;
|
||||
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *menubar;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Menus");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK(gtk_widget_destroyed), &window);
|
||||
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (gtk_true), NULL);
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "menus");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
|
||||
|
||||
box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_widget_show (box);
|
||||
@@ -153,18 +156,18 @@ do_menus (GtkWidget *do_widget)
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), box1);
|
||||
gtk_widget_show (box1);
|
||||
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
|
||||
menu = create_menu (2, TRUE);
|
||||
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3, TRUE));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
@@ -175,7 +178,7 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_menu_item_set_right_justified (GTK_MENU_ITEM (menuitem), TRUE);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
@@ -191,12 +194,12 @@ do_menus (GtkWidget *do_widget)
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK(gtk_widget_destroy), window);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
@@ -1,579 +0,0 @@
|
||||
/* Offscreen windows/Rotated button
|
||||
*
|
||||
* Offscreen windows can be used to transform parts of a widget
|
||||
* hierarchy. Note that the rotated button is fully functional.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define GTK_TYPE_ROTATED_BIN (gtk_rotated_bin_get_type ())
|
||||
#define GTK_ROTATED_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ROTATED_BIN, GtkRotatedBin))
|
||||
#define GTK_ROTATED_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ROTATED_BIN, GtkRotatedBinClass))
|
||||
#define GTK_IS_ROTATED_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ROTATED_BIN))
|
||||
#define GTK_IS_ROTATED_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ROTATED_BIN))
|
||||
#define GTK_ROTATED_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ROTATED_BIN, GtkRotatedBinClass))
|
||||
|
||||
typedef struct _GtkRotatedBin GtkRotatedBin;
|
||||
typedef struct _GtkRotatedBinClass GtkRotatedBinClass;
|
||||
|
||||
struct _GtkRotatedBin
|
||||
{
|
||||
GtkContainer container;
|
||||
|
||||
GtkWidget *child;
|
||||
GdkWindow *offscreen_window;
|
||||
gdouble angle;
|
||||
};
|
||||
|
||||
struct _GtkRotatedBinClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_rotated_bin_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_rotated_bin_new (void);
|
||||
void gtk_rotated_bin_set_angle (GtkRotatedBin *bin,
|
||||
gdouble angle);
|
||||
|
||||
/*** implementation ***/
|
||||
|
||||
static void gtk_rotated_bin_realize (GtkWidget *widget);
|
||||
static void gtk_rotated_bin_unrealize (GtkWidget *widget);
|
||||
static void gtk_rotated_bin_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_rotated_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gtk_rotated_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gboolean gtk_rotated_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *offscreen);
|
||||
|
||||
static void gtk_rotated_bin_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_rotated_bin_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_rotated_bin_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static GType gtk_rotated_bin_child_type (GtkContainer *container);
|
||||
|
||||
G_DEFINE_TYPE (GtkRotatedBin, gtk_rotated_bin, GTK_TYPE_CONTAINER);
|
||||
|
||||
static void
|
||||
to_child (GtkRotatedBin *bin,
|
||||
double widget_x,
|
||||
double widget_y,
|
||||
double *x_out,
|
||||
double *y_out)
|
||||
{
|
||||
GtkAllocation child_area;
|
||||
double x, y, xr, yr;
|
||||
double c, s;
|
||||
double w, h;
|
||||
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
child_area = bin->child->allocation;
|
||||
|
||||
w = c * child_area.width + s * child_area.height;
|
||||
h = s * child_area.width + c * child_area.height;
|
||||
|
||||
x = widget_x;
|
||||
y = widget_y;
|
||||
|
||||
x -= (w - child_area.width) / 2;
|
||||
y -= (h - child_area.height) / 2;
|
||||
|
||||
x -= child_area.width / 2;
|
||||
y -= child_area.height / 2;
|
||||
|
||||
xr = x * c + y * s;
|
||||
yr = y * c - x * s;
|
||||
x = xr;
|
||||
y = yr;
|
||||
|
||||
x += child_area.width / 2;
|
||||
y += child_area.height / 2;
|
||||
|
||||
*x_out = x;
|
||||
*y_out = y;
|
||||
}
|
||||
|
||||
static void
|
||||
to_parent (GtkRotatedBin *bin,
|
||||
double offscreen_x,
|
||||
double offscreen_y,
|
||||
double *x_out,
|
||||
double *y_out)
|
||||
{
|
||||
GtkAllocation child_area;
|
||||
double x, y, xr, yr;
|
||||
double c, s;
|
||||
double w, h;
|
||||
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
child_area = bin->child->allocation;
|
||||
|
||||
w = c * child_area.width + s * child_area.height;
|
||||
h = s * child_area.width + c * child_area.height;
|
||||
|
||||
x = offscreen_x;
|
||||
y = offscreen_y;
|
||||
|
||||
x -= child_area.width / 2;
|
||||
y -= child_area.height / 2;
|
||||
|
||||
xr = x * c - y * s;
|
||||
yr = x * s + y * c;
|
||||
x = xr;
|
||||
y = yr;
|
||||
|
||||
x += child_area.width / 2;
|
||||
y += child_area.height / 2;
|
||||
|
||||
x -= (w - child_area.width) / 2;
|
||||
y -= (h - child_area.height) / 2;
|
||||
|
||||
*x_out = x;
|
||||
*y_out = y;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_class_init (GtkRotatedBinClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
widget_class->realize = gtk_rotated_bin_realize;
|
||||
widget_class->unrealize = gtk_rotated_bin_unrealize;
|
||||
widget_class->size_request = gtk_rotated_bin_size_request;
|
||||
widget_class->size_allocate = gtk_rotated_bin_size_allocate;
|
||||
widget_class->expose_event = gtk_rotated_bin_expose;
|
||||
|
||||
g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
|
||||
GTK_TYPE_ROTATED_BIN,
|
||||
g_cclosure_new (G_CALLBACK (gtk_rotated_bin_damage),
|
||||
NULL, NULL));
|
||||
|
||||
container_class->add = gtk_rotated_bin_add;
|
||||
container_class->remove = gtk_rotated_bin_remove;
|
||||
container_class->forall = gtk_rotated_bin_forall;
|
||||
container_class->child_type = gtk_rotated_bin_child_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_init (GtkRotatedBin *bin)
|
||||
{
|
||||
gtk_widget_set_has_window (GTK_WIDGET (bin), TRUE);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_rotated_bin_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_ROTATED_BIN, NULL);
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
pick_offscreen_child (GdkWindow *offscreen_window,
|
||||
double widget_x,
|
||||
double widget_y,
|
||||
GtkRotatedBin *bin)
|
||||
{
|
||||
GtkAllocation child_area;
|
||||
double x, y;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
to_child (bin, widget_x, widget_y, &x, &y);
|
||||
|
||||
child_area = bin->child->allocation;
|
||||
|
||||
if (x >= 0 && x < child_area.width &&
|
||||
y >= 0 && y < child_area.height)
|
||||
return bin->offscreen_window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
offscreen_window_to_parent (GdkWindow *offscreen_window,
|
||||
double offscreen_x,
|
||||
double offscreen_y,
|
||||
double *parent_x,
|
||||
double *parent_y,
|
||||
GtkRotatedBin *bin)
|
||||
{
|
||||
to_parent (bin, offscreen_x, offscreen_y, parent_x, parent_y);
|
||||
}
|
||||
|
||||
static void
|
||||
offscreen_window_from_parent (GdkWindow *window,
|
||||
double parent_x,
|
||||
double parent_y,
|
||||
double *offscreen_x,
|
||||
double *offscreen_y,
|
||||
GtkRotatedBin *bin)
|
||||
{
|
||||
to_child (bin, parent_x, parent_y, offscreen_x, offscreen_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gint border_width;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
attributes.y = widget->allocation.y + border_width;
|
||||
attributes.width = widget->allocation.width - 2 * border_width;
|
||||
attributes.height = widget->allocation.height - 2 * border_width;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.event_mask = gtk_widget_get_events (widget)
|
||||
| GDK_EXPOSURE_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_SCROLL_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK;
|
||||
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (widget->window, widget);
|
||||
g_signal_connect (widget->window, "pick-embedded-child",
|
||||
G_CALLBACK (pick_offscreen_child), bin);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_OFFSCREEN;
|
||||
|
||||
child_requisition.width = child_requisition.height = 0;
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
attributes.width = bin->child->allocation.width;
|
||||
attributes.height = bin->child->allocation.height;
|
||||
}
|
||||
bin->offscreen_window = gdk_window_new (gtk_widget_get_root_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (bin->offscreen_window, widget);
|
||||
if (bin->child)
|
||||
gtk_widget_set_parent_window (bin->child, bin->offscreen_window);
|
||||
gdk_offscreen_window_set_embedder (bin->offscreen_window, widget->window);
|
||||
g_signal_connect (bin->offscreen_window, "to-embedder",
|
||||
G_CALLBACK (offscreen_window_to_parent), bin);
|
||||
g_signal_connect (bin->offscreen_window, "from-embedder",
|
||||
G_CALLBACK (offscreen_window_from_parent), bin);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
||||
gtk_style_set_background (widget->style, bin->offscreen_window, GTK_STATE_NORMAL);
|
||||
gdk_window_show (bin->offscreen_window);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
|
||||
gdk_window_set_user_data (bin->offscreen_window, NULL);
|
||||
gdk_window_destroy (bin->offscreen_window);
|
||||
bin->offscreen_window = NULL;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_rotated_bin_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_rotated_bin_child_type (GtkContainer *container)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
|
||||
|
||||
if (bin->child)
|
||||
return G_TYPE_NONE;
|
||||
|
||||
return GTK_TYPE_WIDGET;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
|
||||
|
||||
if (!bin->child)
|
||||
{
|
||||
gtk_widget_set_parent_window (widget, bin->offscreen_window);
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (bin));
|
||||
bin->child = widget;
|
||||
}
|
||||
else
|
||||
g_warning ("GtkRotatedBin cannot have more than one child\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
|
||||
gboolean was_visible;
|
||||
|
||||
was_visible = gtk_widget_get_visible (widget);
|
||||
|
||||
if (bin->child == widget)
|
||||
{
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
bin->child = NULL;
|
||||
|
||||
if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
|
||||
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (bin->child)
|
||||
(*callback) (bin->child, callback_data);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rotated_bin_set_angle (GtkRotatedBin *bin,
|
||||
gdouble angle)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ROTATED_BIN (bin));
|
||||
|
||||
bin->angle = angle;
|
||||
gtk_widget_queue_resize (GTK_WIDGET (bin));
|
||||
|
||||
gdk_window_geometry_changed (bin->offscreen_window);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
GtkRequisition child_requisition;
|
||||
double s, c;
|
||||
double w, h;
|
||||
|
||||
child_requisition.width = 0;
|
||||
child_requisition.height = 0;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
w = c * child_requisition.width + s * child_requisition.height;
|
||||
h = s * child_requisition.width + c * child_requisition.height;
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2 + w;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2 + h;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rotated_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
gint border_width;
|
||||
gint w, h;
|
||||
gdouble s, c;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
w = allocation->width - border_width * 2;
|
||||
h = allocation->height - border_width * 2;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x + border_width,
|
||||
allocation->y + border_width,
|
||||
w, h);
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.height = child_requisition.height;
|
||||
if (c == 0.0)
|
||||
child_allocation.width = h / s;
|
||||
else if (s == 0.0)
|
||||
child_allocation.width = w / c;
|
||||
else
|
||||
child_allocation.width = MIN ((w - s * child_allocation.height) / c,
|
||||
(h - c * child_allocation.height) / s);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (bin->offscreen_window,
|
||||
child_allocation.x,
|
||||
child_allocation.y,
|
||||
child_allocation.width,
|
||||
child_allocation.height);
|
||||
|
||||
child_allocation.x = child_allocation.y = 0;
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_rotated_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
gdk_window_invalidate_rect (widget->window, NULL, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_rotated_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
gint width, height;
|
||||
gdouble s, c;
|
||||
gdouble w, h;
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
if (event->window == widget->window)
|
||||
{
|
||||
GdkPixmap *pixmap;
|
||||
GtkAllocation child_area;
|
||||
cairo_t *cr;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
pixmap = gdk_offscreen_window_get_pixmap (bin->offscreen_window);
|
||||
child_area = bin->child->allocation;
|
||||
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
|
||||
/* transform */
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
w = c * child_area.width + s * child_area.height;
|
||||
h = s * child_area.width + c * child_area.height;
|
||||
|
||||
cairo_translate (cr, (w - child_area.width) / 2, (h - child_area.height) / 2);
|
||||
cairo_translate (cr, child_area.width / 2, child_area.height / 2);
|
||||
cairo_rotate (cr, bin->angle);
|
||||
cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
|
||||
|
||||
/* clip */
|
||||
gdk_drawable_get_size (pixmap, &width, &height);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
/* paint */
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
else if (event->window == bin->offscreen_window)
|
||||
{
|
||||
gtk_paint_flat_box (widget->style, event->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
&event->area, widget, "blah",
|
||||
0, 0, -1, -1);
|
||||
|
||||
if (bin->child)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
event);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** ***/
|
||||
|
||||
static void
|
||||
scale_changed (GtkRange *range,
|
||||
GtkRotatedBin *bin)
|
||||
{
|
||||
gtk_rotated_bin_set_angle (bin, gtk_range_get_value (range));
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_offscreen_window (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *bin, *vbox, *scale, *button;
|
||||
GdkColor black;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated widget");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gdk_color_parse ("black", &black);
|
||||
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &black);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_vbox_new (0, FALSE);
|
||||
scale = gtk_hscale_new_with_range (0, G_PI/2, 0.01);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
|
||||
button = gtk_button_new_with_label ("A Button");
|
||||
bin = gtk_rotated_bin_new ();
|
||||
|
||||
g_signal_connect (scale, "value-changed", G_CALLBACK (scale_changed), bin);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bin, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (bin), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,500 +0,0 @@
|
||||
/* Offscreen windows/Effects
|
||||
*
|
||||
* Offscreen windows can be used to render elements multiple times to achieve
|
||||
* various effects.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define GTK_TYPE_MIRROR_BIN (gtk_mirror_bin_get_type ())
|
||||
#define GTK_MIRROR_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MIRROR_BIN, GtkMirrorBin))
|
||||
#define GTK_MIRROR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MIRROR_BIN, GtkMirrorBinClass))
|
||||
#define GTK_IS_MIRROR_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MIRROR_BIN))
|
||||
#define GTK_IS_MIRROR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MIRROR_BIN))
|
||||
#define GTK_MIRROR_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MIRROR_BIN, GtkMirrorBinClass))
|
||||
|
||||
typedef struct _GtkMirrorBin GtkMirrorBin;
|
||||
typedef struct _GtkMirrorBinClass GtkMirrorBinClass;
|
||||
|
||||
struct _GtkMirrorBin
|
||||
{
|
||||
GtkContainer container;
|
||||
|
||||
GtkWidget *child;
|
||||
GdkWindow *offscreen_window;
|
||||
};
|
||||
|
||||
struct _GtkMirrorBinClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_mirror_bin_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_mirror_bin_new (void);
|
||||
|
||||
/*** implementation ***/
|
||||
|
||||
static void gtk_mirror_bin_realize (GtkWidget *widget);
|
||||
static void gtk_mirror_bin_unrealize (GtkWidget *widget);
|
||||
static void gtk_mirror_bin_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_mirror_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gtk_mirror_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gboolean gtk_mirror_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *offscreen);
|
||||
|
||||
static void gtk_mirror_bin_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_mirror_bin_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_mirror_bin_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static GType gtk_mirror_bin_child_type (GtkContainer *container);
|
||||
|
||||
G_DEFINE_TYPE (GtkMirrorBin, gtk_mirror_bin, GTK_TYPE_CONTAINER);
|
||||
|
||||
static void
|
||||
to_child (GtkMirrorBin *bin,
|
||||
double widget_x,
|
||||
double widget_y,
|
||||
double *x_out,
|
||||
double *y_out)
|
||||
{
|
||||
*x_out = widget_x;
|
||||
*y_out = widget_y;
|
||||
}
|
||||
|
||||
static void
|
||||
to_parent (GtkMirrorBin *bin,
|
||||
double offscreen_x,
|
||||
double offscreen_y,
|
||||
double *x_out,
|
||||
double *y_out)
|
||||
{
|
||||
*x_out = offscreen_x;
|
||||
*y_out = offscreen_y;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_class_init (GtkMirrorBinClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
widget_class->realize = gtk_mirror_bin_realize;
|
||||
widget_class->unrealize = gtk_mirror_bin_unrealize;
|
||||
widget_class->size_request = gtk_mirror_bin_size_request;
|
||||
widget_class->size_allocate = gtk_mirror_bin_size_allocate;
|
||||
widget_class->expose_event = gtk_mirror_bin_expose;
|
||||
|
||||
g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
|
||||
GTK_TYPE_MIRROR_BIN,
|
||||
g_cclosure_new (G_CALLBACK (gtk_mirror_bin_damage),
|
||||
NULL, NULL));
|
||||
|
||||
container_class->add = gtk_mirror_bin_add;
|
||||
container_class->remove = gtk_mirror_bin_remove;
|
||||
container_class->forall = gtk_mirror_bin_forall;
|
||||
container_class->child_type = gtk_mirror_bin_child_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_init (GtkMirrorBin *bin)
|
||||
{
|
||||
gtk_widget_set_has_window (GTK_WIDGET (bin), TRUE);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_mirror_bin_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_MIRROR_BIN, NULL);
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
pick_offscreen_child (GdkWindow *offscreen_window,
|
||||
double widget_x,
|
||||
double widget_y,
|
||||
GtkMirrorBin *bin)
|
||||
{
|
||||
GtkAllocation child_area;
|
||||
double x, y;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
to_child (bin, widget_x, widget_y, &x, &y);
|
||||
|
||||
child_area = bin->child->allocation;
|
||||
|
||||
if (x >= 0 && x < child_area.width &&
|
||||
y >= 0 && y < child_area.height)
|
||||
return bin->offscreen_window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
offscreen_window_to_parent (GdkWindow *offscreen_window,
|
||||
double offscreen_x,
|
||||
double offscreen_y,
|
||||
double *parent_x,
|
||||
double *parent_y,
|
||||
GtkMirrorBin *bin)
|
||||
{
|
||||
to_parent (bin, offscreen_x, offscreen_y, parent_x, parent_y);
|
||||
}
|
||||
|
||||
static void
|
||||
offscreen_window_from_parent (GdkWindow *window,
|
||||
double parent_x,
|
||||
double parent_y,
|
||||
double *offscreen_x,
|
||||
double *offscreen_y,
|
||||
GtkMirrorBin *bin)
|
||||
{
|
||||
to_child (bin, parent_x, parent_y, offscreen_x, offscreen_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gint border_width;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
attributes.y = widget->allocation.y + border_width;
|
||||
attributes.width = widget->allocation.width - 2 * border_width;
|
||||
attributes.height = widget->allocation.height - 2 * border_width;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.event_mask = gtk_widget_get_events (widget)
|
||||
| GDK_EXPOSURE_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_SCROLL_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK;
|
||||
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (widget->window, widget);
|
||||
g_signal_connect (widget->window, "pick-embedded-child",
|
||||
G_CALLBACK (pick_offscreen_child), bin);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_OFFSCREEN;
|
||||
|
||||
child_requisition.width = child_requisition.height = 0;
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
attributes.width = bin->child->allocation.width;
|
||||
attributes.height = bin->child->allocation.height;
|
||||
}
|
||||
bin->offscreen_window = gdk_window_new (gtk_widget_get_root_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (bin->offscreen_window, widget);
|
||||
if (bin->child)
|
||||
gtk_widget_set_parent_window (bin->child, bin->offscreen_window);
|
||||
gdk_offscreen_window_set_embedder (bin->offscreen_window, widget->window);
|
||||
g_signal_connect (bin->offscreen_window, "to-embedder",
|
||||
G_CALLBACK (offscreen_window_to_parent), bin);
|
||||
g_signal_connect (bin->offscreen_window, "from-embedder",
|
||||
G_CALLBACK (offscreen_window_from_parent), bin);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
||||
gtk_style_set_background (widget->style, bin->offscreen_window, GTK_STATE_NORMAL);
|
||||
gdk_window_show (bin->offscreen_window);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
|
||||
gdk_window_set_user_data (bin->offscreen_window, NULL);
|
||||
gdk_window_destroy (bin->offscreen_window);
|
||||
bin->offscreen_window = NULL;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_mirror_bin_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_mirror_bin_child_type (GtkContainer *container)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
|
||||
|
||||
if (bin->child)
|
||||
return G_TYPE_NONE;
|
||||
|
||||
return GTK_TYPE_WIDGET;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
|
||||
|
||||
if (!bin->child)
|
||||
{
|
||||
gtk_widget_set_parent_window (widget, bin->offscreen_window);
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (bin));
|
||||
bin->child = widget;
|
||||
}
|
||||
else
|
||||
g_warning ("GtkMirrorBin cannot have more than one child\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
|
||||
gboolean was_visible;
|
||||
|
||||
was_visible = gtk_widget_get_visible (widget);
|
||||
|
||||
if (bin->child == widget)
|
||||
{
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
bin->child = NULL;
|
||||
|
||||
if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
|
||||
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (bin->child)
|
||||
(*callback) (bin->child, callback_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
child_requisition.width = 0;
|
||||
child_requisition.height = 0;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.width + 10;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.height * 2 + 10;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_mirror_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
gint border_width;
|
||||
gint w, h;
|
||||
widget->allocation = *allocation;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
w = allocation->width - border_width * 2;
|
||||
h = allocation->height - border_width * 2;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x + border_width,
|
||||
allocation->y + border_width,
|
||||
w, h);
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.height = child_requisition.height;
|
||||
child_allocation.width = child_requisition.width;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (bin->offscreen_window,
|
||||
allocation->x + border_width,
|
||||
allocation->y + border_width,
|
||||
child_allocation.width, child_allocation.height);
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_mirror_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
gdk_window_invalidate_rect (widget->window, NULL, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_mirror_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
gint width, height;
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
if (event->window == widget->window)
|
||||
{
|
||||
GdkPixmap *pixmap;
|
||||
cairo_t *cr;
|
||||
cairo_matrix_t matrix;
|
||||
cairo_pattern_t *mask;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
pixmap = gdk_offscreen_window_get_pixmap (bin->offscreen_window);
|
||||
gdk_drawable_get_size (pixmap, &width, &height);
|
||||
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
/* paint the offscreen child */
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_matrix_init (&matrix, 1.0, 0.0, 0.3, 1.0, 0.0, 0.0);
|
||||
cairo_matrix_scale (&matrix, 1.0, -1.0);
|
||||
cairo_matrix_translate (&matrix, -10, - 3 * height - 10);
|
||||
cairo_transform (cr, &matrix);
|
||||
|
||||
cairo_rectangle (cr, 0, height, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, height);
|
||||
|
||||
/* create linear gradient as mask-pattern to fade out the source */
|
||||
mask = cairo_pattern_create_linear (0.0, height, 0.0, 2*height);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.25, 0.0, 0.0, 0.0, 0.01);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.5, 0.0, 0.0, 0.0, 0.25);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.75, 0.0, 0.0, 0.0, 0.5);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
/* paint the reflection */
|
||||
cairo_mask (cr, mask);
|
||||
|
||||
cairo_pattern_destroy (mask);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
else if (event->window == bin->offscreen_window)
|
||||
{
|
||||
gtk_paint_flat_box (widget->style, event->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
&event->area, widget, "blah",
|
||||
0, 0, -1, -1);
|
||||
|
||||
if (bin->child)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
event);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** ***/
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_offscreen_window2 (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *bin, *vbox;
|
||||
GtkWidget *hbox, *entry, *applybutton, *backbutton;
|
||||
GtkSizeGroup *group;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Effects");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_vbox_new (0, FALSE);
|
||||
|
||||
bin = gtk_mirror_bin_new ();
|
||||
|
||||
group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
backbutton = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (backbutton),
|
||||
gtk_image_new_from_stock (GTK_STOCK_GO_BACK, 4));
|
||||
gtk_size_group_add_widget (group, backbutton);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_size_group_add_widget (group, entry);
|
||||
applybutton = gtk_button_new ();
|
||||
gtk_size_group_add_widget (group, applybutton);
|
||||
gtk_container_add (GTK_CONTAINER (applybutton),
|
||||
gtk_image_new_from_stock (GTK_STOCK_APPLY, 4));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bin, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (bin), hbox);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), backbutton, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), applybutton, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -24,13 +24,13 @@ toggle_resize (GtkWidget *widget,
|
||||
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
|
||||
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
|
||||
|
||||
g_object_ref (child);
|
||||
gtk_widget_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (child->parent), child);
|
||||
if (is_child1)
|
||||
gtk_paned_pack1 (paned, child, !resize, shrink);
|
||||
else
|
||||
gtk_paned_pack2 (paned, child, !resize, shrink);
|
||||
g_object_unref (child);
|
||||
gtk_widget_unref (child);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -44,13 +44,13 @@ toggle_shrink (GtkWidget *widget,
|
||||
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
|
||||
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
|
||||
|
||||
g_object_ref (child);
|
||||
gtk_widget_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (child->parent), child);
|
||||
if (is_child1)
|
||||
gtk_paned_pack1 (paned, child, resize, !shrink);
|
||||
else
|
||||
gtk_paned_pack2 (paned, child, resize, !shrink);
|
||||
g_object_unref (child);
|
||||
gtk_widget_unref (child);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -180,7 +180,7 @@ do_panes (GtkWidget *do_widget)
|
||||
gtk_widget_show_all (vbox);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 3, 4);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ load_pixbufs (GError **error)
|
||||
if (background)
|
||||
return TRUE; /* already loaded earlier */
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -82,13 +82,13 @@ load_pixbufs (GError **error)
|
||||
{
|
||||
filename = demo_find_file (image_names[i], error);
|
||||
if (!filename)
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
|
||||
images[i] = gdk_pixbuf_new_from_file (filename, error);
|
||||
g_free (filename);
|
||||
|
||||
if (!images[i])
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -96,9 +96,9 @@ load_pixbufs (GError **error)
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static gint
|
||||
expose_cb (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
expose_cb (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
guchar *pixels;
|
||||
int rowstride;
|
||||
@@ -108,12 +108,12 @@ expose_cb (GtkWidget *widget,
|
||||
pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3;
|
||||
|
||||
gdk_draw_rgb_image_dithalign (widget->window,
|
||||
widget->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixels, rowstride,
|
||||
event->area.x, event->area.y);
|
||||
widget->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixels, rowstride,
|
||||
event->area.x, event->area.y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ timeout (gpointer data)
|
||||
double radius;
|
||||
|
||||
gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
|
||||
frame, 0, 0);
|
||||
frame, 0, 0);
|
||||
|
||||
f = (double) (frame_num % CYCLE_LEN) / CYCLE_LEN;
|
||||
|
||||
@@ -175,21 +175,19 @@ timeout (gpointer data)
|
||||
r2.height = back_height;
|
||||
|
||||
if (gdk_rectangle_intersect (&r1, &r2, &dest))
|
||||
gdk_pixbuf_composite (images[i],
|
||||
frame,
|
||||
dest.x, dest.y,
|
||||
dest.width, dest.height,
|
||||
xpos, ypos,
|
||||
k, k,
|
||||
GDK_INTERP_NEAREST,
|
||||
((i & 1)
|
||||
? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
|
||||
: MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
|
||||
gdk_pixbuf_composite (images[i],
|
||||
frame,
|
||||
dest.x, dest.y,
|
||||
dest.width, dest.height,
|
||||
xpos, ypos,
|
||||
k, k,
|
||||
GDK_INTERP_NEAREST,
|
||||
((i & 1)
|
||||
? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
|
||||
: MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
|
||||
}
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
gtk_widget_queue_draw (da);
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
frame_num++;
|
||||
return TRUE;
|
||||
@@ -199,7 +197,7 @@ static guint timeout_id;
|
||||
|
||||
static void
|
||||
cleanup_callback (GtkObject *object,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
g_source_remove (timeout_id);
|
||||
timeout_id = 0;
|
||||
@@ -214,53 +212,51 @@ do_pixbufs (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (cleanup_callback), NULL);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (cleanup_callback), NULL);
|
||||
|
||||
|
||||
error = NULL;
|
||||
if (!load_pixbufs (&error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Failed to load an image: %s",
|
||||
error->message);
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Failed to load an image: %s",
|
||||
error->message);
|
||||
|
||||
g_error_free (error);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_size_request (window, back_width, back_height);
|
||||
{
|
||||
gtk_widget_set_size_request (window, back_width, back_height);
|
||||
|
||||
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
|
||||
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
g_signal_connect (da, "expose_event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
|
||||
}
|
||||
timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,212 +0,0 @@
|
||||
/* Printing
|
||||
*
|
||||
* GtkPrintOperation offers a simple API to support printing
|
||||
* in a cross-platform way.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo-common.h"
|
||||
|
||||
/* In points */
|
||||
#define HEADER_HEIGHT (10*72/25.4)
|
||||
#define HEADER_GAP (3*72/25.4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *filename;
|
||||
gdouble font_size;
|
||||
|
||||
gint lines_per_page;
|
||||
gchar **lines;
|
||||
gint num_lines;
|
||||
gint num_pages;
|
||||
} PrintData;
|
||||
|
||||
static void
|
||||
begin_print (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
gpointer user_data)
|
||||
{
|
||||
PrintData *data = (PrintData *)user_data;
|
||||
char *contents;
|
||||
int i;
|
||||
double height;
|
||||
|
||||
height = gtk_print_context_get_height (context) - HEADER_HEIGHT - HEADER_GAP;
|
||||
|
||||
data->lines_per_page = floor (height / data->font_size);
|
||||
|
||||
g_file_get_contents (data->filename, &contents, NULL, NULL);
|
||||
|
||||
data->lines = g_strsplit (contents, "\n", 0);
|
||||
g_free (contents);
|
||||
|
||||
i = 0;
|
||||
while (data->lines[i] != NULL)
|
||||
i++;
|
||||
|
||||
data->num_lines = i;
|
||||
data->num_pages = (data->num_lines - 1) / data->lines_per_page + 1;
|
||||
|
||||
gtk_print_operation_set_n_pages (operation, data->num_pages);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_page (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
gint page_nr,
|
||||
gpointer user_data)
|
||||
{
|
||||
PrintData *data = (PrintData *)user_data;
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
gint text_width, text_height;
|
||||
gdouble width;
|
||||
gint line, i;
|
||||
PangoFontDescription *desc;
|
||||
gchar *page_str;
|
||||
|
||||
cr = gtk_print_context_get_cairo_context (context);
|
||||
width = gtk_print_context_get_width (context);
|
||||
|
||||
cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
|
||||
|
||||
cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
|
||||
cairo_fill_preserve (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_stroke (cr);
|
||||
|
||||
layout = gtk_print_context_create_pango_layout (context);
|
||||
|
||||
desc = pango_font_description_from_string ("sans 14");
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
pango_layout_set_text (layout, data->filename, -1);
|
||||
pango_layout_get_pixel_size (layout, &text_width, &text_height);
|
||||
|
||||
if (text_width > width)
|
||||
{
|
||||
pango_layout_set_width (layout, width);
|
||||
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_START);
|
||||
pango_layout_get_pixel_size (layout, &text_width, &text_height);
|
||||
}
|
||||
|
||||
cairo_move_to (cr, (width - text_width) / 2, (HEADER_HEIGHT - text_height) / 2);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
page_str = g_strdup_printf ("%d/%d", page_nr + 1, data->num_pages);
|
||||
pango_layout_set_text (layout, page_str, -1);
|
||||
g_free (page_str);
|
||||
|
||||
pango_layout_set_width (layout, -1);
|
||||
pango_layout_get_pixel_size (layout, &text_width, &text_height);
|
||||
cairo_move_to (cr, width - text_width - 4, (HEADER_HEIGHT - text_height) / 2);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
|
||||
layout = gtk_print_context_create_pango_layout (context);
|
||||
|
||||
desc = pango_font_description_from_string ("monospace");
|
||||
pango_font_description_set_size (desc, data->font_size * PANGO_SCALE);
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
cairo_move_to (cr, 0, HEADER_HEIGHT + HEADER_GAP);
|
||||
line = page_nr * data->lines_per_page;
|
||||
for (i = 0; i < data->lines_per_page && line < data->num_lines; i++)
|
||||
{
|
||||
pango_layout_set_text (layout, data->lines[line], -1);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
cairo_rel_move_to (cr, 0, data->font_size);
|
||||
line++;
|
||||
}
|
||||
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
static void
|
||||
end_print (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
gpointer user_data)
|
||||
{
|
||||
PrintData *data = (PrintData *)user_data;
|
||||
|
||||
g_free (data->filename);
|
||||
g_strfreev (data->lines);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_printing (GtkWidget *do_widget)
|
||||
{
|
||||
GtkPrintOperation *operation;
|
||||
GtkPrintSettings *settings;
|
||||
PrintData *data;
|
||||
gchar *uri, *ext;
|
||||
const gchar *dir;
|
||||
GError *error = NULL;
|
||||
|
||||
operation = gtk_print_operation_new ();
|
||||
data = g_new0 (PrintData, 1);
|
||||
data->filename = demo_find_file ("printing.c", NULL);
|
||||
data->font_size = 12.0;
|
||||
|
||||
g_signal_connect (G_OBJECT (operation), "begin-print",
|
||||
G_CALLBACK (begin_print), data);
|
||||
g_signal_connect (G_OBJECT (operation), "draw-page",
|
||||
G_CALLBACK (draw_page), data);
|
||||
g_signal_connect (G_OBJECT (operation), "end-print",
|
||||
G_CALLBACK (end_print), data);
|
||||
|
||||
gtk_print_operation_set_use_full_page (operation, FALSE);
|
||||
gtk_print_operation_set_unit (operation, GTK_UNIT_POINTS);
|
||||
gtk_print_operation_set_embed_page_setup (operation, TRUE);
|
||||
|
||||
settings = gtk_print_settings_new ();
|
||||
dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
|
||||
if (dir == NULL)
|
||||
dir = g_get_home_dir ();
|
||||
if (g_strcmp0 (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT), "ps") == 0)
|
||||
ext = ".ps";
|
||||
else if (g_strcmp0 (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT), "svg") == 0)
|
||||
ext = ".svg";
|
||||
else
|
||||
ext = ".pdf";
|
||||
|
||||
uri = g_strconcat ("file://", dir, "/", "gtk-demo", ext, NULL);
|
||||
gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
|
||||
gtk_print_operation_set_print_settings (operation, settings);
|
||||
|
||||
gtk_print_operation_run (operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (do_widget), &error);
|
||||
|
||||
g_object_unref (operation);
|
||||
g_object_unref (settings);
|
||||
g_free (uri);
|
||||
|
||||
if (error)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (do_widget),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
@@ -1,173 +1,101 @@
|
||||
/* Rotated Text
|
||||
*
|
||||
* This demo shows how to use PangoCairo to draw rotated and transformed
|
||||
* text. The right pane shows a rotated GtkLabel widget.
|
||||
* This demo shows how to use GDK and Pango to draw rotated and transformed
|
||||
* text. The use of GdkPangoRenderer in this example is a somewhat advanced
|
||||
* technique; most applications can simply use gdk_draw_layout(). We use
|
||||
* it here mostly because that allows us to work in user coordinates - that is,
|
||||
* coordinates prior to the application of the transformation matrix, rather
|
||||
* than device coordinates.
|
||||
*
|
||||
* In both cases, a custom PangoCairo shape renderer is installed to draw
|
||||
* a red heard using cairo drawing operations instead of the Unicode heart
|
||||
* character.
|
||||
* As of GTK+-2.6, the ability to draw transformed and anti-aliased graphics
|
||||
* as shown in this example is only present for text. With GTK+-2.8, a new
|
||||
* graphics system called "Cairo" will be introduced that provides these
|
||||
* capabilities and many more for all types of graphics.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
#define HEART "♥"
|
||||
const char text[] = "I ♥ GTK+";
|
||||
|
||||
static void
|
||||
fancy_shape_renderer (cairo_t *cr,
|
||||
PangoAttrShape *attr,
|
||||
gboolean do_path,
|
||||
gpointer data)
|
||||
{
|
||||
double x, y;
|
||||
cairo_get_current_point (cr, &x, &y);
|
||||
cairo_translate (cr, x, y);
|
||||
|
||||
cairo_scale (cr,
|
||||
(double) attr->ink_rect.width / PANGO_SCALE,
|
||||
(double) attr->ink_rect.height / PANGO_SCALE);
|
||||
|
||||
switch (GPOINTER_TO_UINT (attr->data))
|
||||
{
|
||||
case 0x2665: /* U+2665 BLACK HEART SUIT */
|
||||
{
|
||||
cairo_move_to (cr, .5, .0);
|
||||
cairo_line_to (cr, .9, -.4);
|
||||
cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
|
||||
cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
|
||||
cairo_close_path (cr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!do_path) {
|
||||
cairo_set_source_rgb (cr, 1., 0., 0.);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
}
|
||||
|
||||
PangoAttrList *
|
||||
create_fancy_attr_list_for_layout (PangoLayout *layout)
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
PangoFontMetrics *metrics;
|
||||
int ascent;
|
||||
PangoRectangle ink_rect, logical_rect;
|
||||
const char *p;
|
||||
|
||||
/* Get font metrics and prepare fancy shape size */
|
||||
metrics = pango_context_get_metrics (pango_layout_get_context (layout),
|
||||
pango_layout_get_font_description (layout),
|
||||
NULL);
|
||||
ascent = pango_font_metrics_get_ascent (metrics);
|
||||
logical_rect.x = 0;
|
||||
logical_rect.width = ascent;
|
||||
logical_rect.y = -ascent;
|
||||
logical_rect.height = ascent;
|
||||
ink_rect = logical_rect;
|
||||
pango_font_metrics_unref (metrics);
|
||||
|
||||
/* Set fancy shape attributes for all hearts */
|
||||
attrs = pango_attr_list_new ();
|
||||
for (p = text; (p = strstr (p, HEART)); p += strlen (HEART))
|
||||
{
|
||||
PangoAttribute *attr;
|
||||
|
||||
attr = pango_attr_shape_new_with_data (&ink_rect,
|
||||
&logical_rect,
|
||||
GUINT_TO_POINTER (g_utf8_get_char (p)),
|
||||
NULL, NULL);
|
||||
|
||||
attr->start_index = p - text;
|
||||
attr->end_index = attr->start_index + strlen (HEART);
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rotated_text_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
#define RADIUS 150
|
||||
#define N_WORDS 5
|
||||
#define FONT "Serif 18"
|
||||
|
||||
#define N_WORDS 10
|
||||
#define FONT "Sans Bold 27"
|
||||
|
||||
PangoRenderer *renderer;
|
||||
PangoMatrix matrix = PANGO_MATRIX_INIT;
|
||||
PangoContext *context;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *desc;
|
||||
|
||||
cairo_t *cr;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
PangoAttrList *attrs;
|
||||
|
||||
int width = widget->allocation.width;
|
||||
int height = widget->allocation.height;
|
||||
double device_radius;
|
||||
int i;
|
||||
|
||||
/* Create a cairo context and set up a transformation matrix so that the user
|
||||
* space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
|
||||
* [-RADIUS, RADIUS].
|
||||
* We first center, then change the scale. */
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
/* Get the default renderer for the screen, and set it up for drawing */
|
||||
renderer = gdk_pango_renderer_get_default (gtk_widget_get_screen (widget));
|
||||
gdk_pango_renderer_set_drawable (GDK_PANGO_RENDERER (renderer), widget->window);
|
||||
gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (renderer), widget->style->black_gc);
|
||||
|
||||
/* Set up a transformation matrix so that the user space coordinates for
|
||||
* the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
|
||||
* We first center, then change the scale */
|
||||
device_radius = MIN (width, height) / 2.;
|
||||
cairo_translate (cr,
|
||||
device_radius + (width - 2 * device_radius) / 2,
|
||||
device_radius + (height - 2 * device_radius) / 2);
|
||||
cairo_scale (cr, device_radius / RADIUS, device_radius / RADIUS);
|
||||
pango_matrix_translate (&matrix,
|
||||
device_radius + (width - 2 * device_radius) / 2,
|
||||
device_radius + (height - 2 * device_radius) / 2);
|
||||
pango_matrix_scale (&matrix, device_radius / RADIUS, device_radius / RADIUS);
|
||||
|
||||
/* Create and a subtle gradient source and use it. */
|
||||
pattern = cairo_pattern_create_linear (-RADIUS, -RADIUS, RADIUS, RADIUS);
|
||||
cairo_pattern_add_color_stop_rgb (pattern, 0., .5, .0, .0);
|
||||
cairo_pattern_add_color_stop_rgb (pattern, 1., .0, .0, .5);
|
||||
cairo_set_source (cr, pattern);
|
||||
|
||||
/* Create a PangoContext and set up our shape renderer */
|
||||
/* Create a PangoLayout, set the font and text */
|
||||
context = gtk_widget_create_pango_context (widget);
|
||||
pango_cairo_context_set_shape_renderer (context,
|
||||
fancy_shape_renderer,
|
||||
NULL, NULL);
|
||||
|
||||
/* Create a PangoLayout, set the text, font, and attributes */
|
||||
layout = pango_layout_new (context);
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
pango_layout_set_text (layout, "Text", -1);
|
||||
desc = pango_font_description_from_string (FONT);
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
|
||||
attrs = create_fancy_attr_list_for_layout (layout);
|
||||
pango_layout_set_attributes (layout, attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
/* Draw the layout N_WORDS times in a circle */
|
||||
for (i = 0; i < N_WORDS; i++)
|
||||
{
|
||||
GdkColor color;
|
||||
PangoMatrix rotated_matrix = matrix;
|
||||
int width, height;
|
||||
double angle = (360. * i) / N_WORDS;
|
||||
|
||||
/* Inform Pango to re-layout the text with the new transformation matrix */
|
||||
pango_cairo_update_layout (cr, layout);
|
||||
/* Gradient from red at angle == 60 to blue at angle == 300 */
|
||||
color.red = 65535 * (1 + cos ((angle - 60) * G_PI / 180.)) / 2;
|
||||
color.green = 0;
|
||||
color.blue = 65535 - color.red;
|
||||
|
||||
pango_layout_get_pixel_size (layout, &width, &height);
|
||||
cairo_move_to (cr, - width / 2, - RADIUS * .9);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
gdk_pango_renderer_set_override_color (GDK_PANGO_RENDERER (renderer),
|
||||
PANGO_RENDER_PART_FOREGROUND, &color);
|
||||
|
||||
pango_matrix_rotate (&rotated_matrix, angle);
|
||||
|
||||
/* Rotate for the next turn */
|
||||
cairo_rotate (cr, G_PI*2 / N_WORDS);
|
||||
pango_context_set_matrix (context, &rotated_matrix);
|
||||
|
||||
/* Inform Pango to re-layout the text with the new transformation matrix */
|
||||
pango_layout_context_changed (layout);
|
||||
|
||||
pango_layout_get_size (layout, &width, &height);
|
||||
pango_renderer_draw_layout (renderer, layout,
|
||||
- width / 2, - RADIUS * PANGO_SCALE);
|
||||
}
|
||||
|
||||
/* Clean up default renderer, since it is shared */
|
||||
gdk_pango_renderer_set_override_color (GDK_PANGO_RENDERER (renderer),
|
||||
PANGO_RENDER_PART_FOREGROUND, NULL);
|
||||
gdk_pango_renderer_set_drawable (GDK_PANGO_RENDERER (renderer), NULL);
|
||||
gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (renderer), NULL);
|
||||
|
||||
/* free the objects we created */
|
||||
pango_font_description_free (desc);
|
||||
g_object_unref (layout);
|
||||
g_object_unref (context);
|
||||
cairo_pattern_destroy (pattern);
|
||||
cairo_destroy (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -175,30 +103,21 @@ rotated_text_expose_event (GtkWidget *widget,
|
||||
GtkWidget *
|
||||
do_rotated_text (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *drawing_area;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *drawing_area;
|
||||
GtkWidget *label;
|
||||
PangoLayout *layout;
|
||||
PangoAttrList *attrs;
|
||||
|
||||
const GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_hbox_new (TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
/* Add a drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||
gtk_container_add (GTK_CONTAINER (window), drawing_area);
|
||||
|
||||
/* This overrides the background color from the theme */
|
||||
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &white);
|
||||
@@ -206,24 +125,10 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
g_signal_connect (drawing_area, "expose-event",
|
||||
G_CALLBACK (rotated_text_expose_event), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
gtk_label_set_angle (GTK_LABEL (label), 45);
|
||||
|
||||
/* Set up fancy stuff on the label */
|
||||
layout = gtk_label_get_layout (GTK_LABEL (label));
|
||||
pango_cairo_context_set_shape_renderer (pango_layout_get_context (layout),
|
||||
fancy_shape_renderer,
|
||||
NULL, NULL);
|
||||
attrs = create_fancy_attr_list_for_layout (layout);
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 2 * RADIUS, 2 * RADIUS);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,335 +0,0 @@
|
||||
/* Entry/Search Entry
|
||||
*
|
||||
* GtkEntry allows to display icons and progress information.
|
||||
* This demo shows how to use these features in a search entry.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *menu = NULL;
|
||||
static GtkWidget *notebook = NULL;
|
||||
|
||||
static guint search_progress_id = 0;
|
||||
static guint finish_search_id = 0;
|
||||
|
||||
static void
|
||||
show_find_button (void)
|
||||
{
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
show_cancel_button (void)
|
||||
{
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
search_progress (gpointer data)
|
||||
{
|
||||
gtk_entry_progress_pulse (GTK_ENTRY (data));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
search_progress_done (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_progress_fraction (entry, 0.0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
finish_search (GtkButton *button)
|
||||
{
|
||||
show_find_button ();
|
||||
g_source_remove (search_progress_id);
|
||||
search_progress_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
start_search_feedback (gpointer data)
|
||||
{
|
||||
search_progress_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 100,
|
||||
(GSourceFunc)search_progress, data,
|
||||
(GDestroyNotify)search_progress_done);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
start_search (GtkButton *button,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
show_cancel_button ();
|
||||
search_progress_id = g_timeout_add_seconds (1, (GSourceFunc)start_search_feedback, entry);
|
||||
finish_search_id = g_timeout_add_seconds (15, (GSourceFunc)finish_search, button);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
stop_search (GtkButton *button,
|
||||
gpointer data)
|
||||
{
|
||||
g_source_remove (finish_search_id);
|
||||
finish_search (button);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_entry (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, "");
|
||||
}
|
||||
|
||||
static void
|
||||
search_by_name (GtkWidget *item,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_icon_from_stock (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
GTK_STOCK_FIND);
|
||||
gtk_entry_set_icon_tooltip_text (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
"Search by name\n"
|
||||
"Click here to change the search type");
|
||||
}
|
||||
|
||||
static void
|
||||
search_by_description (GtkWidget *item,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_icon_from_stock (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
GTK_STOCK_EDIT);
|
||||
gtk_entry_set_icon_tooltip_text (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
"Search by description\n"
|
||||
"Click here to change the search type");
|
||||
}
|
||||
|
||||
static void
|
||||
search_by_file (GtkWidget *item,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_icon_from_stock (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
GTK_STOCK_OPEN);
|
||||
gtk_entry_set_icon_tooltip_text (entry,
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
"Search by file name\n"
|
||||
"Click here to change the search type");
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_search_menu (GtkWidget *entry)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
GtkWidget *image;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic ("Search by _name");
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
|
||||
g_signal_connect (item, "activate",
|
||||
G_CALLBACK (search_by_name), entry);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic ("Search by _description");
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
|
||||
g_signal_connect (item, "activate",
|
||||
G_CALLBACK (search_by_description), entry);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic ("Search by _file name");
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
|
||||
g_signal_connect (item, "activate",
|
||||
G_CALLBACK (search_by_file), entry);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
gtk_widget_show_all (menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
static void
|
||||
icon_press_cb (GtkEntry *entry,
|
||||
gint position,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (position == GTK_ENTRY_ICON_PRIMARY)
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
|
||||
event->button, event->time);
|
||||
else
|
||||
clear_entry (entry);
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed_cb (GtkEntry *entry,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
gboolean has_text;
|
||||
|
||||
has_text = gtk_entry_get_text_length (entry) > 0;
|
||||
gtk_entry_set_icon_sensitive (entry,
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
has_text);
|
||||
gtk_widget_set_sensitive (button, has_text);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_cb (GtkEntry *entry,
|
||||
GtkButton *button)
|
||||
{
|
||||
if (search_progress_id != 0)
|
||||
return;
|
||||
|
||||
start_search (button, entry);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
search_entry_destroyed (GtkWidget *widget)
|
||||
{
|
||||
if (finish_search_id != 0)
|
||||
g_source_remove (finish_search_id);
|
||||
|
||||
if (search_progress_id != 0)
|
||||
g_source_remove (search_progress_id);
|
||||
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
entry_populate_popup (GtkEntry *entry,
|
||||
GtkMenu *menu,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *search_menu;
|
||||
gboolean has_text;
|
||||
|
||||
has_text = gtk_entry_get_text_length (entry) > 0;
|
||||
|
||||
item = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic ("C_lear");
|
||||
gtk_widget_show (item);
|
||||
g_signal_connect_swapped (item, "activate",
|
||||
G_CALLBACK (clear_entry), entry);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
gtk_widget_set_sensitive (item, has_text);
|
||||
|
||||
search_menu = create_search_menu (GTK_WIDGET (entry));
|
||||
item = gtk_menu_item_new_with_label ("Search by");
|
||||
gtk_widget_show (item);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), search_menu);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_search_entry (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *find_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("Search Entry",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
GTK_STOCK_CLOSE,
|
||||
GTK_RESPONSE_NONE,
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (search_entry_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
|
||||
|
||||
/* Create our entry */
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the find and cancel buttons */
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
|
||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, FALSE, FALSE, 0);
|
||||
|
||||
find_button = gtk_button_new_with_label ("Find");
|
||||
g_signal_connect (find_button, "clicked",
|
||||
G_CALLBACK (start_search), entry);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), find_button, NULL);
|
||||
gtk_widget_show (find_button);
|
||||
|
||||
cancel_button = gtk_button_new_with_label ("Cancel");
|
||||
g_signal_connect (cancel_button, "clicked",
|
||||
G_CALLBACK (stop_search), NULL);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), cancel_button, NULL);
|
||||
gtk_widget_show (cancel_button);
|
||||
|
||||
/* Set up the search icon */
|
||||
search_by_name (NULL, GTK_ENTRY (entry));
|
||||
|
||||
/* Set up the clear icon */
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
GTK_STOCK_CLEAR);
|
||||
text_changed_cb (GTK_ENTRY (entry), NULL, find_button);
|
||||
|
||||
g_signal_connect (entry, "icon-press",
|
||||
G_CALLBACK (icon_press_cb), NULL);
|
||||
g_signal_connect (entry, "notify::text",
|
||||
G_CALLBACK (text_changed_cb), find_button);
|
||||
g_signal_connect (entry, "activate",
|
||||
G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
/* Create the menu */
|
||||
menu = create_search_menu (entry);
|
||||
gtk_menu_attach_to_widget (GTK_MENU (menu), entry, NULL);
|
||||
|
||||
/* add accessible alternatives for icon functionality */
|
||||
g_signal_connect (entry, "populate-popup",
|
||||
G_CALLBACK (entry_populate_popup), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (menu);
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -158,7 +158,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
G_CALLBACK (toggle_grouping), size_group);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
@@ -1,94 +0,0 @@
|
||||
/* Spinner
|
||||
*
|
||||
* GtkSpinner allows to show that background activity is on-going.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *spinner_sensitive = NULL;
|
||||
static GtkWidget *spinner_unsensitive = NULL;
|
||||
|
||||
static void
|
||||
on_play_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_spinner_start (GTK_SPINNER (spinner_sensitive));
|
||||
gtk_spinner_start (GTK_SPINNER (spinner_unsensitive));
|
||||
}
|
||||
|
||||
static void
|
||||
on_stop_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_spinner_stop (GTK_SPINNER (spinner_sensitive));
|
||||
gtk_spinner_stop (GTK_SPINNER (spinner_unsensitive));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_spinner (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *spinner;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkSpinner",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
GTK_STOCK_CLOSE,
|
||||
GTK_RESPONSE_NONE,
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
/* Sensitive */
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
spinner = gtk_spinner_new ();
|
||||
gtk_container_add (GTK_CONTAINER (hbox), spinner);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
spinner_sensitive = spinner;
|
||||
|
||||
/* Disabled */
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
spinner = gtk_spinner_new ();
|
||||
gtk_container_add (GTK_CONTAINER (hbox), spinner);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
spinner_unsensitive = spinner;
|
||||
gtk_widget_set_sensitive (hbox, FALSE);
|
||||
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (on_play_clicked), spinner);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), button);
|
||||
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (on_stop_clicked), spinner);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), button);
|
||||
|
||||
/* Start by default to test for:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=598496 */
|
||||
on_play_clicked (NULL, NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@@ -532,7 +532,7 @@ do_stock_browser (GtkWidget *do_widget)
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
@@ -1,200 +0,0 @@
|
||||
/* Text Widget/Automatic scrolling
|
||||
*
|
||||
* This example demonstrates how to use the gravity of
|
||||
* GtkTextMarks to keep a text view scrolled to the bottom
|
||||
* while appending text.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo-common.h"
|
||||
|
||||
/* Scroll to the end of the buffer.
|
||||
*/
|
||||
static gboolean
|
||||
scroll_to_end (GtkTextView *textview)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
GtkTextMark *mark;
|
||||
char *spaces;
|
||||
static int count;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (textview);
|
||||
|
||||
/* Get "end" mark. It's located at the end of buffer because
|
||||
* of right gravity
|
||||
*/
|
||||
mark = gtk_text_buffer_get_mark (buffer, "end");
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
|
||||
|
||||
/* and insert some text at its position, the iter will be
|
||||
* revalidated after insertion to point to the end of inserted text
|
||||
*/
|
||||
spaces = g_strnfill (count++, ' ');
|
||||
gtk_text_buffer_insert (buffer, &iter, "\n", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter, spaces, -1);
|
||||
gtk_text_buffer_insert (buffer, &iter,
|
||||
"Scroll to end scroll to end scroll "
|
||||
"to end scroll to end ",
|
||||
-1);
|
||||
g_free (spaces);
|
||||
|
||||
/* Now scroll the end mark onscreen.
|
||||
*/
|
||||
gtk_text_view_scroll_mark_onscreen (textview, mark);
|
||||
|
||||
/* Emulate typewriter behavior, shift to the left if we
|
||||
* are far enough to the right.
|
||||
*/
|
||||
if (count > 150)
|
||||
count = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Scroll to the bottom of the buffer.
|
||||
*/
|
||||
static gboolean
|
||||
scroll_to_bottom (GtkTextView *textview)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
GtkTextMark *mark;
|
||||
char *spaces;
|
||||
static int count;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (textview);
|
||||
|
||||
/* Get end iterator */
|
||||
gtk_text_buffer_get_end_iter (buffer, &iter);
|
||||
|
||||
/* and insert some text at it, the iter will be revalidated
|
||||
* after insertion to point to the end of inserted text
|
||||
*/
|
||||
spaces = g_strnfill (count++, ' ');
|
||||
gtk_text_buffer_insert (buffer, &iter, "\n", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter, spaces, -1);
|
||||
gtk_text_buffer_insert (buffer, &iter,
|
||||
"Scroll to bottom scroll to bottom scroll "
|
||||
"to bottom scroll to bottom",
|
||||
-1);
|
||||
g_free (spaces);
|
||||
|
||||
/* Move the iterator to the beginning of line, so we don't scroll
|
||||
* in horizontal direction
|
||||
*/
|
||||
gtk_text_iter_set_line_offset (&iter, 0);
|
||||
|
||||
/* and place the mark at iter. the mark will stay there after we
|
||||
* insert some text at the end because it has right gravity.
|
||||
*/
|
||||
mark = gtk_text_buffer_get_mark (buffer, "scroll");
|
||||
gtk_text_buffer_move_mark (buffer, mark, &iter);
|
||||
|
||||
/* Scroll the mark onscreen.
|
||||
*/
|
||||
gtk_text_view_scroll_mark_onscreen (textview, mark);
|
||||
|
||||
/* Shift text back if we got enough to the right.
|
||||
*/
|
||||
if (count > 40)
|
||||
count = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint
|
||||
setup_scroll (GtkTextView *textview,
|
||||
gboolean to_end)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (textview);
|
||||
gtk_text_buffer_get_end_iter (buffer, &iter);
|
||||
|
||||
if (to_end)
|
||||
{
|
||||
/* If we want to scroll to the end, including horizontal scrolling,
|
||||
* then we just create a mark with right gravity at the end of the
|
||||
* buffer. It will stay at the end unless explicitely moved with
|
||||
* gtk_text_buffer_move_mark.
|
||||
*/
|
||||
gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
|
||||
|
||||
/* Add scrolling timeout. */
|
||||
return g_timeout_add (50, (GSourceFunc) scroll_to_end, textview);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If we want to scroll to the bottom, but not scroll horizontally,
|
||||
* then an end mark won't do the job. Just create a mark so we can
|
||||
* use it with gtk_text_view_scroll_mark_onscreen, we'll position it
|
||||
* explicitely when needed. Use left gravity so the mark stays where
|
||||
* we put it after inserting new text.
|
||||
*/
|
||||
gtk_text_buffer_create_mark (buffer, "scroll", &iter, TRUE);
|
||||
|
||||
/* Add scrolling timeout. */
|
||||
return g_timeout_add (100, (GSourceFunc) scroll_to_bottom, textview);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_timeout (GtkWidget *window,
|
||||
gpointer timeout)
|
||||
{
|
||||
g_source_remove (GPOINTER_TO_UINT (timeout));
|
||||
}
|
||||
|
||||
static void
|
||||
create_text_view (GtkWidget *hbox,
|
||||
gboolean to_end)
|
||||
{
|
||||
GtkWidget *swindow;
|
||||
GtkWidget *textview;
|
||||
guint timeout;
|
||||
|
||||
swindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0);
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (swindow), textview);
|
||||
|
||||
timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
|
||||
|
||||
/* Remove the timeout in destroy handler, so we don't try to
|
||||
* scroll destroyed widget.
|
||||
*/
|
||||
g_signal_connect (textview, "destroy",
|
||||
G_CALLBACK (remove_timeout),
|
||||
GUINT_TO_POINTER (timeout));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_textscroll (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
create_text_view (hbox, TRUE);
|
||||
create_text_view (hbox, FALSE);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
@@ -155,7 +155,7 @@ insert_text (GtkTextBuffer *buffer)
|
||||
GtkTextChildAnchor *anchor;
|
||||
char *filename;
|
||||
|
||||
/* demo_find_file() looks in the current directory first,
|
||||
/* demo_find_file() looks in the the current directory first,
|
||||
* so you can run gtk-demo without installing GTK, then looks
|
||||
* in the location where the file is installed.
|
||||
*/
|
||||
@@ -350,7 +350,7 @@ insert_text (GtkTextBuffer *buffer)
|
||||
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
|
||||
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text, tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1);
|
||||
gtk_text_buffer_insert (buffer, &iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text (doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1);
|
||||
|
||||
/* Apply word_wrap tag to whole buffer */
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
@@ -500,7 +500,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_widget_show_all (vpaned);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
@@ -549,7 +549,6 @@ easter_egg_callback (GtkWidget *button,
|
||||
gpointer data)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
gpointer window_ptr;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *view;
|
||||
GtkTextIter iter;
|
||||
@@ -587,8 +586,8 @@ easter_egg_callback (GtkWidget *button,
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
window_ptr = &window;
|
||||
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
|
||||
g_object_add_weak_pointer (G_OBJECT (window),
|
||||
(gpointer *) &window);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
|
||||
|
||||
|
@@ -1,795 +0,0 @@
|
||||
/* Tool Palette
|
||||
*
|
||||
* A tool palette widget shows groups of toolbar items as a grid of icons
|
||||
* or a list of names.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "config.h"
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void load_stock_items (GtkToolPalette *palette);
|
||||
static void load_toggle_items (GtkToolPalette *palette);
|
||||
static void load_special_items (GtkToolPalette *palette);
|
||||
|
||||
typedef struct _CanvasItem CanvasItem;
|
||||
|
||||
struct _CanvasItem
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gdouble x, y;
|
||||
};
|
||||
|
||||
static CanvasItem *drop_item = NULL;
|
||||
static GList *canvas_items = NULL;
|
||||
|
||||
/********************************/
|
||||
/* ====== Canvas drawing ====== */
|
||||
/********************************/
|
||||
|
||||
static CanvasItem*
|
||||
canvas_item_new (GtkWidget *widget,
|
||||
GtkToolButton *button,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
CanvasItem *item = NULL;
|
||||
const gchar *stock_id;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
stock_id = gtk_tool_button_get_stock_id (button);
|
||||
pixbuf = gtk_widget_render_icon (widget, stock_id, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
item = g_slice_new0 (CanvasItem);
|
||||
item->pixbuf = pixbuf;
|
||||
item->x = x;
|
||||
item->y = y;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
static void
|
||||
canvas_item_free (CanvasItem *item)
|
||||
{
|
||||
g_object_unref (item->pixbuf);
|
||||
g_slice_free (CanvasItem, item);
|
||||
}
|
||||
|
||||
static void
|
||||
canvas_item_draw (const CanvasItem *item,
|
||||
cairo_t *cr,
|
||||
gboolean preview)
|
||||
{
|
||||
gdouble cx = gdk_pixbuf_get_width (item->pixbuf);
|
||||
gdouble cy = gdk_pixbuf_get_height (item->pixbuf);
|
||||
|
||||
gdk_cairo_set_source_pixbuf (cr,
|
||||
item->pixbuf,
|
||||
item->x - cx * 0.5,
|
||||
item->y - cy * 0.5);
|
||||
|
||||
if (preview)
|
||||
cairo_paint_with_alpha (cr, 0.6);
|
||||
else
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
canvas_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
cairo_t *cr;
|
||||
GList *iter;
|
||||
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
gdk_cairo_region (cr, event->region);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_rectangle (cr, 0, 0, widget->allocation.width, widget->allocation.height);
|
||||
cairo_fill (cr);
|
||||
|
||||
for (iter = canvas_items; iter; iter = iter->next)
|
||||
canvas_item_draw (iter->data, cr, FALSE);
|
||||
|
||||
if (drop_item)
|
||||
canvas_item_draw (drop_item, cr, TRUE);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************/
|
||||
/* ====== Palette DnD ====== */
|
||||
/*****************************/
|
||||
|
||||
static void
|
||||
palette_drop_item (GtkToolItem *drag_item,
|
||||
GtkToolItemGroup *drop_group,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GtkWidget *drag_group = gtk_widget_get_parent (GTK_WIDGET (drag_item));
|
||||
GtkToolItem *drop_item = gtk_tool_item_group_get_drop_item (drop_group, x, y);
|
||||
gint drop_position = -1;
|
||||
|
||||
if (drop_item)
|
||||
drop_position = gtk_tool_item_group_get_item_position (GTK_TOOL_ITEM_GROUP (drop_group), drop_item);
|
||||
|
||||
if (GTK_TOOL_ITEM_GROUP (drag_group) != drop_group)
|
||||
{
|
||||
gboolean homogeneous, expand, fill, new_row;
|
||||
|
||||
g_object_ref (drag_item);
|
||||
gtk_container_child_get (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item),
|
||||
"homogeneous", &homogeneous,
|
||||
"expand", &expand,
|
||||
"fill", &fill,
|
||||
"new-row", &new_row,
|
||||
NULL);
|
||||
gtk_container_remove (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item));
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (drop_group),
|
||||
drag_item, drop_position);
|
||||
gtk_container_child_set (GTK_CONTAINER (drop_group), GTK_WIDGET (drag_item),
|
||||
"homogeneous", homogeneous,
|
||||
"expand", expand,
|
||||
"fill", fill,
|
||||
"new-row", new_row,
|
||||
NULL);
|
||||
g_object_unref (drag_item);
|
||||
}
|
||||
else
|
||||
gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (drop_group),
|
||||
drag_item, drop_position);
|
||||
}
|
||||
|
||||
static void
|
||||
palette_drop_group (GtkToolPalette *palette,
|
||||
GtkToolItemGroup *drag_group,
|
||||
GtkToolItemGroup *drop_group)
|
||||
{
|
||||
gint drop_position = -1;
|
||||
|
||||
if (drop_group)
|
||||
drop_position = gtk_tool_palette_get_group_position (palette, drop_group);
|
||||
|
||||
gtk_tool_palette_set_group_position (palette, drag_group, drop_position);
|
||||
}
|
||||
|
||||
static void
|
||||
palette_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GtkToolItemGroup *drop_group = NULL;
|
||||
GtkWidget *drag_palette = gtk_drag_get_source_widget (context);
|
||||
GtkWidget *drag_item = NULL;
|
||||
|
||||
while (drag_palette && !GTK_IS_TOOL_PALETTE (drag_palette))
|
||||
drag_palette = gtk_widget_get_parent (drag_palette);
|
||||
|
||||
if (drag_palette)
|
||||
{
|
||||
drag_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (drag_palette),
|
||||
selection);
|
||||
drop_group = gtk_tool_palette_get_drop_group (GTK_TOOL_PALETTE (widget),
|
||||
x, y);
|
||||
}
|
||||
|
||||
if (GTK_IS_TOOL_ITEM_GROUP (drag_item))
|
||||
palette_drop_group (GTK_TOOL_PALETTE (drag_palette),
|
||||
GTK_TOOL_ITEM_GROUP (drag_item),
|
||||
drop_group);
|
||||
else if (GTK_IS_TOOL_ITEM (drag_item) && drop_group)
|
||||
palette_drop_item (GTK_TOOL_ITEM (drag_item),
|
||||
drop_group,
|
||||
x - GTK_WIDGET (drop_group)->allocation.x,
|
||||
y - GTK_WIDGET (drop_group)->allocation.y);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
/* ====== Passive Canvas ====== */
|
||||
/********************************/
|
||||
|
||||
static void
|
||||
passive_canvas_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
/* find the tool button, which is the source of this DnD operation */
|
||||
|
||||
GtkWidget *palette = gtk_drag_get_source_widget (context);
|
||||
CanvasItem *canvas_item = NULL;
|
||||
GtkWidget *tool_item = NULL;
|
||||
|
||||
while (palette && !GTK_IS_TOOL_PALETTE (palette))
|
||||
palette = gtk_widget_get_parent (palette);
|
||||
|
||||
if (palette)
|
||||
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
|
||||
selection);
|
||||
|
||||
g_assert (NULL == drop_item);
|
||||
|
||||
/* append a new canvas item when a tool button was found */
|
||||
|
||||
if (GTK_IS_TOOL_ITEM (tool_item))
|
||||
canvas_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
|
||||
|
||||
if (canvas_item)
|
||||
{
|
||||
canvas_items = g_list_append (canvas_items, canvas_item);
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************/
|
||||
/* ====== Interactive Canvas ====== */
|
||||
/************************************/
|
||||
|
||||
static gboolean
|
||||
interactive_canvas_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
if (drop_item)
|
||||
{
|
||||
/* already have a drop indicator - just update position */
|
||||
|
||||
drop_item->x = x;
|
||||
drop_item->y = y;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
gdk_drag_status (context, GDK_ACTION_COPY, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* request DnD data for creating a drop indicator */
|
||||
|
||||
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
|
||||
|
||||
if (!target)
|
||||
return FALSE;
|
||||
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
interactive_canvas_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
|
||||
{
|
||||
/* find the tool button which is the source of this DnD operation */
|
||||
|
||||
GtkWidget *palette = gtk_drag_get_source_widget (context);
|
||||
GtkWidget *tool_item = NULL;
|
||||
|
||||
while (palette && !GTK_IS_TOOL_PALETTE (palette))
|
||||
palette = gtk_widget_get_parent (palette);
|
||||
|
||||
if (palette)
|
||||
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
|
||||
selection);
|
||||
|
||||
/* create a drop indicator when a tool button was found */
|
||||
|
||||
g_assert (NULL == drop_item);
|
||||
|
||||
if (GTK_IS_TOOL_ITEM (tool_item))
|
||||
{
|
||||
drop_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
|
||||
gdk_drag_status (context, GDK_ACTION_COPY, time);
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
interactive_canvas_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
if (drop_item)
|
||||
{
|
||||
/* turn the drop indicator into a real canvas item */
|
||||
|
||||
drop_item->x = x;
|
||||
drop_item->y = y;
|
||||
|
||||
canvas_items = g_list_append (canvas_items, drop_item);
|
||||
drop_item = NULL;
|
||||
|
||||
/* signal the item was accepted and redraw */
|
||||
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
interactive_canvas_real_drag_leave (gpointer data)
|
||||
{
|
||||
if (drop_item)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (data);
|
||||
|
||||
canvas_item_free (drop_item);
|
||||
drop_item = NULL;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
interactive_canvas_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
/* defer cleanup until a potential "drag-drop" signal was received */
|
||||
g_idle_add (interactive_canvas_real_drag_leave, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
on_combo_orientation_changed (GtkComboBox *combo_box,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
|
||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW (GTK_WIDGET (palette)->parent);
|
||||
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
|
||||
GtkTreeIter iter;
|
||||
gint val = 0;
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get (model, &iter, 1, &val, -1);
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
|
||||
|
||||
if (val == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_scrolled_window_set_policy (sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
else
|
||||
gtk_scrolled_window_set_policy (sw, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
}
|
||||
|
||||
static void
|
||||
on_combo_style_changed (GtkComboBox *combo_box,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
|
||||
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
|
||||
GtkTreeIter iter;
|
||||
gint val = 0;
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get (model, &iter, 1, &val, -1);
|
||||
|
||||
if (val == -1)
|
||||
gtk_tool_palette_unset_style (palette);
|
||||
else
|
||||
gtk_tool_palette_set_style (palette, val);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_toolpalette (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *box = NULL;
|
||||
GtkWidget *hbox = NULL;
|
||||
GtkWidget *combo_orientation = NULL;
|
||||
GtkListStore *orientation_model = NULL;
|
||||
GtkWidget *combo_style = NULL;
|
||||
GtkListStore *style_model = NULL;
|
||||
GtkCellRenderer *cell_renderer = NULL;
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *palette = NULL;
|
||||
GtkWidget *palette_scroller = NULL;
|
||||
GtkWidget *notebook = NULL;
|
||||
GtkWidget *contents = NULL;
|
||||
GtkWidget *contents_scroller = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Tool Palette");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 600);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
/* Add widgets to control the ToolPalette appearance: */
|
||||
box = gtk_vbox_new (FALSE, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
/* Orientation combo box: */
|
||||
orientation_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
|
||||
gtk_list_store_append (orientation_model, &iter);
|
||||
gtk_list_store_set (orientation_model, &iter,
|
||||
0, "Horizontal",
|
||||
1, GTK_ORIENTATION_HORIZONTAL,
|
||||
-1);
|
||||
gtk_list_store_append (orientation_model, &iter);
|
||||
gtk_list_store_set (orientation_model, &iter,
|
||||
0, "Vertical",
|
||||
1, GTK_ORIENTATION_VERTICAL,
|
||||
-1);
|
||||
|
||||
combo_orientation =
|
||||
gtk_combo_box_new_with_model (GTK_TREE_MODEL (orientation_model));
|
||||
cell_renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_orientation),
|
||||
cell_renderer,
|
||||
TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_orientation),
|
||||
cell_renderer,
|
||||
"text", 0,
|
||||
NULL);
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_orientation), &iter);
|
||||
gtk_box_pack_start (GTK_BOX (box), combo_orientation, FALSE, FALSE, 0);
|
||||
|
||||
/* Style combo box: */
|
||||
style_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
|
||||
gtk_list_store_append (style_model, &iter);
|
||||
gtk_list_store_set (style_model, &iter,
|
||||
0, "Text",
|
||||
1, GTK_TOOLBAR_TEXT,
|
||||
-1);
|
||||
gtk_list_store_append (style_model, &iter);
|
||||
gtk_list_store_set (style_model, &iter,
|
||||
0, "Both",
|
||||
1, GTK_TOOLBAR_BOTH,
|
||||
-1);
|
||||
gtk_list_store_append (style_model, &iter);
|
||||
gtk_list_store_set (style_model, &iter,
|
||||
0, "Both: Horizontal",
|
||||
1, GTK_TOOLBAR_BOTH_HORIZ,
|
||||
-1);
|
||||
gtk_list_store_append (style_model, &iter);
|
||||
gtk_list_store_set (style_model, &iter,
|
||||
0, "Icons",
|
||||
1, GTK_TOOLBAR_ICONS,
|
||||
-1);
|
||||
gtk_list_store_append (style_model, &iter);
|
||||
gtk_list_store_set (style_model, &iter,
|
||||
0, "Default",
|
||||
1, -1, /* A custom meaning for this demo. */
|
||||
-1);
|
||||
combo_style = gtk_combo_box_new_with_model (GTK_TREE_MODEL (style_model));
|
||||
cell_renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_style),
|
||||
cell_renderer,
|
||||
TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_style),
|
||||
cell_renderer,
|
||||
"text", 0,
|
||||
NULL);
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_style), &iter);
|
||||
gtk_box_pack_start (GTK_BOX (box), combo_style, FALSE, FALSE, 0);
|
||||
|
||||
/* Add hbox */
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
|
||||
|
||||
/* Add and fill the ToolPalette: */
|
||||
palette = gtk_tool_palette_new ();
|
||||
|
||||
load_stock_items (GTK_TOOL_PALETTE (palette));
|
||||
load_toggle_items (GTK_TOOL_PALETTE (palette));
|
||||
load_special_items (GTK_TOOL_PALETTE (palette));
|
||||
|
||||
palette_scroller = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (palette_scroller),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (palette_scroller), 6);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (palette_scroller), palette);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), palette_scroller);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
|
||||
/* Connect signals: */
|
||||
g_signal_connect (combo_orientation, "changed",
|
||||
G_CALLBACK (on_combo_orientation_changed), palette);
|
||||
g_signal_connect (combo_style, "changed",
|
||||
G_CALLBACK (on_combo_style_changed), palette);
|
||||
|
||||
/* Keep the widgets in sync: */
|
||||
on_combo_orientation_changed (GTK_COMBO_BOX (combo_orientation), palette);
|
||||
|
||||
/* ===== notebook ===== */
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
|
||||
gtk_box_pack_end (GTK_BOX(hbox), notebook, FALSE, FALSE, 0);
|
||||
|
||||
/* ===== DnD for tool items ===== */
|
||||
|
||||
g_signal_connect (palette, "drag-data-received",
|
||||
G_CALLBACK (palette_drag_data_received), NULL);
|
||||
|
||||
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
||||
palette,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GTK_TOOL_PALETTE_DRAG_ITEMS |
|
||||
GTK_TOOL_PALETTE_DRAG_GROUPS,
|
||||
GDK_ACTION_MOVE);
|
||||
|
||||
/* ===== passive DnD dest ===== */
|
||||
|
||||
contents = gtk_drawing_area_new ();
|
||||
gtk_widget_set_app_paintable (contents, TRUE);
|
||||
|
||||
g_object_connect (contents,
|
||||
"signal::expose-event", canvas_expose_event, NULL,
|
||||
"signal::drag-data-received", passive_canvas_drag_data_received, NULL,
|
||||
NULL);
|
||||
|
||||
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
||||
contents,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GTK_TOOL_PALETTE_DRAG_ITEMS,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller),
|
||||
contents);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
contents_scroller,
|
||||
gtk_label_new ("Passive DnD Mode"));
|
||||
|
||||
/* ===== interactive DnD dest ===== */
|
||||
|
||||
contents = gtk_drawing_area_new ();
|
||||
gtk_widget_set_app_paintable (contents, TRUE);
|
||||
|
||||
g_object_connect (contents,
|
||||
"signal::expose-event", canvas_expose_event, NULL,
|
||||
"signal::drag-motion", interactive_canvas_drag_motion, NULL,
|
||||
"signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
|
||||
"signal::drag-leave", interactive_canvas_drag_leave, NULL,
|
||||
"signal::drag-drop", interactive_canvas_drag_drop, NULL,
|
||||
NULL);
|
||||
|
||||
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
||||
contents,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT,
|
||||
GTK_TOOL_PALETTE_DRAG_ITEMS,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_ALWAYS);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller),
|
||||
contents);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller,
|
||||
gtk_label_new ("Interactive DnD Mode"));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
load_stock_items (GtkToolPalette *palette)
|
||||
{
|
||||
GtkWidget *group_af = gtk_tool_item_group_new ("Stock Icons (A-F)");
|
||||
GtkWidget *group_gn = gtk_tool_item_group_new ("Stock Icons (G-N)");
|
||||
GtkWidget *group_or = gtk_tool_item_group_new ("Stock Icons (O-R)");
|
||||
GtkWidget *group_sz = gtk_tool_item_group_new ("Stock Icons (S-Z)");
|
||||
GtkWidget *group = NULL;
|
||||
|
||||
GtkToolItem *item;
|
||||
GSList *stock_ids;
|
||||
GSList *iter;
|
||||
|
||||
stock_ids = gtk_stock_list_ids ();
|
||||
stock_ids = g_slist_sort (stock_ids, (GCompareFunc) strcmp);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (palette), group_af);
|
||||
gtk_container_add (GTK_CONTAINER (palette), group_gn);
|
||||
gtk_container_add (GTK_CONTAINER (palette), group_or);
|
||||
gtk_container_add (GTK_CONTAINER (palette), group_sz);
|
||||
|
||||
for (iter = stock_ids; iter; iter = g_slist_next (iter))
|
||||
{
|
||||
GtkStockItem stock_item;
|
||||
gchar *id = iter->data;
|
||||
|
||||
switch (id[4])
|
||||
{
|
||||
case 'a':
|
||||
group = group_af;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
group = group_gn;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
group = group_or;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
group = group_sz;
|
||||
break;
|
||||
}
|
||||
|
||||
item = gtk_tool_button_new_from_stock (id);
|
||||
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
|
||||
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
|
||||
if (!gtk_stock_lookup (id, &stock_item) || !stock_item.label)
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), id);
|
||||
|
||||
g_free (id);
|
||||
}
|
||||
|
||||
g_slist_free (stock_ids);
|
||||
}
|
||||
|
||||
static void
|
||||
load_toggle_items (GtkToolPalette *palette)
|
||||
{
|
||||
GSList *toggle_group = NULL;
|
||||
GtkToolItem *item;
|
||||
GtkWidget *group;
|
||||
char *label;
|
||||
int i;
|
||||
|
||||
group = gtk_tool_item_group_new ("Radio Item");
|
||||
gtk_container_add (GTK_CONTAINER (palette), group);
|
||||
|
||||
for (i = 1; i <= 10; ++i)
|
||||
{
|
||||
label = g_strdup_printf ("#%d", i);
|
||||
item = gtk_radio_tool_button_new (toggle_group);
|
||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), label);
|
||||
g_free (label);
|
||||
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
toggle_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
||||
}
|
||||
}
|
||||
|
||||
static GtkToolItem *
|
||||
create_entry_item (const char *text)
|
||||
{
|
||||
GtkToolItem *item;
|
||||
GtkWidget *entry;
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (entry), 5);
|
||||
|
||||
item = gtk_tool_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (item), entry);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
static void
|
||||
load_special_items (GtkToolPalette *palette)
|
||||
{
|
||||
GtkToolItem *item;
|
||||
GtkWidget *group;
|
||||
GtkWidget *label_button;
|
||||
|
||||
group = gtk_tool_item_group_new (NULL);
|
||||
label_button = gtk_button_new_with_label ("Advanced Features");
|
||||
gtk_widget_show (label_button);
|
||||
gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group),
|
||||
label_button);
|
||||
gtk_container_add (GTK_CONTAINER (palette), group);
|
||||
|
||||
item = create_entry_item ("homogeneous=FALSE");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
||||
"homogeneous", FALSE, NULL);
|
||||
|
||||
item = create_entry_item ("homogeneous=FALSE, expand=TRUE");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
||||
"homogeneous", FALSE, "expand", TRUE,
|
||||
NULL);
|
||||
|
||||
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
||||
"homogeneous", FALSE, "expand", TRUE,
|
||||
"fill", FALSE, NULL);
|
||||
|
||||
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
||||
"homogeneous", FALSE, "expand", TRUE,
|
||||
"new-row", TRUE, NULL);
|
||||
|
||||
item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);
|
||||
gtk_tool_item_set_tooltip_text (item, "Show on vertical palettes only");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_tool_item_set_visible_horizontal (item, FALSE);
|
||||
|
||||
item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
|
||||
gtk_tool_item_set_tooltip_text (item, "Show on horizontal palettes only");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_tool_item_set_visible_vertical (item, FALSE);
|
||||
|
||||
item = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
|
||||
gtk_tool_item_set_tooltip_text (item, "Do not show at all");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_widget_set_no_show_all (GTK_WIDGET (item), TRUE);
|
||||
|
||||
item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);
|
||||
gtk_tool_item_set_tooltip_text (item, "Expanded this item");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
||||
"homogeneous", FALSE,
|
||||
"expand", TRUE,
|
||||
NULL);
|
||||
|
||||
item = gtk_tool_button_new_from_stock (GTK_STOCK_HELP);
|
||||
gtk_tool_item_set_tooltip_text (item, "A regular item");
|
||||
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
||||
}
|
@@ -438,7 +438,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
{
|
||||
|
@@ -183,12 +183,10 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
|
||||
ui = gtk_ui_manager_new ();
|
||||
gtk_ui_manager_insert_action_group (ui, actions, 0);
|
||||
g_object_unref (actions);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
||||
gtk_ui_manager_get_accel_group (ui));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "UI Manager");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
|
||||
if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, -1, &error))
|
||||
{
|
||||
@@ -221,11 +219,10 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
g_object_unref (ui);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <math.h>
|
||||
@@ -225,7 +225,7 @@ main (int argc, char **argv)
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
timeout_id = gdk_threads_add_timeout (FRAME_DELAY, timeout, NULL);
|
||||
timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
gtk_main ();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -301,7 +301,7 @@ start_progressive_loading (GtkWidget *image)
|
||||
* The timeout simply simulates a slow data source by inserting
|
||||
* pauses in the reading process.
|
||||
*/
|
||||
lc->load_timeout = gdk_threads_add_timeout (100,
|
||||
lc->load_timeout = g_timeout_add (100,
|
||||
progressive_timeout,
|
||||
image);
|
||||
}
|
||||
|
@@ -189,7 +189,6 @@ load_file (const gchar *filename)
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
||||
fclose (file);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -228,7 +227,8 @@ button_press_event_cb (GtkTreeView *tree_view,
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
g_signal_stop_emission_by_name (tree_view, "button-press-event");
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
||||
"button_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -329,8 +329,8 @@ create_tree (void)
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
g_signal_connect (selection, "selection-changed", selection_cb, model);
|
||||
g_signal_connect (tree_view, "button-press-event", G_CALLBACK (button_press_event_cb), model);
|
||||
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
||||
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
@@ -347,8 +347,8 @@ main (int argc, char **argv)
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
@@ -1,161 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define ICC_PROFILE "/usr/share/color/icc/bluish.icc"
|
||||
#define ICC_PROFILE_SIZE 3966
|
||||
|
||||
static gboolean
|
||||
save_image_png (const gchar *filename, GdkPixbuf *pixbuf, GError **error)
|
||||
{
|
||||
gchar *contents = NULL;
|
||||
gchar *contents_encode = NULL;
|
||||
gsize length;
|
||||
gboolean ret;
|
||||
gint len;
|
||||
|
||||
/* get icc file */
|
||||
ret = g_file_get_contents (ICC_PROFILE, &contents, &length, error);
|
||||
if (!ret)
|
||||
goto out;
|
||||
contents_encode = g_base64_encode ((const guchar *) contents, length);
|
||||
ret = gdk_pixbuf_save (pixbuf, filename, "png", error,
|
||||
"tEXt::Software", "Hello my name is dave",
|
||||
"icc-profile", contents_encode,
|
||||
NULL);
|
||||
len = strlen (contents_encode);
|
||||
g_debug ("ICC profile was %i bytes", len);
|
||||
out:
|
||||
g_free (contents);
|
||||
g_free (contents_encode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_image_tiff (const gchar *filename, GdkPixbuf *pixbuf, GError **error)
|
||||
{
|
||||
gchar *contents = NULL;
|
||||
gchar *contents_encode = NULL;
|
||||
gsize length;
|
||||
gboolean ret;
|
||||
gint len;
|
||||
|
||||
/* get icc file */
|
||||
ret = g_file_get_contents (ICC_PROFILE, &contents, &length, error);
|
||||
if (!ret)
|
||||
goto out;
|
||||
contents_encode = g_base64_encode ((const guchar *) contents, length);
|
||||
ret = gdk_pixbuf_save (pixbuf, filename, "tiff", error,
|
||||
"icc-profile", contents_encode,
|
||||
NULL);
|
||||
len = strlen (contents_encode);
|
||||
g_debug ("ICC profile was %i bytes", len);
|
||||
out:
|
||||
g_free (contents);
|
||||
g_free (contents_encode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_image_verify (const gchar *filename, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
const gchar *option;
|
||||
gchar *icc_profile = NULL;
|
||||
gsize len = 0;
|
||||
|
||||
/* load */
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, error);
|
||||
if (pixbuf == NULL)
|
||||
goto out;
|
||||
|
||||
/* check values */
|
||||
option = gdk_pixbuf_get_option (pixbuf, "icc-profile");
|
||||
if (option == NULL) {
|
||||
*error = g_error_new (1, 0, "no profile set");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* decode base64 */
|
||||
icc_profile = (gchar *) g_base64_decode (option, &len);
|
||||
if (len != ICC_PROFILE_SIZE) {
|
||||
*error = g_error_new (1, 0,
|
||||
"profile length invalid, got %" G_GSIZE_FORMAT,
|
||||
len);
|
||||
g_file_set_contents ("error.icc", icc_profile, len, NULL);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* success */
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (pixbuf != NULL)
|
||||
g_object_unref (pixbuf);
|
||||
g_free (icc_profile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GdkWindow *root;
|
||||
GdkPixbuf *pixbuf;
|
||||
gboolean ret;
|
||||
gint retval = 1;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
|
||||
|
||||
root = gdk_get_default_root_window ();
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, 150, 160);
|
||||
|
||||
/* PASS */
|
||||
g_debug ("try to save PNG with a profile");
|
||||
ret = save_image_png ("icc-profile.png", pixbuf, &error);
|
||||
if (!ret) {
|
||||
g_warning ("FAILED: did not save image: %s", error->message);
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* PASS */
|
||||
g_debug ("try to save TIFF with a profile");
|
||||
ret = save_image_tiff ("icc-profile.tiff", pixbuf, &error);
|
||||
if (!ret) {
|
||||
g_warning ("FAILED: did not save image: %s", error->message);
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* PASS */
|
||||
g_debug ("try to load PNG and get color attributes");
|
||||
ret = save_image_verify ("icc-profile.png", &error);
|
||||
if (!ret) {
|
||||
g_warning ("FAILED: did not load image: %s", error->message);
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* PASS */
|
||||
g_debug ("try to load TIFF and get color attributes");
|
||||
ret = save_image_verify ("icc-profile.tiff", &error);
|
||||
if (!ret) {
|
||||
g_warning ("FAILED: did not load image: %s", error->message);
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* success */
|
||||
retval = 0;
|
||||
g_debug ("ALL OKAY!");
|
||||
out:
|
||||
return retval;
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
@@ -66,7 +66,7 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern void pixbuf_init (void);
|
||||
extern void pixbuf_init ();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
|
@@ -72,7 +72,7 @@ save_to_loader (const gchar *buf, gsize count, GError **err, gpointer data)
|
||||
{
|
||||
GdkPixbufLoader *loader = data;
|
||||
|
||||
return gdk_pixbuf_loader_write (loader, (const guchar *)buf, count, err);
|
||||
return gdk_pixbuf_loader_write (loader, buf, count, err);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
@@ -82,7 +82,7 @@ buffer_to_pixbuf (const gchar *buf, gsize count, GError **err)
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
loader = gdk_pixbuf_loader_new ();
|
||||
if (gdk_pixbuf_loader_write (loader, (const guchar *)buf, count, err) &&
|
||||
if (gdk_pixbuf_loader_write (loader, buf, count, err) &&
|
||||
gdk_pixbuf_loader_close (loader, err)) {
|
||||
pixbuf = g_object_ref (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||
g_object_unref (loader);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@@ -17,13 +17,13 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
|
||||
|
||||
#include "test-inline-pixbufs.h"
|
||||
|
||||
@@ -358,11 +358,11 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
static void
|
||||
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
||||
{
|
||||
#if 0
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
|
||||
|
||||
#if 0
|
||||
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
|
||||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
|
||||
gdk_pixbuf_scale (pixbuf, event->width, event->height);
|
||||
@@ -383,7 +383,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
window = g_object_new (gtk_window_get_type (),
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", title ? title : "testrgb",
|
||||
@@ -504,7 +504,7 @@ progressive_updated_callback (GdkPixbufLoader* loader, guint x, guint y, guint w
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
extern void pixbuf_init (void);
|
||||
extern void pixbuf_init ();
|
||||
|
||||
void size_func (GdkPixbufLoader *loader, gint width, gint height, gpointer data)
|
||||
{
|
||||
@@ -628,7 +628,7 @@ main (int argc, char **argv)
|
||||
|
||||
status.readlen = readlen;
|
||||
|
||||
status.timeout = gdk_threads_add_timeout (100, update_timeout, &status);
|
||||
status.timeout = g_timeout_add (100, update_timeout, &status);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
21
docs/.cvsignore
Normal file
21
docs/.cvsignore
Normal file
@@ -0,0 +1,21 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.dvi
|
||||
*.ps
|
||||
*.pg
|
||||
*.ky
|
||||
*.cp
|
||||
*.fn
|
||||
*.tp
|
||||
*.vr
|
||||
*.log
|
||||
*.aux
|
||||
*.toc
|
||||
*.cps
|
||||
*.fns
|
||||
*.vrs
|
||||
html
|
||||
text
|
||||
texinfo.tex
|
||||
gtk-config.1
|
@@ -1,9 +1,8 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = tutorial faq reference tools
|
||||
|
||||
EXTRA_DIST += \
|
||||
EXTRA_DIST = \
|
||||
defsformat.txt \
|
||||
developers.txt \
|
||||
dnd_internals.txt \
|
||||
@@ -19,5 +18,3 @@ EXTRA_DIST += \
|
||||
generation.txt \
|
||||
gtkdocs_fix \
|
||||
RELEASE-HOWTO
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
157
docs/README.linux-fb
Normal file
157
docs/README.linux-fb
Normal file
@@ -0,0 +1,157 @@
|
||||
|
||||
|
||||
|
||||
|
||||
THIS FILE IS OBSOLETE - use docs/reference/gtk/framebuffer.sgml
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
About GtkFB:
|
||||
------------
|
||||
The linux-fb port of Gtk+, also known as GtkFB is an implementation of
|
||||
gdk (and therefor gtk) that runs on the linux framebuffer. It runs in
|
||||
a single process that doesn't need X. It should run most Gtk+ programs
|
||||
without any changes to the source.
|
||||
|
||||
Build requirements:
|
||||
-------------------
|
||||
To run GtkFB programs you will need glib, pango and gtk from cvs
|
||||
HEAD. Make sure you update these at the same time, since changes to
|
||||
glib and pango often forces changes in gtk+. Pango optionally depends
|
||||
on libfribidi, but for normal GtkFB usage that can be ignored.
|
||||
|
||||
You also need freetype 2, I recommend that you use freetype 2.0.1 or
|
||||
later, as there was some problems with freetype-config in 2.0.
|
||||
Make sure that you install freetype before pango, since pango also
|
||||
needs it.
|
||||
Freetype can be found at ftp://ftp.freetype.org
|
||||
|
||||
Hardware requirements:
|
||||
----------------------
|
||||
You need a graphics card with an availible framebuffer driver that can
|
||||
run in 8, 16, 24 or 32 bpp. I use the matroxfb driver, but i.e. vesafb
|
||||
should work too. You also need a supported mouse. Currently supported
|
||||
is ps2 mouse, ms serial mouse and fidmour touchscreen.
|
||||
|
||||
Building and installing:
|
||||
------------------------
|
||||
First build and install glib and pango as usual, in that order.
|
||||
|
||||
Then configure Gtk by running configure (or autogen.sh if running from
|
||||
cvs) with --with-gdktarget=linux-fb.
|
||||
|
||||
Then compile as ususal: make; make install
|
||||
|
||||
Fonts:
|
||||
------
|
||||
Since GtkFB uses freetype 2 to render fonts it can render truetype and
|
||||
postscript type 1 antialiased fonts.
|
||||
|
||||
At startup it scans some directories looking for fonts. By default
|
||||
it looks in $prefix/lib/ft2fonts, and if you want to change this you
|
||||
must add something like:
|
||||
|
||||
[PangoFT2]
|
||||
FontPath = /usr/share/fonts/default/Type1:/usr/share/fonts/default/TrueType
|
||||
|
||||
To your $prefix/etc/pango/pangorc or ~/.pangorc.
|
||||
|
||||
You must also set up font aliases for the fonts Sans, Serif and Monotype.
|
||||
This is done by creating a $prefix/etc/pango/pangoft2.aliases or
|
||||
~/.pangoft2_aliases file. You can also set the name of this file using the
|
||||
key AliasFiles in the PangoFT2 section in pangorc.
|
||||
|
||||
An example of a font alias file for the urw fontset is:
|
||||
sans normal normal normal normal "urw gothic l"
|
||||
serif normal normal normal normal "urw palladio l"
|
||||
monospace normal normal normal normal "nimbus mono l"
|
||||
|
||||
And one using the Windows truetype fonts is:
|
||||
sans normal normal normal normal "arial"
|
||||
serif normal normal normal normal "times new roman"
|
||||
monospace normal normal normal normal "courier new"
|
||||
|
||||
A more detailed example can be found in examples/pangoft2.aliases in the
|
||||
pango distribution.
|
||||
|
||||
Running:
|
||||
--------
|
||||
To run a program you should only need to start it, but there are some
|
||||
things that can cause problems, and some things that can be controlled
|
||||
by environment variables. Try testgtk distributed with gtk+ to test
|
||||
if things work.
|
||||
|
||||
If you use a ps2 mouse, make sure that /dev/psaux is readable and
|
||||
writable.
|
||||
|
||||
Make sure gpm is not running.
|
||||
|
||||
If you don't specify anything GtkFB will start up in the current
|
||||
virtual console in the current resolution and bit-depth. This can be
|
||||
changed by specifying environment variables:
|
||||
|
||||
GDK_VT:
|
||||
unset means open on the current VT.
|
||||
0-9: open on the specified VT. Make sure you have read/write rights
|
||||
there.
|
||||
new: Allocate a new VT after the last currently used one.
|
||||
|
||||
GDK_DISPLAY_MODE:
|
||||
Specifies the name of a mode in /etc/fb.modes that you want to use.
|
||||
|
||||
GDK_DISPLAY_DEPTH:
|
||||
Specify the desired bit depth of the framebuffer.
|
||||
|
||||
GDK_DISPLAY_WIDTH:
|
||||
Specify the desired width of the framebuffer.
|
||||
|
||||
GDK_DISPLAY_HEIGHT:
|
||||
Specify the desired height of the framebuffer.
|
||||
|
||||
GDK_DISPLAY:
|
||||
Specify the framebuffer device to use. Default is /dev/fb0
|
||||
|
||||
GDK_MOUSE_TYPE:
|
||||
Specify mouse type. Currently supported is:
|
||||
ps2 - PS/2 mouse
|
||||
imps2 - PS/2 intellimouse (wheelmouse)
|
||||
ms - Microsoft serial mouse
|
||||
fidmour - touch screen
|
||||
Default is ps2.
|
||||
|
||||
GDK_KEYBOARD_TYPE:
|
||||
Specify keyboard type. Currently suppored is
|
||||
xlate - normal tty mode keyboard.
|
||||
Quite limited, cannot detect key up/key down events. Doesn't
|
||||
handle ctrl/alt/shift for all keys. This is the default driver,
|
||||
but should not be used in "production" use.
|
||||
raw - read from the tty in RAW mode.
|
||||
Sets the keyboard in RAW mode and handles all the keycodes. This
|
||||
gives correct handling of modifiers and key up/down events. You
|
||||
must be root to use this. If you use this for development or
|
||||
debugging it is recommended to enable magic sysrq handling in the
|
||||
kernel. Then you can use ALT-SysRQ-r to turn the keyboard back to
|
||||
normal mode.
|
||||
Default is xlate.
|
||||
|
||||
HACKING:
|
||||
--------
|
||||
|
||||
Pressing Ctrl-Alt-Return repaints the whole screen.
|
||||
Unfortunately this cannot be pressed when using the xlate keyboard
|
||||
driver, so instead you can use shift-F1 instead when using this
|
||||
driver.
|
||||
|
||||
Pressing Ctrl-Alt-BackSpace kills the GtkFB program. (Can't be pressed
|
||||
in the xlate driver.
|
||||
|
||||
More to be written.
|
||||
|
||||
- Alexander Larsson <alexl@redhat.com>
|
||||
2000/12/06
|
||||
|
||||
|
@@ -1,108 +1,45 @@
|
||||
How to do a GTK+ release?
|
||||
=========================
|
||||
|
||||
Make sure you have suitable versions of autoconf and libtool.
|
||||
Make sure you have Owen's special autoconf and libtool RPMs, available at:
|
||||
http://people.redhat.com/otaylor/gtk/autotools/.
|
||||
|
||||
Also make sure you have the following packages installed with all their
|
||||
dependencies:
|
||||
dependencies (I used the RPM package names from RedHat 9):
|
||||
* gtk-doc
|
||||
* linuxdoc-tools
|
||||
* docbook-utils
|
||||
|
||||
Without those packages make distcheck will *not* pass.
|
||||
Make sure that gtk-doc is the latest released version.
|
||||
|
||||
|
||||
0) Go back to a pristine working directory. With git, this works:
|
||||
|
||||
git clean -f -x
|
||||
|
||||
1) autogen and build it, make sure to enable docs by specifying
|
||||
--enable-gtk-doc --enable-man
|
||||
|
||||
2) Update NEWS based on the content of git log; follow the format
|
||||
of prior entries. This includes finding noteworthy new features,
|
||||
collecting summaries for all the fixed bugs that are referenced
|
||||
and collecting all updated translations.
|
||||
Also collect the names of all contributors that are mentioned.
|
||||
We don't discriminate between bug reporters, patch writers,
|
||||
committers, etc. Anybody who is mentioned in ChangeLog gets
|
||||
credits, but only real names, not email addresses or nicknames.
|
||||
|
||||
3) In particular, if this is a major, stable, release, verify that
|
||||
README.in contains the relevant release notes and that the
|
||||
required versions of dependencies in INSTALL.in are in sync
|
||||
with configure.in.
|
||||
|
||||
4) Verify that the version in configure.in has been bumped after the last
|
||||
release. (Note that this is critical, a slip-up here will cause the
|
||||
soname to change).
|
||||
|
||||
5) Make sure that make check is happy (If you don't do it here, make distcheck
|
||||
will also catch it, but it is kind of disheartening to see make distcheck
|
||||
fail due to an extraneous symbol after watching it build the docs for an
|
||||
hour...).
|
||||
Typical problems to expect here (depending on whether this is a devel
|
||||
snapshot or a stable release):
|
||||
* forgotten source files
|
||||
* new symbols missing from .symbols files
|
||||
* symbols that are exported by should be private (static or _-prefixed)
|
||||
* symbols that cause PLT entries. This is either caused by using
|
||||
a in the same library function without including the header or by
|
||||
using a function from a different library, which is not yet allowed
|
||||
by the filter in pltcheck.sh
|
||||
|
||||
6) If this is a devel release, make sure that the docs for new symbols
|
||||
are in good shape. Look at the -unused.txt files and add stuff found
|
||||
there to the corresponding -sections.txt file. Look at the
|
||||
-undocumented.txt files and see if there is anything in there that
|
||||
should be documented. If it is, this may be due to typos in the doc
|
||||
comments in the source. Make sure that all new symbols have proper
|
||||
Since: tags, and that there is an index in the main -docs.sgml for
|
||||
the next stable version.
|
||||
|
||||
7) make distcheck
|
||||
|
||||
8) Fix broken stuff found by 7), repeat
|
||||
|
||||
9) Commit all changes: git commit -a. You will have a bunch of po file
|
||||
changes, NEWS and maybe some doc changes too
|
||||
|
||||
10) Now you've got the tarball. Check that the tarball size looks
|
||||
reasonable compared to previous releases. If the size goes down
|
||||
a lot, likely the docs went missing for some reason. Or the translations.
|
||||
If the size goes up by a lot, something else may be wrong.
|
||||
|
||||
11) Tag the release. The git command for doing that looks like
|
||||
|
||||
git tag -m "GTK+ 2.12.10" 2.12.10
|
||||
|
||||
12) Push the tagged commit upstream. The git command for doing that is
|
||||
|
||||
git push origin refs/tags/2.12.10
|
||||
|
||||
13) Bump the version number in configure.in and commit and push this change
|
||||
|
||||
14) Upload the tarball to master.gnome.org and run install-module to transfer
|
||||
it to download.gnome.org. If you don't have an account on master.gnome.org,
|
||||
find someone who can do it for you. The command for this looks like
|
||||
|
||||
scp gtk+-2.12.10.tar.gz matthiasc@master.gnome.org:
|
||||
ssh matthiasc@master.gnome.org
|
||||
install-module gtk+-2.12.10.tar.gz
|
||||
|
||||
15) Get the .bz2 tarball and the .md5sum files back from master.gnome.org
|
||||
You can probably also create it locally, but I've experienced md5
|
||||
mismatches when doing so.
|
||||
|
||||
16) Upload the .gz and .bz2 tarballs and checksums to ftp.gtk.org and put
|
||||
them in the right directory below /ftp/pub. Pay attention to correct
|
||||
ownership, and don't forget to update the LATEST file in the directory.
|
||||
|
||||
17) Go to the gnome-announce list archives, find the last announce message,
|
||||
create a new message in the same form, replacing version numbers,
|
||||
commentary at the top about "what this release is about" and the
|
||||
summary of changes.
|
||||
|
||||
18) Send it to gnome-announce-list, gtk-list, gtk-app-devel-list and
|
||||
gtk-devel-list. Set reply-to to desktop-devel-list.
|
||||
|
||||
19) Add a link to the release announcement to www.gtk.org which lives
|
||||
in the gtk-web git module.
|
||||
0) Blow away your gtk+ directory, check a new version out
|
||||
1) autogen and build it, make sure to enable docs.
|
||||
2) Update NEWS based on the various ChangeLog files
|
||||
3) Verify that the version in configure.in has been bumped after the last
|
||||
release. (Note that this is critical, a slip-up here will cause the soname
|
||||
to change).
|
||||
4) Make sure that make check is happy (If you don't do it here, make distcheck
|
||||
will also catch it, but it is kind of disheartening to see make distcheck fail
|
||||
due to an extraneous symbol after watching it build the docs for an hour...)
|
||||
5) Add === Released 2.x.y === at the top of all ChangeLog files
|
||||
6) make distcheck
|
||||
7) Fix broken stuff found by 5) repeat
|
||||
8) cvs commit; you'll have a bunch of po file changes, and maybe some
|
||||
doc changes too (NOTE: be sure to use cvs with compression, else you'll
|
||||
end up waiting for a long time :).
|
||||
9) If 7) fails because someone else committed inbetween, curse, cvs up,
|
||||
fix conflicts and go to 5)
|
||||
10) type 'cvs tag GTK_2_x_y' in the toplevel directory
|
||||
11) You now have the tarball, and the CVS tag, now upload the tarball to
|
||||
gnome.org and gtk.org
|
||||
12) Go to the gnome-announce list archives, find the last announce message,
|
||||
create a new message in the same form, replacing version numbers, commentary
|
||||
at the top about "what this release is about" and the Summary of changes.
|
||||
13) Send it to gnome-announce-list, gtk-list, gtk-app-devel-list and
|
||||
gtk-devel-list. Set reply-to to gnome-hackers.
|
||||
14) Bump the version number in configure.in.
|
||||
15) Create a new milestone in bugzilla and move the remaining bugs from the
|
||||
2.x.y milestone over to the new one.
|
||||
16) Add a link to the release announcement to www.gtk.org which lives in
|
||||
the gtk-web cvs module.
|
||||
|
@@ -6,7 +6,7 @@ programming for/with Gtk, having the spirit of a developers FAQ.
|
||||
It is also the correct place to list up things that programmers should
|
||||
care about in general.
|
||||
|
||||
In the hope that this text might be useful to someone,
|
||||
In the hope that this text might be usefull to someone,
|
||||
|
||||
- Tim Janik <timj@gimp.org>
|
||||
1998/02/11
|
||||
@@ -43,16 +43,25 @@ GDK_SELECTION_CLEAR GtkWidget::selection_clear_event
|
||||
GDK_FOCUS_CHANGE GtkWidget::focus_in_event
|
||||
GtkWidget::focus_out_event
|
||||
|
||||
Events that are assured to have a valid GdkEvent.any.window field are
|
||||
Events that are asured to have a valid GdkEvent.any.window field are
|
||||
|
||||
GDK_EXPOSE GtkWidget::expose_event
|
||||
|
||||
|
||||
gtk_widget_ref() vs. gtk_object_ref()
|
||||
-------------------------------------
|
||||
|
||||
The widget referencing functions gtk_widget_ref() and gtk_widget_unref()
|
||||
are currently just wrappers about the corresponding referencing functions
|
||||
for objects. Still you should use the widget referencing functions if you
|
||||
are sure the referenced object is of type GTK_WIDGET_TYPE.
|
||||
|
||||
|
||||
Writing Gdk functions
|
||||
---------------------
|
||||
|
||||
When writing Gdk functions that operate on GdkWindow structures in any
|
||||
meaningful sense, that is casting to a GdkWindowPrivate structure for
|
||||
maeningfull sense, that is casting to a GdkWindowPrivate structure for
|
||||
access to fields other then GdkWindow.user_data, the programmer is
|
||||
recommended to check for the GdkWindowPrivate.destroyed field to be ==
|
||||
FALSE, especially if the GdkWindowPrivate.xwindow field is used.
|
||||
|
@@ -62,6 +62,8 @@ used by anything other than the DND code in GTK+.
|
||||
/* Drag and Drop */
|
||||
|
||||
GdkDragContext * gdk_drag_context_new (void);
|
||||
void gdk_drag_context_ref (GdkDragContext *context);
|
||||
void gdk_drag_context_unref (GdkDragContext *context);
|
||||
|
||||
These create and refcount GdkDragContexts in a
|
||||
straightforward manner.
|
||||
@@ -110,7 +112,7 @@ Retrieves the selection that will be used to communicate
|
||||
the data for the drag context (valid on both source
|
||||
and dest sides)
|
||||
|
||||
Cursors and window hierarchies
|
||||
Cursors and window heirarchies
|
||||
==============================
|
||||
|
||||
The DND code, when possible (and it isn't possible over
|
||||
@@ -121,7 +123,7 @@ the cursor is in _ourselves_ so we can ignore the
|
||||
drag icon properly. (Oh for OutputOnly windows!)
|
||||
|
||||
To avoid obscene amounts of server traffic (which are only
|
||||
slightly observable locally, but would really kill a
|
||||
slighly observerable locally, but would really kill a
|
||||
session over a slow link), the code in GDK does
|
||||
XGetWindowAttributes for every child of the root window at
|
||||
the beginning of the drag, then selects with
|
||||
|
19
docs/faq/.cvsignore
Normal file
19
docs/faq/.cvsignore
Normal file
@@ -0,0 +1,19 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.dvi
|
||||
*.ps
|
||||
*.pg
|
||||
*.ky
|
||||
*.cp
|
||||
*.fn
|
||||
*.tp
|
||||
*.vr
|
||||
*.log
|
||||
*.aux
|
||||
*.toc
|
||||
*.cps
|
||||
*.fns
|
||||
*.vrs
|
||||
html
|
||||
text
|
@@ -1,6 +1,4 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
EXTRA_DIST += \
|
||||
EXTRA_DIST = \
|
||||
gtk-faq.sgml
|
||||
|
||||
if HAVE_DOCBOOK
|
||||
@@ -38,5 +36,3 @@ dist-hook:
|
||||
endif
|
||||
|
||||
.PHONY: html
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
@@ -429,7 +429,7 @@ in which they need to be installed:</para>
|
||||
|
||||
<itemizedlist spacing=compact>
|
||||
<listitem><simpara> pkg-config
|
||||
(<ulink url="http://pkg-config.freedesktop.org/wiki">
|
||||
(<ulink url="http://www.freedesktop.org/software/pkgconfig">
|
||||
pkg-config Site</ulink>)</simpara>
|
||||
</listitem>
|
||||
|
||||
@@ -789,7 +789,8 @@ disgrace to the widget set will gladly be included.</para>
|
||||
<para>The new widgets that get added to GTK+ are generally either
|
||||
replacements for existing widgets that are no longer
|
||||
deemed to be adequate, or have been developed externally to GTK+ but
|
||||
have been widely tested.
|
||||
have been widely tested. One possible avenue for this is via
|
||||
<ulink url="http://cvs.gnome.org/lxr/source/libegg/">libegg</ulink>.</para>
|
||||
|
||||
<para>Before you spend months of your valuable time implementing your
|
||||
revolutionary widget, it is highly recommended that you get some
|
||||
@@ -824,8 +825,8 @@ However, bindings for many other languages are available.</para>
|
||||
<para>So, after you have installed GTK+ there are a couple of
|
||||
things that can ease you into developing applications with
|
||||
it. There is the GTK+ Tutorial <ulink
|
||||
url="http://library.gnome.org/devel/gtk-tutorial/stable/">
|
||||
http://library.gnome.org/devel/gtk-tutorial/stable/</ulink>, which is undergoing
|
||||
url="http://www.gtk.org/tutorial/">
|
||||
http://www.gtk.org/tutorial/</ulink>, which is undergoing
|
||||
development. This will introduce you to writing applications
|
||||
using C.</para>
|
||||
|
||||
@@ -1635,7 +1636,7 @@ int main(int argc, char *argv[])
|
||||
gtk_container_set_border_width(GTK_CONTAINER (window), 10);
|
||||
#endif
|
||||
|
||||
/* add a button to do something useful */
|
||||
/* add a button to do something usefull */
|
||||
button = gtk_button_new_with_label("Fork me!");
|
||||
|
||||
g_signal_connect(G_OBJECT (button), "clicked",
|
||||
@@ -2108,10 +2109,10 @@ not.</para>
|
||||
snippet:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
g_object_ref(widget);
|
||||
gtk_widget_ref(widget);
|
||||
gtk_container_remove(GTK_CONTAINER(old_parent), widget);
|
||||
gtk_container_add(GTK_CONTAINER(new_parent), widget);
|
||||
g_object_unref(widget);
|
||||
gtk_widget_unref(widget);
|
||||
</programlisting>
|
||||
|
||||
</sect1>
|
||||
@@ -2307,8 +2308,8 @@ used, as in:</para>
|
||||
NULL, gtk_widget_get_colormap(top),
|
||||
&pixmap_mask, NULL, pixfile);
|
||||
pixw = gtk_pixmap_new (pixmap, pixmap_mask);
|
||||
g_object_unref (pixmap);
|
||||
g_object_unref (pixmap_mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_pixmap_unref (pixmap_mask);
|
||||
</programlisting>
|
||||
|
||||
</sect1>
|
||||
@@ -2814,7 +2815,7 @@ the Label widget, which can be done using:</para>
|
||||
GtkTooltips in itself is not a GtkWidget (though a GtkObject)
|
||||
and as such is not attempted to match any widget styles.</para>
|
||||
|
||||
<para>So, your resource file should look something like:</para>
|
||||
<para>So, you resource file should look something like:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
style "postie"
|
||||
|
2982
docs/faq/gtkfaq.sgml
Normal file
2982
docs/faq/gtkfaq.sgml
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user