aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/.cvsignore14
-rw-r--r--widgets/misc/ChangeLog1618
-rw-r--r--widgets/misc/Makefile.am135
-rw-r--r--widgets/misc/e-bonobo-widget.c194
-rw-r--r--widgets/misc/e-bonobo-widget.h74
-rw-r--r--widgets/misc/e-calendar-item.c2959
-rw-r--r--widgets/misc/e-calendar-item.h338
-rw-r--r--widgets/misc/e-calendar.c582
-rw-r--r--widgets/misc/e-calendar.h101
-rw-r--r--widgets/misc/e-canvas-background.c495
-rw-r--r--widgets/misc/e-canvas-background.h71
-rw-r--r--widgets/misc/e-canvas-utils.c171
-rw-r--r--widgets/misc/e-canvas-utils.h55
-rw-r--r--widgets/misc/e-canvas-vbox.c381
-rw-r--r--widgets/misc/e-canvas-vbox.h93
-rw-r--r--widgets/misc/e-canvas.c1168
-rw-r--r--widgets/misc/e-canvas.h158
-rw-r--r--widgets/misc/e-cell-date-edit.c974
-rw-r--r--widgets/misc/e-cell-date-edit.h106
-rw-r--r--widgets/misc/e-cell-percent.c158
-rw-r--r--widgets/misc/e-cell-percent.h51
-rw-r--r--widgets/misc/e-charset-picker.c472
-rw-r--r--widgets/misc/e-charset-picker.h48
-rw-r--r--widgets/misc/e-clipped-label.c429
-rw-r--r--widgets/misc/e-clipped-label.h96
-rw-r--r--widgets/misc/e-colors.c103
-rw-r--r--widgets/misc/e-colors.h44
-rw-r--r--widgets/misc/e-combo-button.c551
-rw-r--r--widgets/misc/e-combo-button.h80
-rw-r--r--widgets/misc/e-config-page.c152
-rw-r--r--widgets/misc/e-config-page.h76
-rw-r--r--widgets/misc/e-cursors.c156
-rw-r--r--widgets/misc/e-cursors.h68
-rw-r--r--widgets/misc/e-dateedit.c1935
-rw-r--r--widgets/misc/e-dateedit.h178
-rw-r--r--widgets/misc/e-dropdown-button.c251
-rw-r--r--widgets/misc/e-dropdown-button.h71
-rw-r--r--widgets/misc/e-filter-bar.c717
-rw-r--r--widgets/misc/e-filter-bar.h117
-rw-r--r--widgets/misc/e-gui-utils.c265
-rw-r--r--widgets/misc/e-gui-utils.h61
-rw-r--r--widgets/misc/e-hsv-utils.c178
-rw-r--r--widgets/misc/e-hsv-utils.h52
-rw-r--r--widgets/misc/e-map.c1782
-rw-r--r--widgets/misc/e-map.h138
-rw-r--r--widgets/misc/e-messagebox.c358
-rw-r--r--widgets/misc/e-messagebox.h83
-rw-r--r--widgets/misc/e-multi-config-dialog.c512
-rw-r--r--widgets/misc/e-multi-config-dialog.h77
-rw-r--r--widgets/misc/e-popup-menu.c240
-rw-r--r--widgets/misc/e-popup-menu.h142
-rw-r--r--widgets/misc/e-printable.c209
-rw-r--r--widgets/misc/e-printable.h90
-rw-r--r--widgets/misc/e-reflow-model.c285
-rw-r--r--widgets/misc/e-reflow-model.h106
-rw-r--r--widgets/misc/e-reflow.c1414
-rw-r--r--widgets/misc/e-reflow.h142
-rw-r--r--widgets/misc/e-search-bar.c1230
-rw-r--r--widgets/misc/e-search-bar.h151
-rw-r--r--widgets/misc/e-selection-model-array.c557
-rw-r--r--widgets/misc/e-selection-model-array.h96
-rw-r--r--widgets/misc/e-selection-model-simple.c115
-rw-r--r--widgets/misc/e-selection-model-simple.h70
-rw-r--r--widgets/misc/e-selection-model.c689
-rw-r--r--widgets/misc/e-selection-model.h170
-rw-r--r--widgets/misc/e-title-bar.c404
-rw-r--r--widgets/misc/e-title-bar.h86
-rw-r--r--widgets/misc/e-unicode.c2272
-rw-r--r--widgets/misc/e-unicode.h133
-rw-r--r--widgets/misc/e-url-entry.c165
-rw-r--r--widgets/misc/e-url-entry.h69
-rw-r--r--widgets/misc/e-util-marshal.list2
-rw-r--r--widgets/misc/gal-categories.glade168
-rw-r--r--widgets/misc/pixmaps/.cvsignore2
-rw-r--r--widgets/misc/pixmaps/cursor_cross.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_closed.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_open.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_in.xpm37
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_out.xpm37
-rw-r--r--widgets/misc/test-calendar.c221
-rw-r--r--widgets/misc/test-charset-picker.c18
-rw-r--r--widgets/misc/test-color.c76
-rw-r--r--widgets/misc/test-dateedit.c285
-rw-r--r--widgets/misc/test-dropdown-button.c103
-rw-r--r--widgets/misc/test-multi-config-dialog.c94
-rw-r--r--widgets/misc/test-title-bar.c77
86 files changed, 0 insertions, 29015 deletions
diff --git a/widgets/misc/.cvsignore b/widgets/misc/.cvsignore
deleted file mode 100644
index 9bf3ddbecc..0000000000
--- a/widgets/misc/.cvsignore
+++ /dev/null
@@ -1,14 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-e-util-marshal.c
-e-util-marshal.h
-test-title-bar
-test-calendar
-test-dateedit
-test-dropdown-button
-test-multi-config-dialog
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
deleted file mode 100644
index 633bf06add..0000000000
--- a/widgets/misc/ChangeLog
+++ /dev/null
@@ -1,1618 +0,0 @@
-2002-12-10 Not Zed <NotZed@Ximian.com>
-
- * e-multi-config-dialog.c (impl_response): Removed the
- g_assert_not_reached(). If you hit the close button on your
- window it would abort, treat same as close.
-
-2002-12-09 Chris Toshok <toshok@ximian.com>
-
- * e-clipped-label.[ch]: rework this to be faster and deal more
- correctly with the ellipsis.
-
-2002-12-03 Not Zed <NotZed@Ximian.com>
-
- * e-search-bar.c (impl_dispose): dispose can be run multiple times
- too ... bloody gobject crap.
-
-2002-11-27 Not Zed <NotZed@Ximian.com>
-
- * e-charset-picker.c: Add include of gnome-dialog.h
-
- * *.[ch]: ran fix.sh script over everything.
-
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * e-combo-button.c (impl_button_press_event): Dont grab_add
- anymore on the button, gtk_button is changed in gtk2 not to do
- this anymore.
-
-2002-11-15 Chris Toshok <toshok@ximian.com>
-
- * e-clipped-label.c (build_layout): new function, build pango
- layout for string.
- (e_clipped_label_size_request): pango-ize this, make the size
- requested dependent on the label.
- (e_clipped_label_expose): pango-ize this.
- (e_clipped_label_recalc_chars_displayed): pango-ize this.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-clipped-label.c (e_clipped_label_finalize): New.
- (e_clipped_label_destroy): Removed.
-
- * e-title-bar.c (destroy): Removed.
- (impl_finalize): New.
- (class_init): Install GObject::finalize handler instead of
- GtkObject::destroy handler.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-filter-bar.c: Changed to use g_object_*() and g_signal_*()
- functions instead of gtk_object_*() and gtk_signal_*().
- (destroy): Removed.
- (dispose): New.
- (class_init): Install GObject::dispose handler instead of
- GtkObject::destroy handler.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * e-dateedit.[ch]: port to GObject.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (init): Use GObject functions instead of
- GtkObject throughout.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (impl_destroy): Removed.
- (impl_finalize): New.
- (class_init): Override GObject::finalize, not GtkObject::destroy.
-
- * e-config-page.c (impl_destroy): Removed.
- (impl_finalize): New.
- (class_init): Override GObject::finalize, not GtkObject::destroy.
-
- * e-multi-config-dialog.c: Converted to a GtkDialog subclass
- [instead of GnomeDialog].
-
-2002-11-07 JP Rosevear <jpr@ximian.com>
-
- * e-filter-bar.c: include gnome-dialog.h
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * .cvsignore: ignore the generated marshal source.
-
- * Makefile.am: add marshal stuff.
-
- * e-util-marshal.list: marshaller list.
-
- * e-search-bar.[ch]: gobjectify this.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (impl_expose_event): Use
- gtk_container_propagate_expose().
-
-2002-11-01 Ettore Perazzoli <ettore@ximian.com>
-
- * test-title-bar.c: #include <libgnomeui/gnome-ui-init.h> instead
- of <libgnomeui/gnome-init.h>.
- (main): Use a GtkLabel, not a GtkText.
-
- * test-dropdown-button.c: #include <libgnomeui/gnome-ui-init.h>
- instead of <libgnomeui/gnome-init.h>, and
- <libgnomeui/gnome-stock-icons.h> instead of
- <libgnomeui/gnome-stock.h>.
-
- * test-dateedit.c: #include <libgnomeui/gnome-ui-init.h> instead
- of <libgnomeui/gnome-init.h>.
- (main): Use gnome_program_init().
-
- * test-calendar.c: #include <libgnomeui/gnome-ui-init.h>.
-
- * e-url-entry.c (button_clicked_cb): Pass NULL as the error arg to
- gnome_url_show().
-
- * e-title-bar.c (class_init): GTK2-ified. Use GTK_TYPE_POINTER
- instead of GTK_TYPE_GDK_EVENT.
-
- * e-search-bar.c: Removed #include <libgnome/gnome-defs.h>.
- #include <string.h>.
- (class_init): GTK2-ified.
- (e_search_bar_set_menu): Use GTK_OBJECT_GET_CLASS.
- (e_search_bar_set_option): Likewise.
-
- * e-messagebox.c (e_message_box_class_init): Updated to put
- finalize in GObjectClass intead of GtkObjectClass.
- (e_message_box_finalize): Likewise.
- (e_message_box_construct): Just check if pixmap is NULL, instead
- of pixmap->pixmap.
-
- * e-messagebox.h: No {BEGIN,END}_GNOME_DECLS.
- (e_message_box_get_type): Fix prototype, should return GtkType
- instead of guint.
-
- * e-map.c: Removed e_map_signals, which was unused.
- (e_map_finalize): Update for the fact that finalize is now in
- GObjectClass.
- (e_map_class_init): Likewise. Also GTK2-ify.
- (e_map_draw): Removed.
- (load_map_background): Pass NULL as the gdk_pixbuf_new_from_file()
- error arg.
-
- * e-dropdown-button.c (menu_position_cb): Added arg push_in.
-
- * e-dateedit.c (e_date_edit_class_init): GTK2-ified.
- (e_date_edit_show_date_popup): Constify local variable.
- (e_date_edit_check_date_changed): Likewise.
- (e_date_edit_check_time_changed): Likewise.
- (e_date_edit_check_date_changed): Likewise.
- (field_set_to_none): Constify arg text.
- (e_date_edit_parse_date): Constify arg date_text.
- (e_date_edit_parse_time): Constify arg time_text.
-
- * e-dateedit.h: No {BEGIN,END}_GNOME_DECLS.
-
- * e-combo-button.c (menu_position_func): New arg push_in.
- (impl_draw): Removed.
- (class_init): GTK2-ified.
- (init): style->xthickness instead of style->klass->xthickness.
-
- * e-config-page.c (class_init): GTK2-ified.
-
- * e-clipped-label.c (e_clipped_label_size_request): Use
- gtk_style_get_font().
- (e_clipped_label_recalc_chars_displayed): Likewise.
- (e_clipped_label_expose): Likewise.
-
- * e-charset-picker.c: No #include <libgnome/gnome-defs.h> or
- <libgnome/gnome-i18n.h> or <libgnome/gnome-stock.h>. Also no
- <gal/gunicode.h>. On the other hand, #include <gtk/gtkvbox.h>.
- (e_charset_picker_new): Make locale_charset const.
- (e_charset_picker_bonobo_ui_populate): Make locale_charset const.
-
- * e-cell-percent.c: #include <stdio.h> for sscanf().
-
- * e-cell-percent.h: Removed BEGIN_GNOME_DECLS, END_GNOME_DECLS.
-
- * e-cell-percent.c: Do not #include <libgnomeui/gnome-stock.h>.
-
- * e-cell-date-edit.c: Do not #include <libgnomeui/gnome-stock.h>.
- Added a bunch of #includes for GTK stuff.
- (e_cell_date_edit_on_ok_clicked): Constified variable.
-
- * e-calendar-item.c: Do not #include <libgnome/gnome-defs.h>.
- (e_calendar_item_class_init): Use GTK_TYPE_POINTER instead of
- GTK_TYPE_GDK_POINTER.
- (e_calendar_item_class_init): GTK_CLASS_TYPE() instead of
- object_class->type.
- (e_calendar_item_class_init): No gtk_object_class_add_signals().
- (e_calendar_item_update): style->[xy]thickness instead of
- style->klass->[xy]thickness.
- (e_calendar_item_draw): Likewise.
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_recalc_sizes): Likewise.
- (e_calendar_item_convert_position_to_day): Likewise.
- (e_calendar_item_update): Use gtk_style_get_font().
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_draw_day_numbers): Likewise.
- (e_calendar_item_convert_position_to_day): Likewise.
- (e_calendar_item_recalc_sizes): Likewise.
- (e_calendar_item_signal_emission_idle_cb): Removed check for
- GTK_OBJECT_DESTROY.
- (e_calendar_item_position_menu): Add push_in arg.
-
- * e-calendar.c (e_calendar_draw): Remove.
- (e_calendar_size_request): style->[xy]thickness instead of
- style->klass->[xy]thickness.
- (e_calendar_size_allocate): Likewise.
- (e_calendar_get_border_size): Likewise.
- (e_calendar_size_allocate): Get font from style with
- gtk_style_get_font().
-
- * e-calendar-item.h: #include <libgnomecanvas/gnome-canvas.h>
- instead of <libgnomeui/gnome-canvas.h>.
- * e-calendar.c: Likewise for
- <libgnomecanvas/gnome-canvas-widget.h>.
-
- * Makefile.am: Don't compile e-bonobo-widget.c, e-bonobo-widget.h.
- [Unused right now, so we can avoid porting until, and if, they are
- needed.]
-
- * e-filter-bar.c: Do not #include <libgnome/gnome-defs.h>. Do not
- #include <libgnomeui/gnome-stock.h>. #include <gtk/gtksignal.h>.
- Also remove gal #includes.
- (do_advanced): Add some GTK_SIGNAL_FUNC() casts.
- (menubar_activated): Likewise.
- (menubar_activated): Likewise.
-
-2002-10-30 Ettore Perazzoli <ettore@ximian.com>
-
- * e-map.h: Do not #include <libgnome/gnome-defs.h>.
-
-2002-10-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-search-bar.c (clear_search): Emit a search_activated signal.
- (e_search_bar_set_item_id): Revert to original implementation.
-
-2002-10-23 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (option_changed): If the clear button was
- pressed, we want the entry to be sensitive (not insensitive).
-
- * e-search-bar.c (e_search_bar_set_item_id): If the item id is
- CLEAR_ID, we want to select the first item (0) but still set the
- esb->item_id to CLEAR_ID.
- (set_find_now_sensitive): Don't bother getting the GtkEntry text,
- we don't even use it?
- (clear_search): Set the item id as E_SEARCHBAR_CLEAR_ID rather
- than 0 so that it can be checked for.
-
-2002-10-23 Ettore Perazzoli <ettore@ximian.com>
-
- [#26128, thanks to Federico Mena Quintero <federico@ximian.com>
- for providing this fix.]
-
- * e-search-bar.c (activate_by_subitems): gtk_widget_grab_focus()
- on the entry when adding it in.
-
-2002-10-11 JP Rosevear <jpr@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_ensure_days_visible): check
- if the selection fits in the leftover days
-
-2002-09-30 Ettore Perazzoli <ettore@ximian.com>
-
- [Add a small delay to the switching of pages in the multi-config
- dialog. This makes keyboard navigation slightly nicer, and also
- happens to fix mysterious bug #28931.]
-
- * e-multi-config-dialog.c: New constant SWITCH_PAGE_INTERVAL. New
- members set_page_timeout_id and set_page_timeout_page in
- EMultiConfigDialogPrivate.
- (init): Initialize new member variables.
- (table_cursor_change_callback): Set up a timeout instead of
- switching right away.
- (set_page_timeout_callback): Timeout function to switch page after
- a small delay.
- (impl_destroy): Remove a pending timeout.
-
-2002-09-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (create_page_container): Don't set up
- the description label here.
-
-2002-09-24 Not Zed <NotZed@Ximian.com>
-
- * e-search-bar.c (clear_search): Clear search by setting text to
- "" and search to first search.
-
- * e-filter-bar.c (option_changed): Revert change of 2002-08-29
- below, always do advanced search if we have the advanced id.
- Handle clear elsewhere.
- (menubar_activated): If we get the advanced menu, set the advanced
- option menu, and let that handle it, rather than doing it
- ourselves. For #31060 & #29625.
-
-2002-09-22 Dan Winship <danw@ximian.com>
-
- * e-filter-bar.c: Fix some non-ANSI switch statements.
-
-2002-08-29 Chris Toshok <toshok@ximian.com>
-
- * e-search-bar.c (subitem_activated_cb): need to make the find now
- button sensitive when you select something from a submenu.
-
-2002-08-29 Peter Williams <peterw@ximian.com>
-
- * e-filter-bar.c (option_changed): If the item is ADVANCED_ID, check
- the query and efb->setquery to see whether we should pop up the advanced
- dialog or clear an advanced search. Fixes #29625.
-
-2002-08-21 Peter Williams <peterw@ximian.com>
-
- * e-search-bar.c (clear_search): Don't set the item id; clear search
- isn't in the menu anymore. Fixes #29211.
-
-2002-08-22 JP Rosevear <jpr@ximian.com>
-
- * e-dateedit.c (e_date_edit_parse_date): don't adjust for two
- digit dates here, the e_time_parse routines do that now
-
-2002-08-06 Not Zed <NotZed@Ximian.com>
-
- * e-filter-bar.c (menubar_activated): Set the query text into the
- filter name when saving it, for #10979.
-
-2002-07-24 Ettore Perazzoli <ettore@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_signal_emission_idle_cb): Add
- missing cast.
- (e_calendar_item_signal_emission_idle_cb): Likewise.
-
- * e-search-bar.c (init): Don't initialize dropdown_menu here
- anymore since we got rid of it.
-
- * e-search-bar.h (struct _ESearchBar): Removed member
- dropdown_menu.
-
-2002-07-22 Peter Williams <peterw@ximian.com>
-
- * e-filter-bar.c (do_advanced): Break out the code for creating
- the advanced rule editor into a separate function, so that...
- (menubar_activated): ... can also create an Advanced dialog;
- needed when the Search menu's advanced button is used.
- (option_changed): Change this to call the function instead of
- having all the code to itself.
-
- * e-search-bar.h: Add id's for the FIND_NOW and CLEAR actions
- so that other code (eg, EFilterBar) doesn't get confused by
- an old id being used when the search-activated signal gets
- emitted.
-
- * e-search-bar.c (clear_search): Set the item_id to CLEAR
- before emitting the signal.
- (search_now_verb_cb): Just make this emit query_changed,
- as the button in the toolbar does.
-
-2002-07-17 Ettore Perazzoli <ettore@ximian.com>
-
- [Fix #27854, spurious warnings from ESearchBar.]
-
- * e-search-bar.c (setup_standard_verbs): Set the <commands> part
- of the XML manually with bonobo_ui_component_set() otherwise the
- verbs don't get added on the other side for us to be able to do
- bonobo_ui_component_set_prop().
- (setup_bonobo_menus): New, menu setup code taken from
- update_bonobo_menus().
- (remove_bonobo_menus): New; removes the Bonobo menus.
- (update_bonobo_menus): Rewritten, just call remove_bonobo_menus()
- first and setup_bonobo_menus() then.
- (e_search_bar_set_ui_component): Call setup_bonobo_menus() and
- remove_bonobo_menus() as appropriate instead of just
- update_bonobo_menus().
-
-2002-07-02 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_sensitivity): Removed.
- (set_find_now_sensitive): New.
- (entry_changed_cb): Always make the "Find Now" button and menu
- item sensitive here.
- (emit_search_activated): ...And here, always insensitive.
- (setup_standard_verbs): Always start up insensitive.
- (activate_button_clicked_cb): Make the entry grab the focus.
- (clear_button_clicked_cb): Likewise.
-
-2002-07-02 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (subitem_activated_cb): Don't emit
- "search_activated" here.
- (e_search_bar_set_subitem_id): And not here either.
- (e_search_bar_set_text): Same.
-
-2002-07-02 Ettore Perazzoli <ettore@ximian.com>
-
- [Fix #7736.]
-
- * e-search-bar.c (activate_by_subitems): Don't set the entry to be
- an empty string here.
-
-2002-06-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-filter-bar.c (build_items): Put the numbers in front of the
- rules only if type is zero [i.e. not in the option menu].
-
-2002-05-30 Ettore Perazzoli <ettore@ximian.com>
-
- * e-filter-bar.c (dup_item_no_subitems): New helper function.
- (build_items): g_strdup() the text for all the items. Prepend the
- user-defined items with an order number.
- (free_built_items): New function to free the array returned by
- build_items, freeing the text strings too [since now they are
- newly allocated instead of just pointing to the exiting ones].
- (generate_menu): Call free_built_items() on the built items
- instead of just g_array_free().
- (set_option): Likewise.
-
-2002-05-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Put the stuff in
- /menu/Searchplaceholder/Search instead of /menu/Search.
-
- * e-combo-button.c (impl_draw): New, overrides GtkWidget::draw.
- (impl_expose_event): New, overrides GtkWidget::expose_event.
-
-2002-05-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-filter-bar.c (build_items): Prepend the advanced menu with a
- separator.
-
- * e-filter-bar.h: Add E_FILTERBAR_SEPARATOR. Rename the "Advanced
- Search..." menu item into "Advanced...".
-
-2002-05-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (activate_by_subitems): Strip underscores from
- the menu item labels.
-
-2002-04-26 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (fill_in_pixbufs): Don't print out the
- colors here unless debugging is turned on.
-
-2002-04-22 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (e_multi_config_dialog_add_page):
- Updated this to match the changed function name in gal.
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * e-search-bar.c (e_search_bar_construct, add_button): Oops. The
- previous change made the search bar widgets get packed in the
- wrong order. So use gtk_box_pack_end instead in add_button and add
- the two buttons in reverse order. It's all good now. Noticed by
- Ettore, who I then promptly blamed for it. Sorry Ettore!
-
-2002-04-08 Dan Winship <danw@ximian.com>
-
- * e-search-bar.c (e_search_bar_construct): Construct the buttons
- earlier so that the option-menu-setup code that tries to adjust
- the button sensitivity won't fail and g_warn.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * e-multi-config-dialog.c (e_multi_config_dialog_show_page): show
- a specific page number
-
- * e-multi-config-dialog.h: new proto
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Change the ETable specs so it doesn't
- sort.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Add accelerators for "Find
- Now" and "Clear".
-
- * e-filter-bar.h: Change search labels as suggested in Anna's
- redesign [#16246].
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Remove all the SearchBar
- items before setting them up again.
- (free_menu_items): New.
- (impl_destroy): Call it.
- (set_menu): Call it here too before adding the new items.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (verb_name_from_id): New.
- (e_search_bar_set_menu_sensitive): Rewritten using it.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): No accelerator for
- "FindNow".
- (add_button): Add a one-pixel padding to the button.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Rename the "Search Now"
- menu entry to "Find Now". Rename the corresponding verb to
- "ESearchBar:FindNow".
- (update_sensitivity): Updated accordingly.
- (setup_standard_verbs): Likewise.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_sensitivity): New halper function to
- update the sensitivity of the commands.
- (entry_changed_cb): New callback to make the activate_button and
- the "Find Now" verb sensitive only if the entry has some contents.
- (activate_by_subitems): Connect the callback here.
- (setup_standard_verbs): Call update_sensitivity() here.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (init): Init clear_button to NULL.
- (add_button): New helper function to add a button to the search
- bar with the right spacing etc.
- (clear_search): New helper function.
- (add_activate_button): Removed.
- (clear_button_clicked_cb): New.
- (e_search_bar_construct): Just add the button here using
- `add_button'. Also add a clear_button.
- (clear_verb_cb): Rewritten by means of `clear_search()'.
-
- * e-search-bar.h (ESearchBar): Add clear_button.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (search_now_verb_cb): New, implementation for a
- new "SearchNow" verb.
- (setup_standard_verbs): Create verb here.
- (update_bonobo_menus): Add SearchNow menu item.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (clear_verb_cb): New.
- (setup_standard_verbs): New.
- (e_search_bar_set_ui_component): Call it if a new
- BonoboUIComponent is set.
- (append_xml_menu_item): New helper function.
- (update_bonobo_menus): Use it. Also add a "Clear" menu item.
- (e_search_bar_construct): @menu_items can be NULL now.
- (e_search_bar_new): Same here.
- (set_menu): Work with NULL items.
-
- * e-filter-bar.c (menubar_activated): Don't handle
- E_FILTERBAR_RESET_ID anymore.
-
- * e-filter-bar.h: Remove `E_FILTERBAR_RESET_ID' and `E_FILTERBAR_RESET'.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (init): Init various members to NULL.
- (set_dropdown): Removed.
- (add_dropdown): Removed.
- (set_menu): New.
- (add_menu_items): New.
- (set_option): No need to setup the dropdown size here anymore.
- (verb_cb): Function implementing the search menu verbs.
- (update_bonobo_menus): New.
- (e_search_bar_set_ui_component): New.
-
- * e-search-bar.h: Remove the dropdown button stuff from struct
- ESearchBar. Add `uic' and `items' members.
-
- * e-filter-bar.c (e_filter_bar_new): Get a @uic arg.
-
-2002-03-15 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (init): Set horizontal scroll policy to
- GTK_POLICY_NEVER here. Don't set usize here. Changed RGBA_COLOR
- to RGB_COLOR. Turned on horizontal resize.
-
-2002-03-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c (add_charset): If the charset item doesn't
- have a class (aka "Unknown"), don't write a class name, instead
- just give the charset name as the menu item label. Fixes bug
- #14753.
-
-2002-03-13 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c: Added alpha blending here.
-
-2002-03-12 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c: Removed Page struct.
- (e_multi_config_dialog_add_page): Select the initial row after
- appending to the model.
-
-2002-03-12 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (init): Use Use e_table_memory_store
- instead of e_table_memory_callbacks. Use e_cell_vbox to include a
- pixbuf cell and a text cell.
-
-2002-03-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (init): Use GNOME_STOCK_BUTTON_CLOSE,
- not GNOME_STOCK_BUTTON_CANCEL.
- (do_close): Renamed from `cancel'.
- (do_apply): Renamed from `apply'.
- (do_ok): Renamed from `ok'.
-
-2002-03-09 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Rename Page.widget -> Page.page_widget;
- it is now an EConfigPage instead of just a GtkWidget. Add
- `num_unapplied' to EMultiConfigDialogPrivate. Derive from
- GnomeDialog, not GtkWindow.
- (update_buttons): New function to update the sensitiveness of the
- buttons according to whether all the settings have been applied or
- not.
- (page_new): Likewise.
- (create_page_container): Renamed from `create_page_widget'.
- (init): Add Apply/OK/Cancel buttons to the dialog. Init
- ->num_unapplied to zero.
- (page_changed_callback): New, callback for the page's "changed"
- signal.
- (e_multi_config_dialog_add_page): Connect the callback, update
- ->num_unapplied, update the buttons by calling `update_buttons'.
- (ok): New function for handling the OK button.
- (apply): New function for handling the Apply button.
- (cancel): New function for handling the Cancel button.
- (impl_clicked): Implementation for the GnomeDialog's ::clicked
- signal.
- (class_init): Install.
-
- * test-multi-config-dialog.c (add_pages): Update to use
- EConfigPages instead of plain GtkWidgets.
-
- * e-multi-config-dialog.c, e-multi-config-dialog.h: Derive from
- GnomeDialog, not GtkWindow.
-
- * e-config-page.c: New.
- * e-config-page.h: New.
-
-2002-03-07 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Don't display a header in the table on
- the left.
-
-2002-03-05 Ettore Perazzoli <ettore@ximian.com>
-
- * test-multi-config-dialog.c: New.
- * test-multi-config-dialog.h: New.
-
- * e-multi-config-dialog.c: New.
- * e-multi-config-dialog.h: New.
-
-2002-02-24 Chris Toshok <toshok@ximian.com>
-
- * e-filter-bar.c (init): preserve behavior - hook search_activated
- signal to the same function as query_changed.
-
- * e-search-bar.c (emit_search_activated): new function.
- (entry_activated_cb): use emit_search_activated instead of
- emit_query_changed.
- (subitem_activated_cb): same.
- (activate_button_clicked_cb): same.
- (class_init): add the search_activated signal.
- (idle_activate_hack): rename idle_change_hack to this, and
- emit_search_activated.
- (e_search_bar_construct): idle_change_hack -> idle_activate_hack.
- (e_search_bar_set_subitem_id): emit_search_activated instead of
- emit_query_changed.
- (e_search_bar_set_text): same.
-
- * e-search-bar.h (struct _ESearchBarClass): add a search_activated
- signal.
-
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (set_icon): gtk_widget_show() the icon_pixmap
- if the specified icon is not NULL.
-
-2002-02-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (set_icon): Work with a NULL @pixbuf as well
- [in that case, just hide the current icon widget].
- (e_combo_button_set_icon): Remove the precondition about @pixbuf
- being non-NULL.
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * e-url-button.[hc]: remove briefly used files
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * e-url-entry.[hc]: button/entry combo that launchs the gnome url
- handler on the entry text when the button is clicked
-
- * Makefile.am: build new files
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: build new files
-
- * e-url-button.[hc]: button widget that when clicked slurps the
- url of an entry and launchs the gnome url handler on the text
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use GNOME_FULL_CFLAGS and GNOME_FULL_LIBS.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c: Remove member `separator' from
- `EComboButtonPrivate'. New members `icon', `label'.
- (init): There shall be no separator no more. Init `icon' and
- `label' to %NULL.
- (e_combo_button_construct): Set no relief.
- (e_combo_button_new): Don't get a @menu arg anymore.
- (e_combo_button_construct): Likewise.
- (e_combo_button_set_icon): New.
- (e_combo_button_set_label): New.
- (e_combo_button_set_menu): New.
- (impl_clicked): New, overriding the "clicked" method for
- GtkButton.
- (class_init): Install.
- (impl_button_release_event): Removed.
- (class_init): No need to override ::release_event with this
- anymore.
- (impl_released): New, override for the GtkButton::released method.
- (class_init): Install.
-
-2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c: Added iso-8859-8 (Hebrew; Visual) to the
- list of charsets in the menu. Fixes bug #15655.
-
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c: New.
- * e-combo-button.h: New.
-
-2001-11-21 Not Zed <NotZed@Ximian.com>
-
- * e-filter-bar.c (menubar_activated): Mark the dialogue as already
- up so we dont allow multiple dialogues up. Behaviour fix part of
- #15745.
-
-2001-11-28 Damon Chaplin <damon@ximian.com>
-
- * e-map.c: updated to new version from Ximian Setup Tools.
- Fixes bug #7641.
-
-2001-11-27 Damon Chaplin <damon@ximian.com>
-
- * e-dateedit.c (e_date_edit_get_date): if allow_no_date_set is FALSE,
- return the last valid date entered, even if the field is currently
- empty. Fixes bug #15749.
-
-2001-11-05 JP Rosevear <jpr@ximian.com>
-
- * e-dateedit.c (e_date_edit_set_date_and_time_of_day): set both
- the date and the time of day in one call, creating only a single
- changed signal
-
- * e-dateedit.h: add proto
-
-2001-11-05 Christopher James Lahey <clahey@ximian.com>
-
-Based on a patch by Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.c: Connect to the button_press signal on the
- popup and do the grab correctly so that this dialog behaves
- properly when the user clicks it away. Also, changed all
- instances of setting of popup_shown field of ECellPopup to call
- e_cell_popup_set_shown. Fixes Ximian bug #14016.
-
-2001-10-31 <NotZed@Ximian.com>
-
- * e-filter-bar.c (build_items): Snotty code so we only disconnect
- to rules we no longer have, etc.
-
-2001-11-01 Not Zed <NotZed@Ximian.com>
-
- * e-filter-bar.c (build_items): Ref and connect to rule changed
- here, also clear out previous ref's.
- (generate_menu): No longer connect to rules, or reset rule array.
- (set_option): Dont reset option rules array.
- (context_rule_removed): Disconnect changed event on rule.
- (clear_rules): Fujnction to clear rules from an array.
- (destroy): Disconnect from context signals, and clear rules arrays.
-
- * e-filter-bar.h: Remove hash table for change id's.
-
-2001-10-30 Damon Chaplin <damon@ximian.com>
-
- * e-dateedit.c (e_date_edit_set_time_of_day): emit signal when time
- set to none/empty.
-
-2001-10-30 <NotZed@Ximian.com>
-
- * e-filter-bar.c (generate_menu): Hook to rule changed events.
- (destroy): Free change id table/unconnect to signals.
- (init): Setup change id table.
- (e_filter_bar_new): Hook onto rule removed signal.
- (context_rule_removed): If rule removed, disconnect from signal handler.
- (rule_changed): For changed rules, also rebuild menu. Fixed #12233.
-
-2001-10-30 Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_set_popup_values): try to parse
- just a date first, and if that works we assume it is a DATE value,
- so we clear the time field in the popup.
- (e_cell_date_edit_on_ok_clicked): if the time field is empty, use a
- DATE value.
- Also removed some debug messages.
-
-2001-10-30 <NotZed@Ximian.com>
-
- * e-filter-bar.c (set_option): Set the item to the option_base on
- it, so the current item is set. Fix for #7081.
-
-2001-10-30 Christopher James Lahey <clahey@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_get_popup_pos): Adapt to
- the new ECellPopup signature.
-
-2001-10-29 Damon Chaplin <damon@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_signal_emission_idle_cb): ref
- the ECalendarItem and check if it gets destroyed, to try to avoid a
- free memory write.
-
- * e-dateedit.c (e_date_edit_set_time_of_day): allow setting the time
- to empty by passing hour as -1.
-
-2001-10-23 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (rule_editor_clicked): Don't add the menu item
- here, do this in the context_changed signal callback instead.
- (context_changed): rebuild the search menu.
- (set_menu): Copy the items into a default_items list so we can
- regenerate the menu when something changes. Then call
- generate_menu().
- (generate_menu): Do what set_menu() used to do.
- (e_filter_bar_new): Don't do a rule_context_load() anymore since
- we don't need to.
- (destroy): free the default_items list.
-
-2001-10-23 Damon Chaplin <damon@ximian.com>
-
- * e-search-bar.c (copy_subitems): copy the translate field over as
- well. Should fix an uninitialized memory read.
-
-2001-10-23 Damon Chaplin <damon@ximian.com>
-
- * e-dateedit.c (e_date_edit_check_date_changed):
- (e_date_edit_check_time_changed): clear the struct tm fields to keep
- purify happy.
-
-2001-10-22 Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_set_popup_values):
- (e_cell_date_edit_update_cell): use the new ECellText methods to get
- the text and set the value.
-
- * e-cell-percent.c: new subclass of ECellText to display & edit a
- percentage value.
-
-2001-10-20 Jon Trowbridge <trow@ximian.com>
-
- * e-dateedit.c (e_date_edit_check_date_changed): Keep us from
- reading tmp_tm uninitialized, so purify won't complain.
-
-2001-10-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c (e_charset_picker_bonobo_ui_populate): Now
- takes a menu path argument.
-
-2001-10-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * Makefile.am: added BONOBO_GNOME_CFLAGS to make it compile with
- latest Bonobo
-
-2001-10-04 Christopher James Lahey <clahey@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_get_popup_pos): Call
- gnome_canvas_world_to_window here. Finishes fixing Ximian bug
- #2613.
-
-2001-09-18 Damon Chaplin <damon@ximian.com>
-
- * e-dateedit.c (e_date_edit_grab_focus): grab focus to the date entry
- or the time entry, depending on which is visible. Fixes bug #7237.
-
-2001-09-16 Chris Toshok <toshok@ximian.com>
-
- * e-dateedit.h: add prototype for e_date_edit_set_editable.
-
- * e-dateedit.c (e_date_edit_set_editable): new function, analogous
- to gtk_entry_set_editable: let's the user select but not edit (or
- in this case, bring up the calendar view.)
-
-2001-09-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-search-bar.c (set_dropdown): Don't unref the old dropdown, we
- don't "own" it.
-
-2001-09-13 Larry Ewing <lewing@ximian.com>
-
- * e-search-bar.c (set_dropdown): unref the old dropdown_menu if
- there is one.
-
-2001-09-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (menubar_activated): No longer need the context
- in order to clone a FilterRule.
- (option_changed): Same.
-
-2001-09-06 Anna Marie Dirks <anna@ximian.com>
-
- * e-filter-bar.c: added a default size for the saved search
- dialog of 600 x 300 such that it opens at a usable size.
- this fixes bug #7083.
-
-2001-09-05 Anna Marie Dirks <anna@ximian.com>
-
- * e-search-bar.c (add_activate_button): added a wee bit of
- padding around the find now label in response to bug #7049.
-
-2001-08-23 Federico Mena Quintero <federico@ximian.com>
-
- * e-search-bar.c (e_search_bar_set_ids): New function to set the
- item_id and the subitem_id simultaneously.
-
-2001-08-16 Damon Chaplin <damon@ximian.com>
-
- * e-dateedit.c: added e_date_edit_get/set_make_time_insensitive()
- which makes the time field insensitive rather than hiding it.
- I'm not sure we're going to actually use this now, though.
-
-2001-08-16 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (activate_by_subitems): Set the horizontal usize
- of the entry to 4.
-
-2001-08-16 Jon Trowbridge <trow@ximian.com>
-
- * e-filter-bar.c (option_changed): Adjusted for renamed ESearchBar
- functions.
- (menubar_activated): Adjusted for renamed ESearchBar functions.
-
- * e-search-bar.c: Renames some of the horrible function names:
- s/option_choice/item_id/, s/suboption_choice/subitem_id/.
-
-2001-08-14 Federico Mena Quintero <federico@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_destroy): Destroy, do not
- unref, the popup_window.
-
-2001-08-14 Federico Mena Quintero <federico@ximian.com>
-
- * e-search-bar.c (activate_by_subitems): Correctness fixes for
- when the entry and submenu must be interchanged.
-
-2001-08-14 Federico Mena Quintero <federico@ximian.com>
-
- *Please* add accessor functions instead of just object arguments!
-
- * e-search-bar.c (e_search_bar_set_option_choice): New function.
- (e_search_bar_set_suboption_choice): New function.
- (e_search_bar_set_text): New function.
- (impl_set_arg): Use the functions above instead of setting things
- directly.
- (add_dropdown): If the item is a separator, set it as insensitive.
- (activate_by_subitems): Handle the translate field in the subitem
- structure. Also, allow the creation of separators by having NULL
- text strings in the subitems.
- (set_option): If the item is a separator, set it as insensitive.
- (set_option): Do not use the subitem_garbage hack. Do proper
- memory management instead.
- (e_search_bar_set_suboption): New function to change the suboption
- items in a search bar.
-
- * e-search-bar.h (ESearchBarSubitem): Added a `translate' field.
- This API sucks so much it is not funny.
- (ESearchBar): Removed the subitem_garbage hack. Please do proper
- memory management.
-
-2001-08-14 Jon Trowbridge <trow@ximian.com>
-
- * e-search-bar.c (activate_by_subitems): Oops... initial
- suboption_choice should be subitems[0].id, not 0.
-
-2001-08-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-search-bar.c (impl_destroy): Oops, we didn't need to unref all
- of the widgets, just a few.
-
-2001-08-10 Jon Trowbridge <trow@ximian.com>
-
- * e-filter-bar.h: Set the subitems to NULL in the pre-defined
- ESearchBarItems.
-
- * e-filter-bar.c (rule_editor_clicked): Set the ESearchBarItem's
- subitems to NULL.
- (build_items): Set the ESearchBarItem's subitems to NULL.
- (e_filter_bar_new): Set the ESearchBarItem's subitems to NULL.
-
- * e-search-bar.c: Added support for subitems, so that a search
- option can key off of another option menu rather than just an
- entry.
-
-2001-08-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (destroy): Free all the goodies that we allocate
- at construct time and unref the rule context.
- (class_init): Override the destroy method.
-
-2001-08-09 Anna Marie Dirks <anna@ximian.com>
-
- Fixes bug #6918
-
- * e-filter-bar.h: Changed the "Save As.." menu item to
- "Add to Saved Searches".
-
-2001-08-09 Anna Marie Dirks <anna@ximian.com>
- * e-filter-bar.h : changed the E_FILTERBAR_RESET label from
- "Show All" to "Clear" to alleviate confusion about whether
- "Show All" means that hidden messages are also shown or not.
- (See ximian bug #6743)
-
-2001-08-09 Federico Mena Quintero <federico@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_destroy): Chain to the
- destroy handler in the parent class!
-
- * e-clipped-label.c (e_clipped_label_destroy): Likewise. Sigh.
-
- * e-dropdown-button.c (impl_destroy): Likewise. Double sigh.
-
-2001-08-08 Anna Marie Dirks <anna@ximian.com>
-
- * e-search-bar.c: Re-labeled the "Activate" button "Find Now".
-
-2001-08-08 Ettore Perazzoli <ettore@ximian.com>
-
- * e-bonobo-widget.c: New.
- * e-bonobo-widget.h: New.
-
-2001-08-05 Ettore Perazzoli <ettore@ximian.com>
-
- [Added an "Activate" button to the search bar.]
-
- * e-search-bar.c (submit_button_clicked_cb): Callback for the
- "clicked" signal on the activate button.
- (add_submit): New function to add a "Activate" button on the right
- of the entry.
- (e_search_bar_construct): Call it.
- (add_spacer): Removed.
- (e_search_bar_construct): Don't call it.
- (find_id): Remove debugging message.
- (put_in_spacer_widget): New utility function to create a
- GtkEventBox with a border width of one and put a widget into it.
-
-2001-08-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-title-bar.c: Make the close icon as large as the pin icon so
- the bar doesn't change size when it switches between them.
- (e_title_bar_construct): Add some horizontal padding to the label
- to make it look nicer.
-
-2001-08-03 Federico Mena Quintero <federico@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_mark_day): Request an update.
- (e_calendar_item_mark_days): Likewise.
-
-2001-07-24 Damon Chaplin <damon@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_show_popup_menu): don't show the
- year in the popup submenu for the months, and center the months.
- Fixes
-
-2001-07-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (rule_editor_destroyed): When the dialog gets
- closed, always make sure the entry widget becomes sensitive again.
- (menubar_activated): Don't use FILTER_SOURCE_INCOMING because
- that's not what we want, we want (I think) NULL (at least with
- NULL, bug #4490 goes away).
-
-2001-07-16 Federico Mena Quintero <federico@ximian.com>
-
- Fixes bug #2901.
-
- * e-dateedit.c (e_date_edit_parse_date): Use e_time_parse_date().
- (e_date_edit_parse_time): Use e_time_parse_time().
-
-2001-07-17 jacob berkman <jacob@ximian.com>
-
- * e-search-bar.c (set_dropdown): don't unset _CAN_FOCUS
-
- * e-dropdown-button.c (menu_deactivate_cb): un-toggle ourself
- (impl_toggled): override the toggled rather than clicked signal.
- if we are active, popup the menu; else, popdown
-
- these fix ximian #2016
-
-2001-07-02 Damon Chaplin <damon@ximian.com>
-
- * e-calendar-item.c:
- * e-cell-date-edit.c:
- * e-dateedit.c: added functions to set a callback to get the current
- time, which is used instead of localtime(). We need this as we have to
- use our own timezones.
-
-2001-07-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c (e_charset_picker_bonobo_ui_populate): Take a
- callback function and user_data so that we can add listeners to
- each of the menu items.
-
-2001-07-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Updated to build e-charset-picker.c
-
- * e-charset-picker.[c,h]: Moved here from gal.
- (e_charset_picker_bonobo_ui_populate): New function to populate a
- bonobo-ui with a charset picker menu.
-
-2001-06-14 Damon Chaplin <damon@ximian.com>
-
- * e-map.[hc]: copied the EMap widget verbatim from Ximian Setup Tools.
- Hmm. Maybe it should go in gal, but its not a very general widget.
-
- * Makefile.am (INCLUDES): defined MAP_DIR for e-map.c.
- (libemiscwidgets_a_SOURCES): added e-map.[hc].
-
-2001-05-31 Federico Mena Quintero <federico@ximian.com>
-
- * e-dropdown-button.c (impl_button_press_event): Removed unused
- variable.
-
- * e-cell-date-edit.c (e_cell_date_edit_rebuild_time_list): Removed
- unused variable.
-
-2001-05-07 Gediminas Paulauskas <menesis@delfi.lt>
-
- * misc/e-filter-bar.h: xgettext does not find N_() in #defines. So
- created fake enum. Also removed spaces before "..."
-
-2001-04-24 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-calendar-item.c, e-calendar.c, e-cell-date-edit.c,
- e-clipped-label.c, e-dateedit.c, e-dropdown-button:
- Added #include <glib.h> and moved corresponding local headers
- to the top.
-
-2001-04-15 Federico Mena Quintero <federico@ximian.com>
-
- * e-search-bar.c (e_search_bar_get_option_choice): New function,
- because it is ridiculous to have to hunt down object arguments to
- fetch values.
- (e_search_bar_get_text): Likewise.
- (impl_get_arg): Use the functions above so that we have to
- maintain only one version of the getters.
-
-2001-04-04 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-calendar.c: More header fixes.
- * e-cell-date-edit.c: Same.
- * e-dateedit.[ch]: Same.
- * e-title-bar.c: Same here.
- * e-search-bar.c: More header fixes.
- * test-calendar.c: Same here.
-
-2001-03-29 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-dropdown-button.c: Replace #include <gtk/gtk.h>
- * e-dropdown-button.h: Remove #include <gnome.h>
- * e-filter-bar.c: Replace #include <gtk/gtk.h>
- * e-filter-bar.h: Replace #include <gtk/gtk.h>
- * e-messagebox.c: Add #includes to count for removed <gnome.h> in
- e-messagebox.h:
- * e-messagebox.h: Replace #include <gnome.h>
- * e-search-bar.c: Replace #include <gnome.h>
- * e-search-bar.h: Same here
- * test-calendar.c: Remove #include <gnome.h>
- * test-dateedit.c: Replace #include <gnome.h>
- * test-dropdown-button.c: Same here.
- * test-title-bar.c: Same here.
-
-2001-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-filter-bar.c (rule_editor_clicked): Validate the filter rule.
-
-2001-03-18 Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.c (e_cell_date_edit_show_time_invalid_warning):
- use gnome_dialog_run() to make the warning dialog modal. Also created
- a better warning message showing the format expected.
- Also used e_time_format_time() to format all times.
-
-2001-03-15 Not Zed <NotZed@Ximian.com>
-
- * e-filter-bar.c (menubar_activated): If we click on the edit
- menu, then bring up a rule editor. If the user adds/removes rules
- though, they are neither saved, nor added to the menu's. sigh.
-
-2001-03-04 Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.c: pretty much working now.
-
-2001-03-01 Not Zed <NotZed@Ximian.com>
-
- * e-filter-bar.c: New type of search bar that interacts with
- filter contexts to save filters etc. Still probably needs a
- little cleanpu.
-
-2001-02-28 Not Zed <NotZed@Ximian.com>
-
- * e-search-bar.c (add_dropdown): Save the dropdown menu in the
- struct too. Sigh, this is only so we can scan its content later,
- ick.
- (e_search_bar_set_menu_sensitive): New function to se tthe
- sentisitivty of menyu items based on id.
- (find_id): New function to find the row and widget for a specific
- id.
- (add_option): Renamed to set_option.
- (add_dropdown): Renamed to set_dropdown.
- (add_dropdown): ?New function to add a single item.
- (set_dropdown): Call add_dropdown to add each item.
- (e_search_bar_add_menu): New public function to add a single item.
-
-2001-02-27 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am (libemiscwidgets_a_SOURCES): Added filter-bar.[ch].
-
- * e-search-bar.c (class_init): Init virtual functions.
- (e_search_bar_set_option):
- (e_search_bar_set_menu): virtualise calling.
- (e_search_bar_construct): Call virtual functions to setup menus.
-
- * e-search-bar.h (struct _ESearchBarClass): Virtualise
- add_dropdown/add_option, so certain base options can be created.
-
-2001-02-25 Damon Chaplin <damon@ximian.com>
-
- * e-cell-date-edit.[hc]: new files to implement an ECell for showing
- and editing dates & times. (Unfinished)
-
- * Makefile.am (libemiscwidgets_a_SOURCES): added e-cell-date-edit.[hc]
-
-2001-02-24 Not Zed <NotZed@Ximian.com>
-
- * e-search-bar.c (add_dropdown): Move the event box into the
- esb->dropdown_holder. Changed so it can be called again on the
- same esb, to rebuild the menu.
- (e_search_bar_set_menu): New function to (re)set the menu.
- (add_option): Setup so it can be re-called to rebuild the option
- list.
- (e_search_bar_set_option): New function to build the menu's.
-
-2001-02-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * .cvsignore: Ignore test-dropdown-button
-
-2001-01-28 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (add_spacer): Make the spacer 4 pixels wider.
- (add_dropdown): Put the dropdown button into an event box with a
- 1-pixel border, so that we match the [Hardcoded! Stupid GTK+!]
- border around the option menu.
-
-2001-01-28 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dropdown-button.c (menu_deactivate_cb): New function to change
- the state of the toggle button when the pop-up menu disappears.
- (impl_clicked): Removed.
- (impl_button_press_event): New, implementation for
- `::button_press_event'. Pop-up the menu, and toggle the button.
- (class_init): Override `::button_press_event' with
- `impl_button_press_event'; don't override `::clicked' anymore.
-
- * e-dropdown-button.h, e-dropdown-button.c: Derive from
- `GtkToggleButton', instead of plain `GtkButton'.
-
-2001-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (add_dropdown): Make the dropdown button
- non-focusable.
-
-2001-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (e_search_bar_init): Don't create the widgets
- here.
- (e_search_bar_construct): New. Do it here instead.
- (e_search_bar_new): Call it. Added preconditions.
- (esb_pack_menubar): Removed.
- (add_dropdown): New.
- (add_option): New.
- (add_entry): New.
- (e_search_bar_construct): Use `add_dropdown()', `add_option()',
- `add_entry()'.
- (class_init): Renamed from `e_seearch_bar_class_init'.
- (init): Renamed from `e_search_bar_init'.
- (impl_destroy): Renamed from `e_search_bar_destroy'.
- (emit_menu_activated): Renamed from `esb_menu_activated'.
- (emit_query_changed): Renamed from `esb_query_changed'.
- (menubar_activated_cb): Renamed from `esb_menubar_activated'.
- (option_activated_cb): Renamed from `esb_option_activated'.
- (esb_entry_activated): Renamed from `esb_entry_activated'.
- (impl_set_arg): Renamed from `e_search_bar_set_arg'.
- (impl_get_arg): Renamed from `e_search_bar_get_arg'.
-
- * e-search-bar.h (struct _ESearchBar): Removed member `menubar';
- replaced it with `dropdown'.
-
-2001-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dropdown-button.c (e_dropdown_button_construct): Removed
- @ui_info and @data args. Obviously I am not very smart at this
- time of the night.
- (e_dropdown_button_new): Likewise.
-
-2001-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dropdown-button.c, e-dropdown-button.h: New.
-
-2001-01-25 Damon Chaplin <damon@ximian.com>
-
- * e-calendar-item.[hc]: e_calendar_item_get_date_range() now returns
- a boolean, which is FALSE if no dates are currently shown.
- Plus a couple of minor sanity checks.
-
-2001-01-19 Federico Mena Quintero <federico@ximian.com>
-
- * e-calendar.c (e_calendar_init): Unset the GTK_CAN_FOCUS flag on
- the ECalendar.
- (e_calendar_focus_in): Removed function since it did nothing.
- (e_calendar_focus_out): Likewise.
- (e_calendar_key_press): Likewise.
- (e_calendar_init): Turn off the GTK_CAN_FOCUS flag for both arrow
- buttons.
-
-2001-01-17 Federico Mena Quintero <federico@ximian.com>
-
- * e-calendar-item.c (e_calendar_item_set_max_days_sel): Make zero
- the minimum number of days that can be specified.
- (e_calendar_item_set_arg): We do need an update when the maximum
- number of selected days is changed.
- (e_calendar_item_set_max_days_sel): Request an update of the
- canvas item.
- (e_calendar_item_button_press): Do not start selecting days if the
- max_days_selected is less than 1.
-
-2001-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-messagebox.c (e_message_box_get_id): Oops. Delete this. I
- never meant for this to get commit'd.
-
-2001-01-17 JP Rosevear <jpr@ximian.com>
-
- * e-messagebox.c (e_message_box_get_id): Dont remove the function, give
- it the proper name
-
-2001-01-17 Ettore Perazzoli <ettore@ximian.com>
-
- * e-messagebox.c (e_message_box_get_checkbox): Remove the version
- returning `const char *' as of course it doesn't compile. Please
- compile before committing.
-
-2001-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Added e-messagebox to the build.
-
- * e-messagebox.[c,h]: Added a new messagebox window that contains
- a checkbox for "Don't show me this again."
-
-2001-01-16 Jason Leach <jasonleach@usa.net>
-
- * e-search-bar.[ch]: Moved here from $(toplevel)/filter.
-
-2000-12-22 JP Rosevear <jpr@helixcode.com>
-
- * e-calendar-item.h: add prototypes
-
- * e-calendar-item.c (e_calendar_item_init): Set max_days_selected to
- 1 and days_to_start_week_selection to -1 as documented in header
- (e_calendar_item_set_arg): use new accessor methods
- (e_calendar_item_get_arg): ditto
- (e_calendar_item_get_max_days_sel): accessor
- (e_calendar_item_set_max_days_sel): ditto
- (e_calendar_item_get_days_start_week_sel): ditto
- (e_calendar_item_set_days_start_week_sel): ditto
- (e_calendar_item_class_init): add display_popup argument
- (e_calendar_item_init): initialize display_popup member
- (e_calendar_item_get_arg): get display_popup member
- (e_calendar_item_set_arg): set display_popup member
- (e_calendar_item_button_press): only show the popup menu if the
- member is set
- (e_calendar_item_get_display_popup): acessor
- (e_calendar_item_set_display_popup): ditto
-
-2000-12-14 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dateedit.h: #include <time.h>
-
-2000-12-08 JP Rosevear <jpr@helixcode.com>
-
- * e-calendar.c (e_calendar_destroy): Call the parent class destroyer
- as well
-
-2000-10-26 Damon Chaplin <damon@helixcode.com>
-
- * e-dateedit.[hc]: updated to emit "changed" when appropriate, which
- turned out to be amazingly difficult :(
- Also added e_date_edit_get/set_date() to get/set just the date.
- Added e_date_edit_date_is_valid() & e_date_edit_time_is_valid() so
- you can check if the user has tried to enter an invalid date.
- (All the get_date/time functions return the last valid date entered.)
-
- * test-dateedit.c: updated a bit.
-
-2000-11-02 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dateedit.h (EDateEditClass): Removed the "time_changed"
- signal, since it was never being emitted in the first place. Time
- values *are* both date and time together anyways, so whenever one
- changes we should notify about the whole date/time value being
- changed.
- Renamed the remaining "date_changed" signal to just "changed".
-
- * e-dateedit.c (e_date_edit_class_init): Do not create the
- "time_changed" signal; rename the other one to "changed".
- (set_time): Moved the core functionality from
- e_date_edit_set_time() to here. This function just sets the
- widgets' values without emitting any signals.
- (e_date_edit_set_time): Emit the "changed" signal unconditionally.
- This is to be consistent with the rest of the GTK+ widgets, and it
- actually makes writing client code easier.
- (e_date_edit_new): Use set_time().
- (on_date_popup_now_button_clicked): Do not emit the signal here.
- (on_date_popup_none_button_clicked): Likewise.
- (e_date_edit_set_time_of_day): Emit the signal, since we do not
- call e_date_edit_set_time().
-
-2000-10-30 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-calendar-item.c: #include <string.h> to get rid of warning.
- * e-clipped-label.c: Same here.
-
-2000-10-27 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dateedit.c (e_date_edit_destroy): Do not unref the cal_popup
- since we already destroyed it.
-
-2000-10-11 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.c (e_calendar_item_recalc_sizes): fixed to
- recalculate min_cell_width/height in case the show_week_numbers option
- is changed.
-
- * e-dateedit.c: added support for hiding the date field, and added
- get/set_time_of_day() functions to get/set just the time.
-
-2000-09-30 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.c:
- * e-dateedit.c: better i18n of strftime strings.
-
-2000-09-29 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-title-bar.c: New member `pin_gtk_pixmap' in
- `ETitleBarPrivate'. Signal "close_button_clicked" renamed to
- "button_clicked". Signal "title_button_press_event" renamed to
- "label_button_press_event".
- (init): Init new members.
- (close_button_realize_cb): Create the pin pixmap. Call
- `show_and_hide_pixmaps_according_to_mode()'.
- (e_title_bar_show_close_button): Renamed to
- `e_title_bar_show_button'.
- (e_title_bar_get_button_mode): New.
- (e_title_bar_set_button_mode): New.
-
-2000-09-23 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar.c: use pixmaps instead of GtkArrows to look better.
- Also set the canvas window's background when realized so that we can
- set the button reliefs to none.
-
-2000-09-22 Damon Chaplin <damon@helixcode.com>
-
- * test-dateedit.c: updated a bit, adding a few EDateEdits with
- different options.
-
- * e-calendar-item.c (e_calendar_item_set_selection): aborted any
- current selection operation and initialize all of the selection fields.
- (e_calendar_item_unmap): new function to abort any current selection
- operation. Otherwise GnomeCanvas gets in a muddle about grabs.
-
- * e-dateedit.c: marked some strftime()/strptime() format strings for
- translation and used "%m/%d/%Y" instead of "%x" so we get the complete
- year number. Also changed e_date_edit_get_time() so it returns -2 if
- it can't parse the date or time, and -1 if it is explicitly set to
- None.
- (e_date_edit_parse_date): new function to parse the date string and
- add on the current century if a year of 0-99 is entered.
-
-2000-09-21 Damon Chaplin <damon@helixcode.com>
-
- * e-dateedit.c (on_date_button_clicked): only check return of strptime
- for NULL. It should now select the correct day set in the popup.
-
- * e-calendar.c:
- * e-calendar-item.c:
- * test-calendar.c: removed support for buttons within the ECalendar.
- It is cleaner to add them outside it, as EDateEdit does.
-
-2000-09-18 Dan Winship <danw@helixcode.com>
-
- * e-dateedit.c (_XOPEN_SOURCE): set this to 4 to specify how much
- X/Open we want with that.
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and
- $(EXTRA_GNOME_LIBS). Removed unneeded libraries.
-
- * e-calendar-item.c, e-calendar.c, e-calendar.h, e-title-bar.c:
- Fixed the #include lines to deal properly with gal.
-
- * e-scroll-frame.c, e-scroll-frame.h: Moved to gal.
-
-2000-09-11 Damon Chaplin <damon@helixcode.com>
-
- * Makefile.am (libemiscwidgets_a_SOURCES): added e-dateedit.[hc]
- and the test-dateedit app.
-
- * e-dateedit.[hc]: new widget to use instead of GnomeDateEdit. It
- uses the new ECalendar widget for the calendar and also supports
- "None", "Today" and "Now" buttons, and goes away with a single click.
-
- * test-dateedit.c: app to test the EDateEdit widget.
-
- * e-calendar-item.c: updated to support the EDateEdit better,
- mainly by adding the "move_selection_when_moving" arg so we can turn
- it off to keep the same day selected when changing the months shown.
-
-2000-09-05 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.c (e_calendar_item_draw_month): make sure we get
- the start_weekday since we need it for draw_days(). Fixes a drawing
- bug.
-
-2000-08-31 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.c (e_calendar_item_button_press):
- (e_calendar_item_button_release): grab/ungrab the pointer so we
- always get the button_release event.
-
-2000-08-30 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.[hc]:
- * e-calendar.[hc]: Updated.
-
-2000-08-10 Christopher James Lahey <clahey@helixcode.com>
-
- * e-calendar-item.c, e-calendar.c: Fixed some warnings.
-
-2000-07-25 Damon Chaplin <damon@helixcode.com>
-
- * e-calendar-item.h:
- * e-calendar.[hc]: new widget and canvas item to replace GtkCalendar.
- Not quite finished yet.
-
-2000-07-21 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-title-bar.c (e_title_bar_set_title): We have a `EClippedLabel',
- not a `GtkLabel' here: use the right function to change the text.
-
-2000-07-12 Christopher James Lahey <clahey@helixcode.com>
-
- * e-scroll-frame.c: Tried rearranging the casts to try for a more
- correct computation.
-
-2000-07-08 Dan Winship <danw@helixcode.com>
-
- * e-scroll-frame.c (e_scroll_frame_add): comment out true but
- confused warning about non-scrollable widgets until Chris and/or
- Federico fix this correctly.
- (e_scroll_frame_size_allocate): If the available space for the
- child is less than the width/height of the frame, give the child
- an allocation of 0 rather than some small negative number cast to
- unsigned.
-
-2000-07-05 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (INCLUDES): Set G_LOG_DOMAIN=__FILE__ rather than
- "e-title-bar" in all three widgets.
-
-2000-06-13 Anders Carlsson <andersca@gnu.org>
-
- * e-scroll-frame.c (e_scroll_frame_button_press): Control does
- horizontal scrolling, a la gimp.
-
-2000-06-11 Anders Carlsson <andersca@gnu.org>
-
- * e-scroll-frame.c (e_scroll_frame_button_press): Add support
- for mouse wheel scrolling in EScrollFrame.
-
-2000-06-10 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-title-bar.c (close_button_realize_cb): Unref the pixmap and
- the mask.
-
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
deleted file mode 100644
index 9ea28e8f38..0000000000
--- a/widgets/misc/Makefile.am
+++ /dev/null
@@ -1,135 +0,0 @@
-# FIXME we use the EClippedLabel widget from EShortcutBar. Probably
-# it should be moved somewhere else.
-
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets/shortcut-bar \
- -DMAP_DIR=\""$(datadir)/images/evolution"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DG_LOG_DOMAIN=__FILE__ \
- $(GNOME_FULL_CFLAGS)
-
-privlib_LIBRARIES = \
- libemiscwidgets.a
-
-widgetsincludedir = $(includedir)/evolution/widgets
-
-widgetsinclude_HEADERS = \
- e-calendar.h \
- e-calendar-item.h \
- e-cell-date-edit.h \
- e-cell-percent.h \
- e-charset-picker.h \
- e-clipped-label.h \
- e-config-page.h \
- e-combo-button.h \
- e-dateedit.h \
- e-dropdown-button.h \
- e-map.h \
- e-messagebox.h \
- e-multi-config-dialog.h \
- e-search-bar.h \
- e-title-bar.h \
- e-url-entry.h
-
-libemiscwidgets_a_SOURCES = \
- $(widgetsinclude_HEADERS) \
- e-calendar.c \
- e-calendar-item.c \
- e-cell-date-edit.c \
- e-cell-percent.c \
- e-charset-picker.c \
- e-clipped-label.c \
- e-config-page.c \
- e-combo-button.c \
- e-dateedit.c \
- e-dropdown-button.c \
- e-map.c \
- e-messagebox.c \
- e-multi-config-dialog.c \
- e-search-bar.c \
- e-title-bar.c \
- e-url-entry.c \
- e-util-marshal.c
-
-# GLib marshalling cruft
-
-e-util-marshal.h: e-util-marshal.list
- ( @GLIB_GENMARSHAL@ --prefix=e_util_marshal e-util-marshal.list --header > e-util-marshal.tmp \
- && mv e-util-marshal.tmp e-util-marshal.h ) \
- || ( rm -f e-util-marshal.tmp && exit 1 )
-
-e-util-marshal.c: e-util-marshal.h
- ( @GLIB_GENMARSHAL@ --prefix=e_util_marshal e-util-marshal.list --body > e-util-marshal.tmp \
- && mv e-util-marshal.tmp e-util-marshal.c ) \
- || ( rm -f e-util-marshal.tmp && exit 1 )
-
-MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h
-
-libemiscwidgets_a_LIBADD = $(top_builddir)/e-util/libeutil.la
-
-noinst_LIBRARIES = libefilterbar.a
-
-libefilterbar_a_SOURCES = \
- e-filter-bar.c \
- e-filter-bar.h
-
-noinst_PROGRAMS = \
- test-calendar \
- test-dateedit \
- test-dropdown-button \
- test-multi-config-dialog \
- test-title-bar
-
-# test-calendar
-
-test_calendar_SOURCES = \
- test-calendar.c
-
-test_calendar_LDADD = \
- ./libemiscwidgets.a \
- ../../e-util/libeutil.la \
- $(GNOME_FULL_LIBS)
-
-# test-dateedit
-
-test_dateedit_SOURCES = \
- test-dateedit.c
-
-test_dateedit_LDADD = \
- ./libemiscwidgets.a \
- ../../e-util/libeutil.la \
- $(GNOME_FULL_LIBS)
-
-# test-dropdown-button
-
-test_dropdown_button_SOURCES = \
- test-dropdown-button.c
-
-test_dropdown_button_LDADD = \
- ./libemiscwidgets.a \
- $(GNOME_FULL_LIBS)
-
-# test-multi-config-dialog
-
-test_multi_config_dialog_SOURCES = \
- test-multi-config-dialog.c
-
-test_multi_config_dialog_LDADD = \
- ./libemiscwidgets.a \
- $(GNOME_FULL_LIBS)
-
-# test-title-bar
-
-test_title_bar_SOURCES = \
- test-title-bar.c
-
-test_title_bar_LDADD = \
- ./libemiscwidgets.a \
- $(GNOME_FULL_LIBS)
-
-
-BUILT_SOURCES = $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = e-book-marshal.list
diff --git a/widgets/misc/e-bonobo-widget.c b/widgets/misc/e-bonobo-widget.c
deleted file mode 100644
index 3ace72a4af..0000000000
--- a/widgets/misc/e-bonobo-widget.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-bonobo-widget.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Michael Meeks <michael@ximian.com>
- * Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-bonobo-widget.h"
-
-#include <bonobo/bonobo-control.h>
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdktypes.h>
-
-
-#define PARENT_TYPE bonobo_widget_get_type ()
-static BonoboWidgetClass *parent_class = NULL;
-
-
-static void
-class_init (GtkObjectClass *object_class)
-{
- parent_class = g_type_class_ref(PARENT_TYPE);
-
- /* No method to override. */
-}
-
-static void
-init (EBonoboWidget *bonobo_widget)
-{
- /* Nothing to initialize. */
-}
-
-
-static void
-evolution_toplevel_property_get_fn (BonoboPropertyBag *bag,
- BonoboArg *arg,
- unsigned int arg_id,
- CORBA_Environment *ev,
- void *data)
-{
- BonoboControlFrame *frame;
- GtkWidget *toplevel;
- char *id;
-
- frame = BONOBO_CONTROL_FRAME (data);
-
- toplevel = bonobo_control_frame_get_widget (frame);
- while (toplevel->parent != NULL)
- toplevel = toplevel->parent;
-
- if (BONOBO_IS_CONTROL (toplevel)) {
- Bonobo_PropertyBag toplevel_property_bag;
-
- toplevel_property_bag = bonobo_control_get_ambient_properties (BONOBO_CONTROL (toplevel), NULL);
- if (toplevel_property_bag == CORBA_OBJECT_NIL)
- goto error;
-
- id = bonobo_property_bag_client_get_value_string (toplevel_property_bag,
- E_BONOBO_WIDGET_TOPLEVEL_PROPERTY_ID,
- NULL);
- if (id == NULL)
- goto error;
-
- *(char **)arg->_value = id;
- return;
- }
-
- id = bonobo_control_windowid_from_x11 (GDK_WINDOW_XWINDOW (toplevel->window));
- *(char **)arg->_value = CORBA_string_dup (id);
- g_free (id);
-
- return;
-
- error:
- /* FIXME: exception? */
- *(char **)arg->_value = CORBA_string_dup ("");
-}
-
-static void
-setup_toplevel_property (EBonoboWidget *widget)
-{
- BonoboPropertyBag *property_bag;
- BonoboControlFrame *control_frame;
-
- control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));
-
- if (!(property_bag = bonobo_control_frame_get_propbag (control_frame))) {
- property_bag = bonobo_property_bag_new (NULL, NULL, NULL);
- bonobo_control_frame_set_propbag (control_frame, property_bag);
- }
-
- /* FIXME: Kill property bag when the frame dies. */
-
- bonobo_property_bag_add_full (property_bag, E_BONOBO_WIDGET_TOPLEVEL_PROPERTY_ID, 0,
- TC_Bonobo_Control_windowId,
- NULL, "Toplevel Window ID",
- BONOBO_PROPERTY_READABLE,
- evolution_toplevel_property_get_fn, NULL,
- control_frame);
-}
-
-
-EBonoboWidget *
-e_bonobo_widget_construct_control_from_objref (EBonoboWidget *widget,
- Bonobo_Control control,
- Bonobo_UIContainer uic)
-{
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (E_IS_BONOBO_WIDGET (widget), NULL);
-
- if (bonobo_widget_construct_control_from_objref (BONOBO_WIDGET (widget), control, uic) == NULL)
- return NULL;
-
- setup_toplevel_property (widget);
- return widget;
-}
-
-EBonoboWidget *
-e_bonobo_widget_construct_control (EBonoboWidget *widget,
- const char *moniker,
- Bonobo_UIContainer uic)
-{
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (E_IS_BONOBO_WIDGET (widget), NULL);
- g_return_val_if_fail (moniker != NULL, NULL);
-
- if (bonobo_widget_construct_control (BONOBO_WIDGET (widget), moniker, uic) == NULL)
- return NULL;
-
- setup_toplevel_property (widget);
-
- return widget;
-}
-
-
-GtkWidget *
-e_bonobo_widget_new_control (const char *moniker,
- Bonobo_UIContainer uic)
-{
- EBonoboWidget *widget;
-
- g_return_val_if_fail (moniker != NULL, NULL);
-
- widget = gtk_type_new (e_bonobo_widget_get_type ());
- widget = e_bonobo_widget_construct_control (widget, moniker, uic);
-
- if (widget == NULL)
- return NULL;
-
- return GTK_WIDGET (widget);
-}
-
-GtkWidget *
-e_bonobo_widget_new_control_from_objref (Bonobo_Control control,
- Bonobo_UIContainer uic)
-{
- EBonoboWidget *widget;
-
- g_return_val_if_fail (control != CORBA_OBJECT_NIL, NULL);
-
- widget = gtk_type_new (E_TYPE_BONOBO_WIDGET);
-
- widget = e_bonobo_widget_construct_control_from_objref (widget, control, uic);
- if (widget == NULL)
- return NULL;
-
- return GTK_WIDGET (widget);
-}
-
-
-E_MAKE_TYPE (e_bonobo_widget, "EBonoboWidget", EBonoboWidget, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-bonobo-widget.h b/widgets/misc/e-bonobo-widget.h
deleted file mode 100644
index f5ac818c6f..0000000000
--- a/widgets/misc/e-bonobo-widget.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-bonobo-widget.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef _E_BONOBO_WIDGET_H_
-#define _E_BONOBO_WIDGET_H_
-
-#include <bonobo/bonobo-widget.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_BONOBO_WIDGET (e_bonobo_widget_get_type ())
-#define E_BONOBO_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_BONOBO_WIDGET, EBonoboWidget))
-#define E_BONOBO_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_BONOBO_WIDGET, EBonoboWidgetClass))
-#define E_IS_BONOBO_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_BONOBO_WIDGET))
-#define E_IS_BONOBO_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_BONOBO_WIDGET))
-
-
-typedef struct _EBonoboWidget EBonoboWidget;
-typedef struct _EBonoboWidgetPrivate EBonoboWidgetPrivate;
-typedef struct _EBonoboWidgetClass EBonoboWidgetClass;
-
-struct _EBonoboWidget {
- BonoboWidget parent;
-
- EBonoboWidgetPrivate *priv;
-};
-
-struct _EBonoboWidgetClass {
- BonoboWidgetClass parent_class;
-};
-
-
-#define E_BONOBO_WIDGET_TOPLEVEL_PROPERTY_ID "bonobo:toplevel"
-
-
-GtkType e_bonobo_widget_get_type (void);
-EBonoboWidget *e_bonobo_widget_construct_control_from_objref (EBonoboWidget *widget,
- Bonobo_Control control,
- Bonobo_UIContainer uic);
-EBonoboWidget *e_bonobo_widget_construct_control (EBonoboWidget *widget,
- const char *moniker,
- Bonobo_UIContainer uic);
-GtkWidget *e_bonobo_widget_new_control (const char *moniker,
- Bonobo_UIContainer uic);
-GtkWidget *e_bonobo_widget_new_control_from_objref (Bonobo_Control control,
- Bonobo_UIContainer uic);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_BONOBO_WIDGET_H_ */
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
deleted file mode 100644
index 5431c5c24c..0000000000
--- a/widgets/misc/e-calendar-item.c
+++ /dev/null
@@ -1,2959 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECalendarItem - canvas item displaying a calendar.
- */
-
-#include <config.h>
-
-#include "e-calendar-item.h"
-
-#include <time.h>
-#include <string.h>
-#include <glib.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/util/e-util.h>
-
-/*
- * These are the padding sizes between various pieces of the calendar.
- */
-
-/* The minimum padding around the numbers in each cell/day. */
-#define E_CALENDAR_ITEM_MIN_CELL_XPAD 4
-#define E_CALENDAR_ITEM_MIN_CELL_YPAD 0
-
-/* Vertical padding. */
-#define E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS 1
-#define E_CALENDAR_ITEM_YPAD_BELOW_DAY_LETTERS 0
-#define E_CALENDAR_ITEM_YPAD_ABOVE_CELLS 1
-#define E_CALENDAR_ITEM_YPAD_BELOW_CELLS 2
-
-/* Horizontal padding in the heading bars. */
-#define E_CALENDAR_ITEM_XPAD_BEFORE_MONTH_NAME_WITH_BUTTON 16
-#define E_CALENDAR_ITEM_XPAD_BEFORE_MONTH_NAME 3
-#define E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME 3
-#define E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME_WITH_BUTTON 16
-
-/* Horizontal padding in the month displays. */
-#define E_CALENDAR_ITEM_XPAD_BEFORE_WEEK_NUMBERS 4
-#define E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS 2
-#define E_CALENDAR_ITEM_XPAD_BEFORE_CELLS 1
-#define E_CALENDAR_ITEM_XPAD_AFTER_CELLS 4
-
-/* The number of rows & columns of days in each month. */
-#define E_CALENDAR_ROWS_PER_MONTH 6
-#define E_CALENDAR_COLS_PER_MONTH 7
-
-static const int e_calendar_item_days_in_month[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-#define DAYS_IN_MONTH(year, month) \
- e_calendar_item_days_in_month[month] + (((month) == 1 \
- && ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))) ? 1 : 0)
-
-
-static void e_calendar_item_class_init (ECalendarItemClass *class);
-static void e_calendar_item_init (ECalendarItem *calitem);
-static void e_calendar_item_destroy (GtkObject *o);
-static void e_calendar_item_get_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id);
-static void e_calendar_item_set_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id);
-static void e_calendar_item_realize (GnomeCanvasItem *item);
-static void e_calendar_item_unrealize (GnomeCanvasItem *item);
-static void e_calendar_item_unmap (GnomeCanvasItem *item);
-static void e_calendar_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path,
- int flags);
-static void e_calendar_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
- int x,
- int y,
- int width,
- int height);
-static void e_calendar_item_draw_month (ECalendarItem *calitem,
- GdkDrawable *drawable,
- int x,
- int y,
- int width,
- int height,
- int row,
- int col);
-static void e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
- GdkDrawable *drawable,
- int width,
- int height,
- int row,
- int col,
- int year,
- int month,
- int start_weekday,
- gint cells_x,
- gint cells_y);
-static double e_calendar_item_point (GnomeCanvasItem *item,
- double x,
- double y,
- int cx,
- int cy,
- GnomeCanvasItem **actual_item);
-static gint e_calendar_item_event (GnomeCanvasItem *item,
- GdkEvent *event);
-static gboolean e_calendar_item_button_press (ECalendarItem *calitem,
- GdkEvent *event);
-static gboolean e_calendar_item_button_release (ECalendarItem *calitem,
- GdkEvent *event);
-static gboolean e_calendar_item_motion (ECalendarItem *calitem,
- GdkEvent *event);
-
-static gboolean e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
- gint x,
- gint y,
- gboolean round_empty_positions,
- gint *month_offset,
- gint *day,
- gboolean *entire_week);
-static void e_calendar_item_get_month_info (ECalendarItem *calitem,
- gint row,
- gint col,
- gint *first_day_offset,
- gint *days_in_month,
- gint *days_in_prev_month);
-static void e_calendar_item_recalc_sizes(ECalendarItem *calitem);
-
-static gint e_calendar_item_get_week_number (ECalendarItem *calitem,
- gint day,
- gint month,
- gint year);
-
-static void e_calendar_item_get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold);
-static void e_calendar_item_check_selection_end (ECalendarItem *calitem,
- gint start_month,
- gint start_day,
- gint *end_month,
- gint *end_day);
-static void e_calendar_item_check_selection_start(ECalendarItem *calitem,
- gint *start_month,
- gint *start_day,
- gint end_month,
- gint end_day);
-static void e_calendar_item_normalize_date (ECalendarItem *calitem,
- gint *year,
- gint *month);
-static void e_calendar_item_add_days_to_selection(ECalendarItem *calitem,
- gint days);
-static void e_calendar_item_round_up_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static void e_calendar_item_round_down_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static gint e_calendar_item_get_inclusive_days (ECalendarItem *calitem,
- gint start_month_offset,
- gint start_day,
- gint end_month_offset,
- gint end_day);
-static void e_calendar_item_ensure_valid_day (ECalendarItem *calitem,
- gint *month_offset,
- gint *day);
-static gboolean e_calendar_item_ensure_days_visible (ECalendarItem *calitem,
- gint start_year,
- gint start_month,
- gint start_day,
- gint end_year,
- gint end_month,
- gint end_day);
-static void e_calendar_item_show_popup_menu (ECalendarItem *calitem,
- GdkEventButton *event,
- gint month_offset);
-static void e_calendar_item_on_menu_item_activate(GtkWidget *menuitem,
- ECalendarItem *calitem);
-static void e_calendar_item_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data);
-static void e_calendar_item_date_range_changed (ECalendarItem *calitem);
-static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem);
-static gboolean e_calendar_item_signal_emission_idle_cb (gpointer data);
-
-/* Our arguments. */
-enum {
- ARG_0,
- ARG_YEAR,
- ARG_MONTH,
- ARG_X1,
- ARG_Y1,
- ARG_X2,
- ARG_Y2,
- ARG_FONT,
- ARG_WEEK_NUMBER_FONT,
- ARG_ROW_HEIGHT,
- ARG_COLUMN_WIDTH,
- ARG_MINIMUM_ROWS,
- ARG_MINIMUM_COLUMNS,
- ARG_MAXIMUM_ROWS,
- ARG_MAXIMUM_COLUMNS,
- ARG_WEEK_START_DAY,
- ARG_SHOW_WEEK_NUMBERS,
- ARG_MAXIMUM_DAYS_SELECTED,
- ARG_DAYS_TO_START_WEEK_SELECTION,
- ARG_MOVE_SELECTION_WHEN_MOVING,
- ARG_ROUND_SELECTION_WHEN_MOVING,
- ARG_DISPLAY_POPUP
-};
-
-enum {
- DATE_RANGE_CHANGED,
- SELECTION_CHANGED,
- LAST_SIGNAL
-};
-
-
-static GnomeCanvasItemClass *parent_class;
-static guint e_calendar_item_signals[LAST_SIGNAL] = { 0 };
-
-
-E_MAKE_TYPE (e_calendar_item, "ECalendarItem", ECalendarItem,
- e_calendar_item_class_init, e_calendar_item_init,
- GNOME_TYPE_CANVAS_ITEM)
-
-
-static void
-e_calendar_item_class_init (ECalendarItemClass *class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- parent_class = g_type_class_ref(gnome_canvas_item_get_type());
-
- object_class = (GtkObjectClass *) class;
- item_class = (GnomeCanvasItemClass *) class;
-
- gtk_object_add_arg_type ("ECalendarItem::year",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_YEAR);
- gtk_object_add_arg_type ("ECalendarItem::month",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MONTH);
- gtk_object_add_arg_type ("ECalendarItem::x1",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
- ARG_X1);
- gtk_object_add_arg_type ("ECalendarItem::y1",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
- ARG_Y1);
- gtk_object_add_arg_type ("ECalendarItem::x2",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
- ARG_X2);
- gtk_object_add_arg_type ("ECalendarItem::y2",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
- ARG_Y2);
- gtk_object_add_arg_type ("ECalendarItem::font",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE,
- ARG_FONT);
- gtk_object_add_arg_type ("ECalendarItem::week_number_font",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE,
- ARG_WEEK_NUMBER_FONT);
- gtk_object_add_arg_type ("ECalendarItem::row_height",
- GTK_TYPE_INT, GTK_ARG_READABLE,
- ARG_ROW_HEIGHT);
- gtk_object_add_arg_type ("ECalendarItem::column_width",
- GTK_TYPE_INT, GTK_ARG_READABLE,
- ARG_COLUMN_WIDTH);
- gtk_object_add_arg_type ("ECalendarItem::minimum_rows",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MINIMUM_ROWS);
- gtk_object_add_arg_type ("ECalendarItem::minimum_columns",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MINIMUM_COLUMNS);
- gtk_object_add_arg_type ("ECalendarItem::maximum_rows",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MAXIMUM_ROWS);
- gtk_object_add_arg_type ("ECalendarItem::maximum_columns",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MAXIMUM_COLUMNS);
- gtk_object_add_arg_type ("ECalendarItem::week_start_day",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_WEEK_START_DAY);
- gtk_object_add_arg_type ("ECalendarItem::show_week_numbers",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_SHOW_WEEK_NUMBERS);
- gtk_object_add_arg_type ("ECalendarItem::maximum_days_selected",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_MAXIMUM_DAYS_SELECTED);
- gtk_object_add_arg_type ("ECalendarItem::days_to_start_week_selection",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_DAYS_TO_START_WEEK_SELECTION);
- gtk_object_add_arg_type ("ECalendarItem::move_selection_when_moving",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_MOVE_SELECTION_WHEN_MOVING);
- gtk_object_add_arg_type ("ECalendarItem::round_selection_when_moving",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_ROUND_SELECTION_WHEN_MOVING);
- gtk_object_add_arg_type ("ECalendarItem::display_popup",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_DISPLAY_POPUP);
-
- e_calendar_item_signals[DATE_RANGE_CHANGED] =
- gtk_signal_new ("date_range_changed",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ECalendarItemClass, date_range_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- e_calendar_item_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ECalendarItemClass, selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- object_class->destroy = e_calendar_item_destroy;
- object_class->get_arg = e_calendar_item_get_arg;
- object_class->set_arg = e_calendar_item_set_arg;
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_calendar_item_realize;
- item_class->unrealize = e_calendar_item_unrealize;
- item_class->unmap = e_calendar_item_unmap;
- item_class->update = e_calendar_item_update;
- item_class->draw = e_calendar_item_draw;
- item_class->point = e_calendar_item_point;
- item_class->event = e_calendar_item_event;
-
- class->date_range_changed = NULL;
- class->selection_changed = NULL;
-}
-
-
-static void
-e_calendar_item_init (ECalendarItem *calitem)
-{
- struct tm *tmp_tm;
- time_t t;
-
- /* Set the default time to the current month. */
- t = time (NULL);
- tmp_tm = localtime (&t);
- calitem->year = tmp_tm->tm_year + 1900;
- calitem->month = tmp_tm->tm_mon;
-
- calitem->styles = NULL;
-
- calitem->min_cols = 1;
- calitem->min_rows = 1;
- calitem->max_cols = -1;
- calitem->max_rows = -1;
-
- calitem->rows = 0;
- calitem->cols = 0;
-
- calitem->show_week_numbers = FALSE;
- calitem->week_start_day = 0;
- calitem->expand = TRUE;
- calitem->max_days_selected = 1;
- calitem->days_to_start_week_selection = -1;
- calitem->move_selection_when_moving = TRUE;
- calitem->round_selection_when_moving = FALSE;
- calitem->display_popup = TRUE;
-
- calitem->x1 = 0.0;
- calitem->y1 = 0.0;
- calitem->x2 = 0.0;
- calitem->y2 = 0.0;
-
- calitem->selection_set = FALSE;
-
- calitem->selection_changed = FALSE;
- calitem->date_range_changed = FALSE;
-
- calitem->style_callback = NULL;
- calitem->style_callback_data = NULL;
- calitem->style_callback_destroy = NULL;
-
- calitem->time_callback = NULL;
- calitem->time_callback_data = NULL;
- calitem->time_callback_destroy = NULL;
-
- /* Translators: These are the first characters of each day of the
- week, 'M' for 'Monday', 'T' for Tuesday etc. */
- calitem->days = _("MTWTFSS");
-
- calitem->signal_emission_idle_id = 0;
-}
-
-
-static void
-e_calendar_item_destroy (GtkObject *o)
-{
- ECalendarItem *calitem;
-
- calitem = E_CALENDAR_ITEM (o);
-
- e_calendar_item_set_style_callback (calitem, NULL, NULL, NULL);
- e_calendar_item_set_get_time_callback (calitem, NULL, NULL, NULL);
-
- g_free (calitem->styles);
-
- if (calitem->signal_emission_idle_id != 0) {
- g_source_remove (calitem->signal_emission_idle_id);
- calitem->signal_emission_idle_id = 0;
- }
-
- if (calitem->old_font)
- gdk_font_unref (calitem->old_font);
- if (calitem->old_week_number_font)
- gdk_font_unref (calitem->old_week_number_font);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (o);
-}
-
-
-static void
-e_calendar_item_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ECalendarItem *calitem;
-
- item = GNOME_CANVAS_ITEM (o);
- calitem = E_CALENDAR_ITEM (o);
-
- switch (arg_id) {
- case ARG_YEAR:
- GTK_VALUE_INT (*arg) = calitem->year;
- break;
- case ARG_MONTH:
- GTK_VALUE_INT (*arg) = calitem->month;
- break;
- case ARG_X1:
- GTK_VALUE_DOUBLE (*arg) = calitem->x1;
- break;
- case ARG_Y1:
- GTK_VALUE_DOUBLE (*arg) = calitem->y1;
- break;
- case ARG_X2:
- GTK_VALUE_DOUBLE (*arg) = calitem->x2;
- break;
- case ARG_Y2:
- GTK_VALUE_DOUBLE (*arg) = calitem->y2;
- break;
- case ARG_FONT:
- GTK_VALUE_BOXED (*arg) = calitem->font;
- break;
- case ARG_WEEK_NUMBER_FONT:
- GTK_VALUE_BOXED (*arg) = calitem->week_number_font;
- break;
- case ARG_ROW_HEIGHT:
- e_calendar_item_recalc_sizes (calitem);
- GTK_VALUE_INT (*arg) = calitem->min_month_height;
- break;
- case ARG_COLUMN_WIDTH:
- e_calendar_item_recalc_sizes (calitem);
- GTK_VALUE_INT (*arg) = calitem->min_month_width;
- break;
- case ARG_MINIMUM_ROWS:
- GTK_VALUE_INT (*arg) = calitem->min_rows;
- break;
- case ARG_MINIMUM_COLUMNS:
- GTK_VALUE_INT (*arg) = calitem->min_cols;
- break;
- case ARG_MAXIMUM_ROWS:
- GTK_VALUE_INT (*arg) = calitem->max_rows;
- break;
- case ARG_MAXIMUM_COLUMNS:
- GTK_VALUE_INT (*arg) = calitem->max_cols;
- break;
- case ARG_WEEK_START_DAY:
- GTK_VALUE_INT (*arg) = calitem->week_start_day;
- break;
- case ARG_SHOW_WEEK_NUMBERS:
- GTK_VALUE_BOOL (*arg) = calitem->show_week_numbers;
- break;
- case ARG_MAXIMUM_DAYS_SELECTED:
- GTK_VALUE_INT (*arg) = e_calendar_item_get_max_days_sel (calitem);
- break;
- case ARG_DAYS_TO_START_WEEK_SELECTION:
- GTK_VALUE_INT (*arg) = e_calendar_item_get_days_start_week_sel (calitem);
- break;
- case ARG_MOVE_SELECTION_WHEN_MOVING:
- GTK_VALUE_BOOL (*arg) = calitem->move_selection_when_moving;
- break;
- case ARG_ROUND_SELECTION_WHEN_MOVING:
- GTK_VALUE_BOOL (*arg) = calitem->round_selection_when_moving;
- break;
- case ARG_DISPLAY_POPUP:
- GTK_VALUE_BOOL (*arg) = e_calendar_item_get_display_popup (calitem);
- break;
- default:
- g_warning ("Invalid arg");
- }
-}
-
-
-static void
-e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ECalendarItem *calitem;
- GdkFont *font;
- gboolean need_update = FALSE;
- gdouble dvalue;
- gint ivalue;
- gboolean bvalue;
-
- item = GNOME_CANVAS_ITEM (o);
- calitem = E_CALENDAR_ITEM (o);
-
- switch (arg_id){
- case ARG_YEAR:
- ivalue = GTK_VALUE_INT (*arg);
- e_calendar_item_set_first_month (calitem, ivalue,
- calitem->month);
- break;
- case ARG_MONTH:
- ivalue = GTK_VALUE_INT (*arg);
- e_calendar_item_set_first_month (calitem, calitem->year,
- ivalue);
- break;
- case ARG_X1:
- dvalue = GTK_VALUE_DOUBLE (*arg);
- if (calitem->x1 != dvalue) {
- calitem->x1 = dvalue;
- need_update = TRUE;
- }
- break;
- case ARG_Y1:
- dvalue = GTK_VALUE_DOUBLE (*arg);
- if (calitem->y1 != dvalue) {
- calitem->y1 = dvalue;
- need_update = TRUE;
- }
- break;
- case ARG_X2:
- dvalue = GTK_VALUE_DOUBLE (*arg);
- if (calitem->x2 != dvalue) {
- calitem->x2 = dvalue;
- need_update = TRUE;
- }
- break;
- case ARG_Y2:
- dvalue = GTK_VALUE_DOUBLE (*arg);
- if (calitem->y2 != dvalue) {
- calitem->y2 = dvalue;
- need_update = TRUE;
- }
- break;
- case ARG_FONT:
- font = GTK_VALUE_BOXED (*arg);
- if (calitem->font != font) {
- if (calitem->font)
- gdk_font_unref (calitem->font);
- calitem->font = font;
- if (font)
- gdk_font_ref (font);
- need_update = TRUE;
- }
- break;
- case ARG_WEEK_NUMBER_FONT:
- font = GTK_VALUE_BOXED (*arg);
- if (calitem->week_number_font != font) {
- if (calitem->week_number_font)
- gdk_font_unref (calitem->week_number_font);
- calitem->week_number_font = font;
- if (font)
- gdk_font_ref (font);
- need_update = TRUE;
- }
- break;
- case ARG_MINIMUM_ROWS:
- ivalue = GTK_VALUE_INT (*arg);
- ivalue = MAX (1, ivalue);
- if (calitem->min_rows != ivalue) {
- calitem->min_rows = ivalue;
- need_update = TRUE;
- }
- break;
- case ARG_MINIMUM_COLUMNS:
- ivalue = GTK_VALUE_INT (*arg);
- ivalue = MAX (1, ivalue);
- if (calitem->min_cols != ivalue) {
- calitem->min_cols = ivalue;
- need_update = TRUE;
- }
- break;
- case ARG_MAXIMUM_ROWS:
- ivalue = GTK_VALUE_INT (*arg);
- if (calitem->max_rows != ivalue) {
- calitem->max_rows = ivalue;
- need_update = TRUE;
- }
- break;
- case ARG_MAXIMUM_COLUMNS:
- ivalue = GTK_VALUE_INT (*arg);
- if (calitem->max_cols != ivalue) {
- calitem->max_cols = ivalue;
- need_update = TRUE;
- }
- break;
- case ARG_WEEK_START_DAY:
- ivalue = GTK_VALUE_INT (*arg);
- if (calitem->week_start_day != ivalue) {
- calitem->week_start_day = ivalue;
- need_update = TRUE;
- }
- break;
- case ARG_SHOW_WEEK_NUMBERS:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (calitem->show_week_numbers != bvalue) {
- calitem->show_week_numbers = bvalue;
- need_update = TRUE;
- }
- break;
- case ARG_MAXIMUM_DAYS_SELECTED:
- ivalue = GTK_VALUE_INT (*arg);
- e_calendar_item_set_max_days_sel (calitem, ivalue);
- break;
- case ARG_DAYS_TO_START_WEEK_SELECTION:
- ivalue = GTK_VALUE_INT (*arg);
- e_calendar_item_set_days_start_week_sel (calitem, ivalue);
- break;
- case ARG_MOVE_SELECTION_WHEN_MOVING:
- bvalue = GTK_VALUE_BOOL (*arg);
- calitem->move_selection_when_moving = bvalue;
- break;
- case ARG_ROUND_SELECTION_WHEN_MOVING:
- bvalue = GTK_VALUE_BOOL (*arg);
- calitem->round_selection_when_moving = bvalue;
- break;
- case ARG_DISPLAY_POPUP:
- bvalue = GTK_VALUE_BOOL (*arg);
- e_calendar_item_set_display_popup (calitem, bvalue);
- break;
- default:
- g_warning ("Invalid arg");
- }
-
- if (need_update) {
- gnome_canvas_item_request_update (item);
- }
-}
-
-
-static void
-e_calendar_item_realize (GnomeCanvasItem *item)
-{
- ECalendarItem *calitem;
- GdkColormap *colormap;
- gboolean success[E_CALENDAR_ITEM_COLOR_LAST];
- gint nfailed;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) (item);
-
- calitem = E_CALENDAR_ITEM (item);
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
-
- calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].red = 65535;
- calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].green = 0;
- calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].blue = 0;
-
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].red = 65535;
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].green = 65535;
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].blue = 65535;
-
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].red = 47000;
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].green = 47000;
- calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].blue = 48000;
-
- calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].red = 47000;
- calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].green = 47000;
- calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].blue = 48000;
-
- nfailed = gdk_colormap_alloc_colors (colormap, calitem->colors,
- E_CALENDAR_ITEM_COLOR_LAST, FALSE,
- TRUE, success);
- if (nfailed)
- g_warning ("Failed to allocate all colors");
-}
-
-
-static void
-e_calendar_item_unrealize (GnomeCanvasItem *item)
-{
- ECalendarItem *calitem;
- GdkColormap *colormap;
- gint i;
-
- calitem = E_CALENDAR_ITEM (item);
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
-
- for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++) {
- /* FIXME: gdk_colors_free expects gulong* here but the pixel value in GdkColor
- is guint32. GDK bug? */
- gdk_colors_free (colormap, (gulong *) &calitem->colors[i].pixel, 1, 0);
- }
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
-}
-
-
-static void
-e_calendar_item_unmap (GnomeCanvasItem *item)
-{
- ECalendarItem *calitem;
-
- calitem = E_CALENDAR_ITEM (item);
-
- if (calitem->selecting) {
- gnome_canvas_item_ungrab (item, GDK_CURRENT_TIME);
- calitem->selecting = FALSE;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unmap)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->unmap) (item);
-}
-
-
-static void
-e_calendar_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path,
- int flags)
-{
- ECalendarItem *calitem;
- GtkStyle *style;
- GdkFont *font;
- gint char_height, width, height, space, space_per_cal, space_per_cell;
- gint rows, cols, xthickness, ythickness;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags);
-
- calitem = E_CALENDAR_ITEM (item);
- style = GTK_WIDGET (item->canvas)->style;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
-
- item->x1 = calitem->x1;
- item->y1 = calitem->y1;
- item->x2 = calitem->x2 >= calitem->x1 ? calitem->x2 : calitem->x1;
- item->y2 = calitem->y2 >= calitem->y1 ? calitem->y2 : calitem->y1;
-
- /*
- * Calculate the new layout of the calendar.
- */
-
- /* Make sure the minimum row width & cell height and the widths of
- all the digits and characters are up to date. */
- e_calendar_item_recalc_sizes (calitem);
-
- /* Calculate how many rows & cols we can fit in. */
- width = item->x2 - item->x1;
- height = item->y2 - item->y1;
-
- width -= xthickness * 2;
- height -= ythickness * 2;
-
- if (calitem->min_month_height == 0)
- rows = 1;
- else
- rows = height / calitem->min_month_height;
- rows = MAX (rows, calitem->min_rows);
- if (calitem->max_rows > 0)
- rows = MIN (rows, calitem->max_rows);
-
- if (calitem->min_month_width == 0)
- cols = 1;
- else
- cols = width / calitem->min_month_width;
- cols = MAX (cols, calitem->min_cols);
- if (calitem->max_cols > 0)
- cols = MIN (cols, calitem->max_cols);
-
- if (rows != calitem->rows || cols != calitem->cols)
- e_calendar_item_date_range_changed (calitem);
-
- calitem->rows = rows;
- calitem->cols = cols;
-
- /* Split up the empty space according to the configuration.
- If the calendar is set to expand, we divide the space between the
- cells and the spaces around the calendar, otherwise we place the
- calendars in the center of the available area. */
-
- font = calitem->font;
- if (!font)
- font = gtk_style_get_font (style);
- char_height = font->ascent + font->descent;
-
- calitem->month_width = calitem->min_month_width;
- calitem->month_height = calitem->min_month_height;
- calitem->cell_width = calitem->max_digit_width * 2
- + E_CALENDAR_ITEM_MIN_CELL_XPAD;
- calitem->cell_height = char_height
- + E_CALENDAR_ITEM_MIN_CELL_YPAD;
- calitem->month_tpad = 0;
- calitem->month_bpad = 0;
- calitem->month_lpad = 0;
- calitem->month_rpad = 0;
-
- space = height - calitem->rows * calitem->month_height;
- if (space > 0) {
- space_per_cal = space / calitem->rows;
- calitem->month_height += space_per_cal;
-
- if (calitem->expand) {
- space_per_cell = space_per_cal / E_CALENDAR_ROWS_PER_MONTH;
- calitem->cell_height += space_per_cell;
- space_per_cal -= space_per_cell * E_CALENDAR_ROWS_PER_MONTH;
- }
-
- calitem->month_tpad = space_per_cal / 2;
- calitem->month_bpad = space_per_cal - calitem->month_tpad;
- }
-
- space = width - calitem->cols * calitem->month_width;
- if (space > 0) {
- space_per_cal = space / calitem->cols;
- calitem->month_width += space_per_cal;
- space -= space_per_cal * calitem->cols;
-
- if (calitem->expand) {
- space_per_cell = space_per_cal / E_CALENDAR_COLS_PER_MONTH;
- calitem->cell_width += space_per_cell;
- space_per_cal -= space_per_cell * E_CALENDAR_COLS_PER_MONTH;
- }
-
- calitem->month_lpad = space_per_cal / 2;
- calitem->month_rpad = space_per_cal - calitem->month_lpad;
- }
-
- space = MAX (0, space);
- calitem->x_offset = space / 2;
-
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
- item->x2, item->y2);
-}
-
-
-/*
- * DRAWING ROUTINES - functions to paint the canvas item.
- */
-
-static void
-e_calendar_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
- int x,
- int y,
- int width,
- int height)
-{
- ECalendarItem *calitem;
- GtkStyle *style;
- GdkFont *font;
- GdkGC *base_gc, *bg_gc;
- gint char_height, row, col, row_y, bar_height, col_x;
- gint xthickness, ythickness;
-
-#if 0
- g_print ("In e_calendar_item_draw %i,%i %ix%i\n",
- x, y, width, height);
-#endif
- calitem = E_CALENDAR_ITEM (canvas_item);
- style = GTK_WIDGET (canvas_item->canvas)->style;
- font = calitem->font;
- if (!font)
- font = gtk_style_get_font (style);
- char_height = font->ascent + font->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
- base_gc = style->base_gc[GTK_STATE_NORMAL];
- bg_gc = style->bg_gc[GTK_STATE_NORMAL];
-
- /* Clear the entire background. */
- gdk_draw_rectangle (drawable, base_gc, TRUE,
- calitem->x1 - x, calitem->y1 - y,
- calitem->x2 - calitem->x1 + 1,
- calitem->y2 - calitem->y1 + 1);
-
- /* Draw the shadow around the entire item. */
- gtk_draw_shadow (style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- calitem->x1 - x, calitem->y1 - y,
- calitem->x2 - calitem->x1 + 1,
- calitem->y2 - calitem->y1 + 1);
-
- row_y = canvas_item->y1 + ythickness;
- bar_height = ythickness * 2
- + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME + char_height
- + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME;
-
- for (row = 0; row < calitem->rows; row++) {
- /* Draw the background for the title bars and the shadow around
- it, and the vertical lines between columns. */
-
- gdk_draw_rectangle (drawable, bg_gc, TRUE,
- calitem->x1 + xthickness - x, row_y - y,
- calitem->x2 - calitem->x1 + 1
- - xthickness * 2,
- bar_height);
-
- gtk_draw_shadow (style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- calitem->x1 + xthickness - x, row_y - y,
- calitem->x2 - calitem->x1 + 1
- - xthickness * 2,
- bar_height);
-
-
- for (col = 0; col < calitem->cols; col++) {
- if (col != 0) {
- col_x = calitem->x1 + calitem->x_offset
- + calitem->month_width * col;
- gtk_draw_vline (style, drawable,
- GTK_STATE_NORMAL,
- row_y + ythickness + 1 - y,
- row_y + bar_height
- - ythickness - 2 - y,
- col_x - 1 - x);
- }
-
-
- e_calendar_item_draw_month (calitem, drawable, x, y,
- width, height, row, col);
- }
-
- row_y += calitem->month_height;
- }
-}
-
-
-static void
-e_calendar_item_draw_month (ECalendarItem *calitem,
- GdkDrawable *drawable,
- int x,
- int y,
- int width,
- int height,
- int row,
- int col)
-{
- GnomeCanvasItem *item;
- GtkWidget *widget;
- GtkStyle *style;
- GdkFont *font;
- GdkGC *fg_gc;
- struct tm tmp_tm;
- GdkRectangle clip_rect;
- gint char_height, xthickness, ythickness, start_weekday;
- gint year, month;
- gint month_x, month_y, month_w, month_h;
- gint min_x, max_x, text_x, text_y;
- gint day, day_index, cells_x, cells_y, min_cell_width, text_width;
- gint clip_width, clip_height;
- gchar buffer[64];
-
-#if 0
- g_print ("In e_calendar_item_draw_month: %i,%i %ix%i row:%i col:%i\n",
- x, y, width, height, row, col);
-#endif
- item = GNOME_CANVAS_ITEM (calitem);
- widget = GTK_WIDGET (item->canvas);
- style = widget->style;
- font = calitem->font;
- if (!font)
- font = gtk_style_get_font (style);
- char_height = font->ascent + font->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
- fg_gc = style->fg_gc[GTK_STATE_NORMAL];
-
- /* Calculate the top-left position of the entire month display. */
- month_x = item->x1 + xthickness + calitem->x_offset
- + col * calitem->month_width - x;
- month_w = item->x2 - item->x1 - xthickness * 2;
- month_w = MIN (month_w, calitem->month_width);
- month_y = item->y1 + ythickness + row * calitem->month_height - y;
- month_h = item->y2 - item->y1 - ythickness * 2;
- month_h = MIN (month_h, calitem->month_height);
-
- /* Just return if the month is outside the given area. */
- if (month_x >= width || month_x + calitem->month_width <= 0
- || month_y >= height || month_y + calitem->month_height <= 0)
- return;
-
- month = calitem->month + row * calitem->cols + col;
- year = calitem->year + month / 12;
- month %= 12;
-
- /* Draw the month name & year, with clipping. Note that the top row
- needs extra space around it for the buttons. */
- if (row == 0 && col == 0)
- min_x = E_CALENDAR_ITEM_XPAD_BEFORE_MONTH_NAME_WITH_BUTTON;
- else
- min_x = E_CALENDAR_ITEM_XPAD_BEFORE_MONTH_NAME;
-
- max_x = month_w;
- if (row == 0 && col == calitem->cols - 1)
- max_x -= E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME_WITH_BUTTON;
- else
- max_x -= E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME;
-
- text_y = month_y + style->ythickness
- + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME;
- clip_rect.x = month_x + min_x;
- clip_rect.x = MAX (0, clip_rect.x);
- clip_rect.y = MAX (0, text_y);
-
- memset (&tmp_tm, 0, sizeof (tmp_tm));
- tmp_tm.tm_year = year - 1900;
- tmp_tm.tm_mon = month;
- tmp_tm.tm_mday = 1;
- tmp_tm.tm_isdst = -1;
- mktime (&tmp_tm);
- start_weekday = (tmp_tm.tm_wday + 6) % 7;
-
- if (month_x + max_x - clip_rect.x > 0) {
- clip_rect.width = month_x + max_x - clip_rect.x;
- clip_rect.height = text_y + char_height - clip_rect.y;
- gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
-
- /* This is a strftime() format. %B = Month name, %Y = Year. */
- strftime (buffer, sizeof (buffer), _("%B %Y"), &tmp_tm);
-
- /* Ideally we place the text centered in the month, but we
- won't go to the left of the minimum x position. */
- text_width = gdk_string_width (font, buffer);
- text_x = (calitem->month_width - text_width) / 2;
- text_x = MAX (min_x, text_x);
-
- gdk_draw_string (drawable, font, fg_gc,
- month_x + text_x, text_y + font->ascent, buffer);
- }
-
- /* Set the clip rectangle for the main month display. */
- clip_rect.x = MAX (0, month_x);
- clip_rect.y = MAX (0, month_y);
- clip_width = month_x + month_w - clip_rect.x;
- clip_height = month_y + month_h - clip_rect.y;
-
- if (clip_width <= 0 || clip_height <= 0)
- return;
-
- clip_rect.width = clip_width;
- clip_rect.height = clip_height;
-
- gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
-
-
- /* Draw the day initials across the top of the month. */
- min_cell_width = calitem->max_digit_width * 2
- + E_CALENDAR_ITEM_MIN_CELL_XPAD;
-
- cells_x = month_x + E_CALENDAR_ITEM_XPAD_BEFORE_WEEK_NUMBERS + calitem->month_lpad
- + E_CALENDAR_ITEM_XPAD_BEFORE_CELLS;
- if (calitem->show_week_numbers)
- cells_x += calitem->max_week_number_digit_width * 2
- + E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1;
- text_x = cells_x + calitem->cell_width
- - (calitem->cell_width - min_cell_width) / 2;
- text_x -= E_CALENDAR_ITEM_MIN_CELL_XPAD / 2;
- text_y = month_y + ythickness * 2
- + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME
- + char_height + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME
- + E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS + calitem->month_tpad;
-
- cells_y = text_y + char_height
- + E_CALENDAR_ITEM_YPAD_BELOW_DAY_LETTERS + 1
- + E_CALENDAR_ITEM_YPAD_ABOVE_CELLS;
-
- text_y += font->ascent;
- day_index = calitem->week_start_day;
- for (day = 0; day < 7; day++) {
- gdk_draw_text (drawable, font, fg_gc,
- text_x - calitem->day_widths[day_index], text_y,
- &calitem->days[day_index], 1);
- text_x += calitem->cell_width;
- day_index++;
- if (day_index == 7)
- day_index = 0;
- }
-
-
- /* Draw the horizontal line beneath the day initials. */
- gdk_draw_line (drawable, fg_gc,
- cells_x - E_CALENDAR_ITEM_XPAD_BEFORE_CELLS,
- cells_y - E_CALENDAR_ITEM_YPAD_ABOVE_CELLS - 1,
- cells_x + E_CALENDAR_COLS_PER_MONTH * calitem->cell_width - 1,
- cells_y - E_CALENDAR_ITEM_YPAD_ABOVE_CELLS - 1);
-
- e_calendar_item_draw_day_numbers (calitem, drawable, width, height,
- row, col, year, month, start_weekday,
- cells_x, cells_y);
-
- /* Draw the vertical line after the week number. */
- if (calitem->show_week_numbers) {
- gdk_draw_line (drawable, fg_gc,
- cells_x - E_CALENDAR_ITEM_XPAD_BEFORE_CELLS - 1,
- cells_y - E_CALENDAR_ITEM_YPAD_ABOVE_CELLS - 1,
- cells_x - E_CALENDAR_ITEM_XPAD_BEFORE_CELLS - 1,
- cells_y + E_CALENDAR_ROWS_PER_MONTH * calitem->cell_height - 1);
- }
-
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
-}
-
-
-static void
-e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
- GdkDrawable *drawable,
- int width,
- int height,
- int row,
- int col,
- int year,
- int month,
- int start_weekday,
- gint cells_x,
- gint cells_y)
-{
- GnomeCanvasItem *item;
- GtkWidget *widget;
- GtkStyle *style;
- GdkFont *font, *wkfont;
- GdkGC *fg_gc;
- GdkColor *bg_color, *fg_color, *box_color;
- struct tm today_tm;
- time_t t;
- gint char_height, min_cell_width, min_cell_height;
- gint day_num, drow, dcol, day_x, day_y;
- gint text_x, text_y;
- gint num_chars, digit;
- gint week_num, mon, days_from_week_start;
- gint years[3], months[3], days_in_month[3];
- gboolean today, selected, has_focus = FALSE, drop_target = FALSE;
- gboolean bold, draw_day, finished = FALSE;
- gint today_year, today_month, today_mday, month_offset;
- gchar buffer[2];
- gint day_style = 0;
-
- item = GNOME_CANVAS_ITEM (calitem);
- widget = GTK_WIDGET (item->canvas);
- style = widget->style;
- font = calitem->font;
- if (!font)
- font = gtk_style_get_font (style);
- wkfont = calitem->week_number_font;
- if (!wkfont)
- wkfont = font;
- fg_gc = style->fg_gc[GTK_STATE_NORMAL];
- char_height = font->ascent + font->descent;
-
- min_cell_width = calitem->max_digit_width * 2
- + E_CALENDAR_ITEM_MIN_CELL_XPAD;
- min_cell_height = char_height + E_CALENDAR_ITEM_MIN_CELL_YPAD;
-
- /* Calculate the number of days in the previous, current, and next
- months. */
- years[0] = years[1] = years[2] = year;
- months[0] = month - 1;
- months[1] = month;
- months[2] = month + 1;
- if (months[0] == -1) {
- months[0] = 11;
- years[0]--;
- }
- if (months[2] == 12) {
- months[2] = 0;
- years[2]++;
- }
-
- days_in_month[0] = DAYS_IN_MONTH (years[0], months[0]);
- days_in_month[1] = DAYS_IN_MONTH (years[1], months[1]);
- days_in_month[2] = DAYS_IN_MONTH (years[2], months[2]);
-
- /* Mon 0 is the previous month, which we may show the end of. Mon 1 is
- the current month, and mon 2 is the next month. */
- mon = 0;
-
- month_offset = row * calitem->cols + col - 1;
- day_num = days_in_month[0];
- days_from_week_start = (start_weekday + 7 - calitem->week_start_day)
- % 7;
- /* For the top-left month we show the end of the previous month, and
- if the new month starts on the first day of the week we show a
- complete week from the previous month. */
- if (days_from_week_start == 0) {
- if (row == 0 && col == 0) {
- day_num -= 6;
- } else {
- mon++;
- month_offset++;
- day_num = 1;
- }
- } else {
- day_num -= days_from_week_start - 1;
- }
-
- /* Get today's date, so we can highlight it. */
- if (calitem->time_callback) {
- today_tm = (*calitem->time_callback) (calitem, calitem->time_callback_data);
- } else {
- t = time (NULL);
- today_tm = *localtime (&t);
- }
- today_year = today_tm.tm_year + 1900;
- today_month = today_tm.tm_mon;
- today_mday = today_tm.tm_mday;
-
- /* We usually skip the last days of the previous month (mon = 0),
- except for the top-left month displayed. */
- draw_day = (mon == 1 || (row == 0 && col == 0));
-
- for (drow = 0; drow < 6; drow++) {
- /* Draw the week number. */
- if (calitem->show_week_numbers) {
- week_num = e_calendar_item_get_week_number (calitem,
- day_num,
- months[mon],
- years[mon]);
-
- text_x = cells_x - E_CALENDAR_ITEM_XPAD_BEFORE_CELLS - 1
- - E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS;
- text_y = cells_y + drow * calitem->cell_height +
- + (calitem->cell_height - min_cell_height + 1) / 2;
-
- num_chars = 0;
- if (week_num >= 10) {
- digit = week_num / 10;
- text_x -= calitem->week_number_digit_widths[digit];
- buffer[num_chars++] = digit + '0';
- }
-
- digit = week_num % 10;
- text_x -= calitem->week_number_digit_widths[digit];
- buffer[num_chars++] = digit + '0';
-
- gdk_gc_set_foreground (fg_gc,
- &style->fg[GTK_STATE_NORMAL]);
- gdk_draw_text (drawable, wkfont, fg_gc,
- text_x, text_y + font->ascent,
- buffer, num_chars);
- }
-
- for (dcol = 0; dcol < 7; dcol++) {
- if (draw_day) {
- day_x = cells_x + dcol * calitem->cell_width;
- day_y = cells_y + drow * calitem->cell_height;
-
- today = years[mon] == today_year
- && months[mon] == today_month
- && day_num == today_mday;
-
- selected = calitem->selection_set
- && (calitem->selection_start_month_offset < month_offset
- || (calitem->selection_start_month_offset == month_offset
- && calitem->selection_start_day <= day_num))
- && (calitem->selection_end_month_offset > month_offset
- || (calitem->selection_end_month_offset == month_offset
- && calitem->selection_end_day >= day_num));
-
- if (calitem->styles)
- day_style = calitem->styles[(month_offset + 1) * 32 + day_num];
-
- /* Get the colors & style to use for the day.*/
- if (calitem->style_callback)
- (*calitem->style_callback)
- (calitem,
- years[mon],
- months[mon],
- day_num,
- day_style,
- today,
- mon != 1,
- selected,
- has_focus,
- drop_target,
- &bg_color,
- &fg_color,
- &box_color,
- &bold,
- calitem->style_callback_data);
- else
- e_calendar_item_get_day_style
- (calitem,
- years[mon],
- months[mon],
- day_num,
- day_style,
- today,
- mon != 1,
- selected,
- has_focus,
- drop_target,
- &bg_color,
- &fg_color,
- &box_color,
- &bold);
-
- /* Draw the background, if set. */
- if (bg_color) {
- gdk_gc_set_foreground (fg_gc, bg_color);
- gdk_draw_rectangle (drawable, fg_gc,
- TRUE,
- day_x, day_y,
- calitem->cell_width,
- calitem->cell_height);
- }
-
- /* Draw the box, if set. */
- if (box_color) {
- gdk_gc_set_foreground (fg_gc, box_color);
- gdk_draw_rectangle (drawable, fg_gc,
- FALSE,
- day_x, day_y,
- calitem->cell_width - 1,
- calitem->cell_height - 1);
- }
-
- /* Draw the 1- or 2-digit day number. */
- day_x += calitem->cell_width - (calitem->cell_width - min_cell_width) / 2;
- day_x -= E_CALENDAR_ITEM_MIN_CELL_XPAD / 2;
- day_y += (calitem->cell_height - min_cell_height + 1) / 2;
- day_y += E_CALENDAR_ITEM_MIN_CELL_YPAD / 2;
-
- num_chars = 0;
- if (day_num >= 10) {
- digit = day_num / 10;
- day_x -= calitem->digit_widths[digit];
- buffer[num_chars++] = digit + '0';
- }
-
- digit = day_num % 10;
- day_x -= calitem->digit_widths[digit];
- buffer[num_chars++] = digit + '0';
-
- if (fg_color) {
- gdk_gc_set_foreground (fg_gc,
- fg_color);
- } else {
- gdk_gc_set_foreground (fg_gc,
- &style->fg[GTK_STATE_NORMAL]);
- }
-
- gdk_draw_text (drawable, font, fg_gc,
- day_x,
- day_y + font->ascent,
- buffer, num_chars);
- /* We use a stupid technique for bold. Just
- draw it again 1 pixel to the left. */
- if (bold)
- gdk_draw_text (drawable, font, fg_gc,
- day_x - 1,
- day_y + font->ascent,
- buffer, num_chars);
- }
-
- /* See if we've reached the end of a month. */
- if (day_num == days_in_month[mon]) {
- month_offset++;
- mon++;
- /* We only draw the start of the next month
- for the bottom-right month displayed. */
- if (mon == 2 && (row != calitem->rows - 1
- || col != calitem->cols - 1)) {
- /* Set a flag so we exit the loop. */
- finished = TRUE;
- break;
- }
- day_num = 1;
- draw_day = TRUE;
- } else {
- day_num++;
- }
- }
-
- /* Exit the loop if the flag is set. */
- if (finished)
- break;
- }
-
- /* Reset the foreground color. */
- gdk_gc_set_foreground (fg_gc, &style->fg[GTK_STATE_NORMAL]);
-}
-
-
-static gint
-e_calendar_item_get_week_number (ECalendarItem *calitem,
- gint day,
- gint month,
- gint year)
-{
- GDate tmp_date;
- gint weekday, yearday, offset, week_num;
-
- /* FIXME: check what happens at year boundaries. */
-
- g_date_clear (&tmp_date, 1);
- g_date_set_dmy (&tmp_date, day, month + 1, year);
-
- /* This results in a value of 0 (Monday) - 6 (Sunday). */
- weekday = g_date_weekday (&tmp_date) - 1;
-
- /* Calculate the offset from the start of the week. */
- offset = (calitem->week_start_day + 7 - weekday) % 7;
-
- /* Calculate the day of the year, from 0 to 365. */
- yearday = g_date_day_of_year (&tmp_date) - 1;
-
- /* If the week starts on or after 29th December, it is week 1 of the
- next year, since there are 4 days in the next year. */
- g_date_subtract_days (&tmp_date, offset);
- if (g_date_month (&tmp_date) == 12 && g_date_day (&tmp_date) >= 29)
- return 1;
-
- /* Calculate the week number, from 0. */
- week_num = (yearday - offset) / 7;
-
- /* If the first week starts on or after Jan 5th, then we need to add
- 1 since the previous week will really be the first week. */
- if ((yearday - offset) % 7 >= 4)
- week_num++;
-
- /* Add 1 so week numbers are from 1 to 53. */
- return week_num + 1;
-}
-
-
-
-/* This is supposed to return the nearest item the the point and the distance.
- Since we are the only item we just return ourself and 0 for the distance.
- This is needed so that we get button/motion events. */
-static double
-e_calendar_item_point (GnomeCanvasItem *item, double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-
-static gint
-e_calendar_item_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- ECalendarItem *calitem;
-
- calitem = E_CALENDAR_ITEM (item);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- return e_calendar_item_button_press (calitem, event);
- case GDK_BUTTON_RELEASE:
- return e_calendar_item_button_release (calitem, event);
- case GDK_MOTION_NOTIFY:
- return e_calendar_item_motion (calitem, event);
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-
-/* This checks if any fonts have changed, and if so it recalculates the
- text sizes and the minimum month size. */
-static void
-e_calendar_item_recalc_sizes (ECalendarItem *calitem)
-{
- GnomeCanvasItem *canvas_item;
- GtkStyle *style;
- GdkFont *font, *wkfont;
- gchar *digits = "0123456789";
- gint day, digit, max_digit_width, max_week_number_digit_width;
- gint char_height, width, min_cell_width, min_cell_height;
-
- canvas_item = GNOME_CANVAS_ITEM (calitem);
- style = GTK_WIDGET (canvas_item->canvas)->style;
-
- if (!style)
- return;
-
- font = calitem->font;
- if (!font)
- font = gtk_style_get_font (style);
- wkfont = calitem->week_number_font;
- if (!wkfont)
- wkfont = font;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (wkfont != NULL);
-
- char_height = font->ascent + font->descent;
-
- /* If both fonts are the same, just return. */
- if (font != calitem->old_font
- || wkfont != calitem->old_week_number_font) {
- if (calitem->old_font)
- gdk_font_unref (calitem->old_font);
- calitem->old_font = font;
- gdk_font_ref (font);
-
- if (calitem->old_week_number_font)
- gdk_font_unref (calitem->old_week_number_font);
- calitem->old_week_number_font = wkfont;
- gdk_font_ref (wkfont);
-
- for (day = 0; day < 7; day++)
- calitem->day_widths[day] = gdk_char_width (font, calitem->days[day]);
-
- max_digit_width = 0;
- max_week_number_digit_width = 0;
- for (digit = 0; digit < 10; digit++) {
- width = gdk_char_width (font, digits[digit]);
- calitem->digit_widths[digit] = width;
- max_digit_width = MAX (max_digit_width, width);
-
- if (wkfont) {
- width = gdk_char_width (wkfont, digits[digit]);
- calitem->week_number_digit_widths[digit] = width;
- max_week_number_digit_width = MAX (max_week_number_digit_width, width);
- } else {
- calitem->week_number_digit_widths[digit] = width;
- max_week_number_digit_width = max_digit_width;
- }
- }
- calitem->max_digit_width = max_digit_width;
- calitem->max_week_number_digit_width = max_week_number_digit_width;
- }
-
- min_cell_width = calitem->max_digit_width * 2
- + E_CALENDAR_ITEM_MIN_CELL_XPAD;
- min_cell_height = char_height + E_CALENDAR_ITEM_MIN_CELL_YPAD;
-
- calitem->min_month_width = E_CALENDAR_ITEM_XPAD_BEFORE_WEEK_NUMBERS
- + E_CALENDAR_ITEM_XPAD_BEFORE_CELLS + min_cell_width * 7
- + E_CALENDAR_ITEM_XPAD_AFTER_CELLS;
- if (calitem->show_week_numbers) {
- calitem->min_month_width += calitem->max_week_number_digit_width * 2
- + E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1;
- }
-
- calitem->min_month_height = style->ythickness * 2
- + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME + char_height
- + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME + 1
- + E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS
- + char_height + E_CALENDAR_ITEM_YPAD_BELOW_DAY_LETTERS + 1
- + E_CALENDAR_ITEM_YPAD_ABOVE_CELLS + min_cell_height * 6
- + E_CALENDAR_ITEM_YPAD_BELOW_CELLS;
-}
-
-
-static void
-e_calendar_item_get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold)
-{
- *bg_color = NULL;
- *fg_color = NULL;
- *box_color = NULL;
- *bold = FALSE;
-
- if (day_style == 1)
- *bold = TRUE;
-
- if (today)
- *box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
-
- if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
-
- if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG];
- }
-}
-
-
-
-static gboolean
-e_calendar_item_button_press (ECalendarItem *calitem,
- GdkEvent *event)
-{
- gint month_offset, day;
- gboolean all_week, round_up_end = FALSE, round_down_start = FALSE;
-
- if (event->button.button == 4)
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month - 1);
- else if (event->button.button == 5)
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month + 1);
-
- if (!e_calendar_item_convert_position_to_day (calitem,
- event->button.x,
- event->button.y,
- TRUE,
- &month_offset, &day,
- &all_week))
- return FALSE;
-
- if (event->button.button == 3 && day == -1
- && e_calendar_item_get_display_popup (calitem)) {
- e_calendar_item_show_popup_menu (calitem,
- (GdkEventButton*) event,
- month_offset);
- return TRUE;
- }
-
- if (event->button.button != 1 || day == -1)
- return FALSE;
-
- if (calitem->max_days_selected < 1)
- return TRUE;
-
- if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (calitem),
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, event->button.time) != 0)
- return FALSE;
-
- calitem->selection_set = TRUE;
- calitem->selection_start_month_offset = month_offset;
- calitem->selection_start_day = day;
- calitem->selection_end_month_offset = month_offset;
- calitem->selection_end_day = day;
-
- calitem->selection_real_start_month_offset = month_offset;
- calitem->selection_real_start_day = day;
-
- calitem->selection_from_full_week = FALSE;
- calitem->selecting = TRUE;
- calitem->selection_dragging_end = TRUE;
-
- if (all_week) {
- calitem->selection_from_full_week = TRUE;
- round_up_end = TRUE;
- }
-
- if (calitem->days_to_start_week_selection == 1) {
- round_down_start = TRUE;
- round_up_end = TRUE;
- }
-
- /* Don't round up or down if we can't select a week or more. */
- if (calitem->max_days_selected < 7) {
- round_down_start = FALSE;
- round_up_end = FALSE;
- }
-
- if (round_up_end)
- e_calendar_item_round_up_selection (calitem, &calitem->selection_end_month_offset, &calitem->selection_end_day);
-
- if (round_down_start)
- e_calendar_item_round_down_selection (calitem, &calitem->selection_start_month_offset, &calitem->selection_start_day);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-
- return TRUE;
-}
-
-
-static gboolean
-e_calendar_item_button_release (ECalendarItem *calitem,
- GdkEvent *event)
-{
- if (!calitem->selecting)
- return FALSE;
-
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (calitem),
- event->button.time);
-
- calitem->selecting = FALSE;
-
- /* If the user selects the grayed dates before the first month or
- after the last month, we move backwards or forwards one month.
- The set_month() call should take care of updating the selection. */
- if (calitem->selection_end_month_offset == -1)
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month - 1);
- else if (calitem->selection_start_month_offset == calitem->rows * calitem->cols)
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month + 1);
-
- calitem->selection_changed = TRUE;
- e_calendar_item_queue_signal_emission (calitem);
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-
- return FALSE;
-}
-
-
-static gboolean
-e_calendar_item_motion (ECalendarItem *calitem,
- GdkEvent *event)
-{
- gint start_month, start_day, end_month, end_day, month_offset, day;
- gint tmp_month, tmp_day, days_in_selection;
- gboolean all_week, round_up_end = FALSE, round_down_start = FALSE;
-
- if (!calitem->selecting)
- return FALSE;
-
- if (!e_calendar_item_convert_position_to_day (calitem,
- event->button.x,
- event->button.y,
- TRUE,
- &month_offset, &day,
- &all_week))
- return FALSE;
-
- if (day == -1)
- return FALSE;
-
- if (calitem->selection_dragging_end) {
- start_month = calitem->selection_real_start_month_offset;
- start_day = calitem->selection_real_start_day;
- end_month = month_offset;
- end_day = day;
- } else {
- start_month = month_offset;
- start_day = day;
- end_month = calitem->selection_real_start_month_offset;
- end_day = calitem->selection_real_start_day;
- }
-
- if (start_month > end_month || (start_month == end_month
- && start_day > end_day)) {
- tmp_month = start_month;
- tmp_day = start_day;
- start_month = end_month;
- start_day = end_day;
- end_month = tmp_month;
- end_day = tmp_day;
-
- calitem->selection_dragging_end = !calitem->selection_dragging_end;
- }
-
- if (calitem->days_to_start_week_selection > 0) {
- days_in_selection = e_calendar_item_get_inclusive_days (calitem, start_month, start_day, end_month, end_day);
- if (days_in_selection >= calitem->days_to_start_week_selection) {
- round_down_start = TRUE;
- round_up_end = TRUE;
- }
- }
-
- /* If we are over a week number and we are dragging the end of the
- selection, we round up to the end of this week. */
- if (all_week && calitem->selection_dragging_end)
- round_up_end = TRUE;
-
- /* If the selection was started from a week number and we are dragging
- the start of the selection, we need to round up the end to include
- all of the original week selected. */
- if (calitem->selection_from_full_week
- && !calitem->selection_dragging_end)
- round_up_end = TRUE;
-
- /* Don't round up or down if we can't select a week or more. */
- if (calitem->max_days_selected < 7) {
- round_down_start = FALSE;
- round_up_end = FALSE;
- }
-
- if (round_up_end)
- e_calendar_item_round_up_selection (calitem, &end_month,
- &end_day);
- if (round_down_start)
- e_calendar_item_round_down_selection (calitem, &start_month,
- &start_day);
-
-
- /* Check we don't go over the maximum number of days to select. */
- if (calitem->selection_dragging_end) {
- e_calendar_item_check_selection_end (calitem,
- start_month,
- start_day,
- &end_month,
- &end_day);
- } else {
- e_calendar_item_check_selection_start (calitem,
- &start_month,
- &start_day,
- end_month,
- end_day);
- }
-
- if (start_month == calitem->selection_start_month_offset
- && start_day == calitem->selection_start_day
- && end_month == calitem->selection_end_month_offset
- && end_day == calitem->selection_end_day)
- return FALSE;
-
- calitem->selection_start_month_offset = start_month;
- calitem->selection_start_day = start_day;
- calitem->selection_end_month_offset = end_month;
- calitem->selection_end_day = end_day;
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-
- return TRUE;
-}
-
-
-static void
-e_calendar_item_check_selection_end (ECalendarItem *calitem,
- gint start_month,
- gint start_day,
- gint *end_month,
- gint *end_day)
-{
- gint year, month, max_month, max_day, days_in_month;
-
- if (calitem->max_days_selected <= 0)
- return;
-
- year = calitem->year;
- month = calitem->month + start_month;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- max_month = start_month;
- max_day = start_day + calitem->max_days_selected - 1;
-
- for (;;) {
- days_in_month = DAYS_IN_MONTH (year, month);
- if (max_day <= days_in_month)
- break;
- max_month++;
- month++;
- if (month == 12) {
- year++;
- month = 0;
- }
- max_day -= days_in_month;
- }
-
- if (*end_month > max_month) {
- *end_month = max_month;
- *end_day = max_day;
- } else if (*end_month == max_month && *end_day > max_day) {
- *end_day = max_day;
- }
-}
-
-
-static void
-e_calendar_item_check_selection_start (ECalendarItem *calitem,
- gint *start_month,
- gint *start_day,
- gint end_month,
- gint end_day)
-{
- gint year, month, min_month, min_day, days_in_month;
-
- if (calitem->max_days_selected <= 0)
- return;
-
- year = calitem->year;
- month = calitem->month + end_month;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- min_month = end_month;
- min_day = end_day - calitem->max_days_selected + 1;
-
- while (min_day <= 0) {
- min_month--;
- month--;
- if (month == -1) {
- year--;
- month = 11;
- }
- days_in_month = DAYS_IN_MONTH (year, month);
- min_day += days_in_month;
- }
-
- if (*start_month < min_month) {
- *start_month = min_month;
- *start_day = min_day;
- } else if (*start_month == min_month && *start_day < min_day) {
- *start_day = min_day;
- }
-}
-
-
-/* Converts a position within the item to a month & day.
- The month returned is 0 for the top-left month displayed.
- If the position is over the month heading -1 is returned for the day.
- If the position is over a week number the first day of the week is returned
- and entire_week is set to TRUE.
- It returns FALSE if the position is completely outside all months. */
-static gboolean
-e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
- gint event_x,
- gint event_y,
- gboolean round_empty_positions,
- gint *month_offset,
- gint *day,
- gboolean *entire_week)
-{
- GnomeCanvasItem *item;
- GtkWidget *widget;
- GtkStyle *style;
- gint xthickness, ythickness, char_height;
- gint x, y, row, col, cells_x, cells_y, day_row, day_col;
- gint first_day_offset, days_in_month, days_in_prev_month;
- gint week_num_x1, week_num_x2;
-
- item = GNOME_CANVAS_ITEM (calitem);
- widget = GTK_WIDGET (item->canvas);
- style = widget->style;
- char_height = gtk_style_get_font (style)->ascent + gtk_style_get_font (style)->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
-
- *entire_week = FALSE;
-
- x = event_x - xthickness - calitem->x_offset;
- y = event_y - ythickness;
-
- if (x < 0 || y < 0)
- return FALSE;
-
- row = y / calitem->month_height;
- col = x / calitem->month_width;
-
- if (row >= calitem->rows || col >= calitem->cols)
- return FALSE;
-
- *month_offset = row * calitem->cols + col;
-
- x = x % calitem->month_width;
- y = y % calitem->month_height;
-
- if (y < ythickness * 2 + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME
- + char_height + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME) {
- *day = -1;
- return TRUE;
- }
-
- cells_y = ythickness * 2 + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME
- + char_height + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME
- + E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS + calitem->month_tpad
- + char_height + E_CALENDAR_ITEM_YPAD_BELOW_DAY_LETTERS + 1
- + E_CALENDAR_ITEM_YPAD_ABOVE_CELLS;
- y -= cells_y;
- if (y < 0)
- return FALSE;
- day_row = y / calitem->cell_height;
- if (day_row >= E_CALENDAR_ROWS_PER_MONTH)
- return FALSE;
-
- week_num_x1 = E_CALENDAR_ITEM_XPAD_BEFORE_WEEK_NUMBERS + calitem->month_lpad;
-
- if (calitem->show_week_numbers) {
- week_num_x2 = week_num_x1
- + calitem->max_week_number_digit_width * 2;
- if (x >= week_num_x1 && x < week_num_x2)
- *entire_week = TRUE;
- cells_x = week_num_x2 + E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1;
- } else {
- cells_x = week_num_x1;
- }
-
- if (*entire_week) {
- day_col = 0;
- } else {
- cells_x += E_CALENDAR_ITEM_XPAD_BEFORE_CELLS;
- x -= cells_x;
- if (x < 0)
- return FALSE;
- day_col = x / calitem->cell_width;
- if (day_col >= E_CALENDAR_COLS_PER_MONTH)
- return FALSE;
- }
-
- *day = day_row * E_CALENDAR_COLS_PER_MONTH + day_col;
-
- e_calendar_item_get_month_info (calitem, row, col, &first_day_offset,
- &days_in_month, &days_in_prev_month);
- if (*day < first_day_offset) {
- if (*entire_week || (row == 0 && col == 0)) {
- (*month_offset)--;
- *day = days_in_prev_month + 1 - first_day_offset
- + *day;
- return TRUE;
- } else if (round_empty_positions) {
- *day = first_day_offset;
- } else {
- return FALSE;
- }
- }
-
- *day -= first_day_offset - 1;
-
- if (*day > days_in_month) {
- if (row == calitem->rows - 1 && col == calitem->cols - 1) {
- (*month_offset)++;
- *day -= days_in_month;
- return TRUE;
- } else if (round_empty_positions) {
- *day = days_in_month;
- } else {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
-static void
-e_calendar_item_get_month_info (ECalendarItem *calitem,
- gint row,
- gint col,
- gint *first_day_offset,
- gint *days_in_month,
- gint *days_in_prev_month)
-{
- gint year, month, start_weekday, first_day_of_month;
- struct tm tmp_tm = { 0 };
-
- month = calitem->month + row * calitem->cols + col;
- year = calitem->year + month / 12;
- month = month % 12;
-
- *days_in_month = DAYS_IN_MONTH (year, month);
- if (month == 0)
- *days_in_prev_month = DAYS_IN_MONTH (year - 1, 11);
- else
- *days_in_prev_month = DAYS_IN_MONTH (year, month - 1);
-
- tmp_tm.tm_year = year - 1900;
- tmp_tm.tm_mon = month;
- tmp_tm.tm_mday = 1;
- tmp_tm.tm_isdst = -1;
- mktime (&tmp_tm);
-
- /* Convert to 0 (Monday) to 6 (Sunday). */
- start_weekday = (tmp_tm.tm_wday + 6) % 7;
-
- first_day_of_month = (start_weekday + 7 - calitem->week_start_day) % 7;
-
- if (row == 0 && col == 0 && first_day_of_month == 0)
- *first_day_offset = 7;
- else
- *first_day_offset = first_day_of_month;
-}
-
-
-void
-e_calendar_item_get_first_month(ECalendarItem *calitem,
- gint *year,
- gint *month)
-{
- *year = calitem->year;
- *month = calitem->month;
-}
-
-
-/* This also handles values of month < 0 or > 11 by updating the year. */
-void
-e_calendar_item_set_first_month(ECalendarItem *calitem,
- gint year,
- gint month)
-{
- gint new_year, new_month, months_diff, num_months;
- gint old_days_in_selection, new_days_in_selection;
-
- new_year = year;
- new_month = month;
- e_calendar_item_normalize_date (calitem, &new_year, &new_month);
-
- if (calitem->year == new_year && calitem->month == new_month)
- return;
-
- /* Update the selection. */
- num_months = calitem->rows * calitem->cols;
- months_diff = (new_year - calitem->year) * 12
- + new_month - calitem->month;
-
- if (calitem->selection_set) {
- if (!calitem->move_selection_when_moving
- || (calitem->selection_start_month_offset - months_diff >= 0
- && calitem->selection_end_month_offset - months_diff < num_months)) {
- calitem->selection_start_month_offset -= months_diff;
- calitem->selection_end_month_offset -= months_diff;
- calitem->selection_real_start_month_offset -= months_diff;
-
- calitem->year = new_year;
- calitem->month = new_month;
- } else {
- old_days_in_selection = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, calitem->selection_end_month_offset, calitem->selection_end_day);
-
- /* Make sure the selection will be displayed. */
- if (calitem->selection_start_month_offset < 0
- || calitem->selection_start_month_offset >= num_months) {
- calitem->selection_end_month_offset -= calitem->selection_start_month_offset;
- calitem->selection_start_month_offset = 0;
- }
-
- /* We want to ensure that the same number of days are
- selected after we have moved the selection. */
- calitem->year = new_year;
- calitem->month = new_month;
-
- e_calendar_item_ensure_valid_day (calitem, &calitem->selection_start_month_offset, &calitem->selection_start_day);
- e_calendar_item_ensure_valid_day (calitem, &calitem->selection_end_month_offset, &calitem->selection_end_day);
-
- if (calitem->round_selection_when_moving) {
- e_calendar_item_round_down_selection (calitem, &calitem->selection_start_month_offset, &calitem->selection_start_day);
- }
-
- new_days_in_selection = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, calitem->selection_end_month_offset, calitem->selection_end_day);
-
- if (old_days_in_selection != new_days_in_selection)
- e_calendar_item_add_days_to_selection (calitem, old_days_in_selection - new_days_in_selection);
-
- /* Flag that we need to emit the "selection_changed"
- signal. We don't want to emit it here since setting
- the "year" and "month" args would result in 2
- signals emitted. */
- calitem->selection_changed = TRUE;
- }
- } else {
- calitem->year = new_year;
- calitem->month = new_month;
- }
-
- e_calendar_item_date_range_changed (calitem);
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-}
-
-/* Get the maximum number of days selectable */
-gint
-e_calendar_item_get_max_days_sel (ECalendarItem *calitem)
-{
- return calitem->max_days_selected;
-}
-
-
-/* Set the maximum number of days selectable */
-void
-e_calendar_item_set_max_days_sel (ECalendarItem *calitem,
- gint days)
-{
- calitem->max_days_selected = MAX (0, days);
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-}
-
-
-/* Get the maximum number of days before whole weeks are selected */
-gint
-e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem)
-{
- return calitem->days_to_start_week_selection;
-}
-
-
-/* Set the maximum number of days before whole weeks are selected */
-void
-e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
- gint days)
-{
- calitem->days_to_start_week_selection = days;
-}
-
-gboolean
-e_calendar_item_get_display_popup (ECalendarItem *calitem)
-{
- return calitem->display_popup;
-}
-
-
-void
-e_calendar_item_set_display_popup (ECalendarItem *calitem,
- gboolean display)
-{
- calitem->display_popup = display;
-}
-
-
-/* This will make sure that the given year & month are valid, i.e. if month
- is < 0 or > 11 the year and month will be updated accordingly. */
-static void
-e_calendar_item_normalize_date (ECalendarItem *calitem,
- gint *year,
- gint *month)
-{
- if (*month >= 0) {
- *year += *month / 12;
- *month = *month % 12;
- } else {
- *year += *month / 12 - 1;
- *month = *month % 12;
- if (*month != 0)
- *month += 12;
- }
-}
-
-
-/* Adds or subtracts days from the selection. It is used when we switch months
- and the selection extends past the end of a month but we want to keep the
- number of days selected the same. days should not be more than 30. */
-static void
-e_calendar_item_add_days_to_selection (ECalendarItem *calitem,
- gint days)
-{
- gint year, month, days_in_month;
-
- year = calitem->year;
- month = calitem->month + calitem->selection_end_month_offset;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- calitem->selection_end_day += days;
- if (calitem->selection_end_day <= 0) {
- month--;
- e_calendar_item_normalize_date (calitem, &year, &month);
- calitem->selection_end_month_offset--;
- calitem->selection_end_day += DAYS_IN_MONTH (year, month);
- } else {
- days_in_month = DAYS_IN_MONTH (year, month);
- if (calitem->selection_end_day > days_in_month) {
- calitem->selection_end_month_offset++;
- calitem->selection_end_day -= days_in_month;
- }
- }
-}
-
-
-/* Gets the range of dates actually shown. Months are 0 to 11.
- This also includes the last days of the previous month and the first days
- of the following month, which are normally shown in gray.
- It returns FALSE if no dates are currently shown. */
-gboolean
-e_calendar_item_get_date_range (ECalendarItem *calitem,
- gint *start_year,
- gint *start_month,
- gint *start_day,
- gint *end_year,
- gint *end_month,
- gint *end_day)
-{
- gint first_day_offset, days_in_month, days_in_prev_month;
-
- if (calitem->rows == 0 || calitem->cols == 0)
- return FALSE;
-
- /* Calculate the first day shown. This will be one of the greyed-out
- days before the first full month begins. */
- e_calendar_item_get_month_info (calitem, 0, 0, &first_day_offset,
- &days_in_month, &days_in_prev_month);
- *start_year = calitem->year;
- *start_month = calitem->month - 1;
- if (*start_month == -1) {
- (*start_year)--;
- *start_month = 11;
- }
- *start_day = days_in_prev_month + 1 - first_day_offset;
-
-
- /* Calculate the last day shown. This will be one of the greyed-out
- days after the last full month ends. */
- e_calendar_item_get_month_info (calitem, calitem->rows - 1,
- calitem->cols - 1, &first_day_offset,
- &days_in_month, &days_in_prev_month);
- *end_month = calitem->month + calitem->rows * calitem->cols;
- *end_year = calitem->year + *end_month / 12;
- *end_month %= 12;
- *end_day = E_CALENDAR_ROWS_PER_MONTH * E_CALENDAR_COLS_PER_MONTH
- - first_day_offset - days_in_month;
-
- return TRUE;
-}
-
-
-/* Simple way to mark days so they appear bold.
- A more flexible interface may be added later. */
-void
-e_calendar_item_clear_marks (ECalendarItem *calitem)
-{
- GnomeCanvasItem *item;
-
- item = GNOME_CANVAS_ITEM (calitem);
-
- g_free (calitem->styles);
- calitem->styles = NULL;
-
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
- item->x2, item->y2);
-}
-
-
-void
-e_calendar_item_mark_day (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- guint8 day_style)
-{
- gint month_offset;
-
- month_offset = (year - calitem->year) * 12 + month - calitem->month;
- if (month_offset < -1 || month_offset > calitem->rows * calitem->cols)
- return;
-
- if (!calitem->styles)
- calitem->styles = g_new0 (guint8, (calitem->rows * calitem->cols + 2) * 32);
-
- calitem->styles[(month_offset + 1) * 32 + day] = day_style;
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-}
-
-
-void
-e_calendar_item_mark_days (ECalendarItem *calitem,
- gint start_year,
- gint start_month,
- gint start_day,
- gint end_year,
- gint end_month,
- gint end_day,
- guint8 day_style)
-{
- gint month_offset, end_month_offset, day;
-
- month_offset = (start_year - calitem->year) * 12 + start_month
- - calitem->month;
- day = start_day;
- if (month_offset > calitem->rows * calitem->cols)
- return;
- if (month_offset < -1) {
- month_offset = -1;
- day = 1;
- }
-
- end_month_offset = (end_year - calitem->year) * 12 + end_month
- - calitem->month;
- if (end_month_offset < -1)
- return;
- if (end_month_offset > calitem->rows * calitem->cols) {
- end_month_offset = calitem->rows * calitem->cols;
- end_day = 31;
- }
-
- if (month_offset > end_month_offset)
- return;
-
- if (!calitem->styles)
- calitem->styles = g_new0 (guint8, (calitem->rows * calitem->cols + 2) * 32);
-
- for (;;) {
- if (month_offset == end_month_offset && day > end_day)
- break;
-
- if (month_offset < -1 || month_offset > calitem->rows * calitem->cols)
- g_warning ("Bad month offset: %i\n", month_offset);
- if (day < 1 || day > 31)
- g_warning ("Bad day: %i\n", day);
-
-#if 0
- g_print ("Marking Month:%i Day:%i\n", month_offset, day);
-#endif
- calitem->styles[(month_offset + 1) * 32 + day] = day_style;
-
- day++;
- if (day == 32) {
- month_offset++;
- day = 1;
- if (month_offset > end_month_offset)
- break;
- }
- }
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-}
-
-
-/* Rounds up the given day to the end of the week. */
-static void
-e_calendar_item_round_up_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day)
-{
- gint year, month, weekday, days, days_in_month;
- struct tm tmp_tm = { 0 };
-
- year = calitem->year;
- month = calitem->month + *month_offset;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- tmp_tm.tm_year = year - 1900;
- tmp_tm.tm_mon = month;
- tmp_tm.tm_mday = *day;
- tmp_tm.tm_isdst = -1;
- mktime (&tmp_tm);
-
- /* Convert to 0 (Monday) to 6 (Sunday). */
- weekday = (tmp_tm.tm_wday + 6) % 7;
-
- /* Calculate how many days to the end of the row. */
- days = (calitem->week_start_day + 6 - weekday) % 7;
-
- *day += days;
- days_in_month = DAYS_IN_MONTH (year, month);
- if (*day > days_in_month) {
- (*month_offset)++;
- *day -= days_in_month;
- }
-}
-
-
-/* Rounds down the given day to the start of the week. */
-static void
-e_calendar_item_round_down_selection (ECalendarItem *calitem,
- gint *month_offset,
- gint *day)
-{
- gint year, month, weekday, days, days_in_month;
- struct tm tmp_tm = { 0 };
-
- year = calitem->year;
- month = calitem->month + *month_offset;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- tmp_tm.tm_year = year - 1900;
- tmp_tm.tm_mon = month;
- tmp_tm.tm_mday = *day;
- tmp_tm.tm_isdst = -1;
- mktime (&tmp_tm);
-
- /* Convert to 0 (Monday) to 6 (Sunday). */
- weekday = (tmp_tm.tm_wday + 6) % 7;
-
- /* Calculate how many days to the start of the row. */
- days = (weekday + 7 - calitem->week_start_day) % 7;
-
- *day -= days;
- if (*day <= 0) {
- month--;
- if (month == -1) {
- year--;
- month = 11;
- }
- days_in_month = DAYS_IN_MONTH (year, month);
- (*month_offset)--;
- *day += days_in_month;
- }
-}
-
-
-static gint
-e_calendar_item_get_inclusive_days (ECalendarItem *calitem,
- gint start_month_offset,
- gint start_day,
- gint end_month_offset,
- gint end_day)
-{
- gint start_year, start_month, end_year, end_month, days = 0;
-
- start_year = calitem->year;
- start_month = calitem->month + start_month_offset;
- e_calendar_item_normalize_date (calitem, &start_year, &start_month);
-
- end_year = calitem->year;
- end_month = calitem->month + end_month_offset;
- e_calendar_item_normalize_date (calitem, &end_year, &end_month);
-
- while (start_year < end_year || start_month < end_month) {
- days += DAYS_IN_MONTH (start_year, start_month);
- start_month++;
- if (start_month == 12) {
- start_year++;
- start_month = 0;
- }
- }
-
- days += end_day - start_day + 1;
-
- return days;
-}
-
-
-/* If the day is off the end of the month it is set to the last day of the
- month. */
-static void
-e_calendar_item_ensure_valid_day (ECalendarItem *calitem,
- gint *month_offset,
- gint *day)
-{
- gint year, month, days_in_month;
-
- year = calitem->year;
- month = calitem->month + *month_offset;
- e_calendar_item_normalize_date (calitem, &year, &month);
-
- days_in_month = DAYS_IN_MONTH (year, month);
- if (*day > days_in_month)
- *day = days_in_month;
-}
-
-
-gboolean
-e_calendar_item_get_selection (ECalendarItem *calitem,
- GDate *start_date,
- GDate *end_date)
-{
- gint start_year, start_month, start_day;
- gint end_year, end_month, end_day;
-
- g_date_clear (start_date, 1);
- g_date_clear (end_date, 1);
-
- if (!calitem->selection_set)
- return FALSE;
-
- start_year = calitem->year;
- start_month = calitem->month + calitem->selection_start_month_offset;
- e_calendar_item_normalize_date (calitem, &start_year, &start_month);
- start_day = calitem->selection_start_day;
-
- end_year = calitem->year;
- end_month = calitem->month + calitem->selection_end_month_offset;
- e_calendar_item_normalize_date (calitem, &end_year, &end_month);
- end_day = calitem->selection_end_day;
-
- g_date_set_dmy (start_date, start_day, start_month + 1, start_year);
- g_date_set_dmy (end_date, end_day, end_month + 1, end_year);
-
- return TRUE;
-}
-
-
-void
-e_calendar_item_set_selection (ECalendarItem *calitem,
- GDate *start_date,
- GDate *end_date)
-{
- gint start_year, start_month, start_day;
- gint end_year, end_month, end_day;
- gint new_start_month_offset, new_start_day;
- gint new_end_month_offset, new_end_day;
- gboolean need_update;
-
- g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
-
- /* If the user is in the middle of a selection, we must abort it. */
- if (calitem->selecting) {
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (calitem),
- GDK_CURRENT_TIME);
- calitem->selecting = FALSE;
- }
-
- /* If start_date is NULL, we clear the selection without changing the
- month shown. */
- if (start_date == NULL) {
- calitem->selection_set = FALSE;
- calitem->selection_changed = TRUE;
- e_calendar_item_queue_signal_emission (calitem);
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
- return;
- }
-
- if (end_date == NULL)
- end_date = start_date;
-
- g_return_if_fail (g_date_compare (start_date, end_date) <= 0);
-
- start_year = g_date_year (start_date);
- start_month = g_date_month (start_date) - 1;
- start_day = g_date_day (start_date);
- end_year = g_date_year (end_date);
- end_month = g_date_month (end_date) - 1;
- end_day = g_date_day (end_date);
-
- need_update = e_calendar_item_ensure_days_visible (calitem,
- start_year,
- start_month,
- start_day,
- end_year,
- end_month,
- end_day);
-
- new_start_month_offset = (start_year - calitem->year) * 12
- + start_month - calitem->month;
- new_start_day = start_day;
-
- /* This may go outside the visible months, but we don't care. */
- new_end_month_offset = (end_year - calitem->year) * 12
- + end_month - calitem->month;
- new_end_day = end_day;
-
-
- if (!calitem->selection_set
- || calitem->selection_start_month_offset != new_start_month_offset
- || calitem->selection_start_day != new_start_day
- || calitem->selection_end_month_offset != new_end_month_offset
- || calitem->selection_end_day != new_end_day) {
- need_update = TRUE;
- calitem->selection_changed = TRUE;
- e_calendar_item_queue_signal_emission (calitem);
- calitem->selection_set = TRUE;
- calitem->selection_start_month_offset = new_start_month_offset;
- calitem->selection_start_day = new_start_day;
- calitem->selection_end_month_offset = new_end_month_offset;
- calitem->selection_end_day = new_end_day;
-
- calitem->selection_real_start_month_offset = new_start_month_offset;
- calitem->selection_real_start_day = new_start_day;
- calitem->selection_from_full_week = FALSE;
- }
-
- if (need_update)
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
-}
-
-
-/* This tries to ensure that the given time range is visible. If the range
- given is longer than we can show, only the start of it will be visible.
- Note that this will not update the selection. That should be done somewhere
- else. It returns TRUE if the visible range has been changed. */
-static gboolean
-e_calendar_item_ensure_days_visible (ECalendarItem *calitem,
- gint start_year,
- gint start_month,
- gint start_day,
- gint end_year,
- gint end_month,
- gint end_day)
-{
- gint current_end_year, current_end_month;
- gint months_shown, months;
- gint first_day_offset, days_in_month, days_in_prev_month;
- gboolean need_update = FALSE;
-
- months_shown = calitem->rows * calitem->cols;
- months = (end_year - start_year) * 12 + end_month - start_month;
-
- /* Calculate the range of months currently displayed. */
- current_end_year = calitem->year;
- current_end_month = calitem->month + months_shown - 1;
- e_calendar_item_normalize_date (calitem, &current_end_year,
- &current_end_month);
-
- /* Try to ensure that the end month is shown. */
- if (end_year > current_end_year
- || (end_year == current_end_year
- && end_month > current_end_month)) {
-
- /* First we see if the end of the selection will fit in the
- leftover days of the month after the last one shown. */
- calitem->month += (months_shown - 1);
- e_calendar_item_normalize_date (calitem, &calitem->year,
- &calitem->month);
-
- e_calendar_item_get_month_info (calitem, 0, 0,
- &first_day_offset,
- &days_in_month,
- &days_in_prev_month);
-
- if (end_day >= E_CALENDAR_ROWS_PER_MONTH * E_CALENDAR_COLS_PER_MONTH -
- first_day_offset - days_in_month) {
- need_update = TRUE;
-
- calitem->year = end_year;
- calitem->month = end_month - months_shown + 1;
- } else {
- calitem->month -= (months_shown - 1);
- }
-
- e_calendar_item_normalize_date (calitem, &calitem->year,
- &calitem->month);
- }
-
- /* Now try to ensure that the start month is shown. We do this after
- the end month so that the start month will always be shown. */
- if (start_year < calitem->year
- || (start_year == calitem->year
- && start_month < calitem->month)) {
- need_update = TRUE;
-
- /* First we see if the start of the selection will fit in the
- leftover days of the month before the first one shown. */
- calitem->year = start_year;
- calitem->month = start_month + 1;
- e_calendar_item_normalize_date (calitem, &calitem->year,
- &calitem->month);
-
- e_calendar_item_get_month_info (calitem, 0, 0,
- &first_day_offset,
- &days_in_month,
- &days_in_prev_month);
-
- if (start_day <= days_in_prev_month - first_day_offset) {
- calitem->year = start_year;
- calitem->month = start_month;
- }
- }
-
- if (need_update)
- e_calendar_item_date_range_changed (calitem);
-
- return need_update;
-}
-
-
-static void
-e_calendar_item_show_popup_menu (ECalendarItem *calitem,
- GdkEventButton *event,
- gint month_offset)
-{
- GtkWidget *menu, *submenu, *menuitem, *label;
- gint year, month;
- gchar buffer[64];
- struct tm tmp_tm;
-
- menu = gtk_menu_new ();
-
- for (year = calitem->year - 2; year <= calitem->year + 2; year++) {
- g_snprintf (buffer, 64, "%i", year);
- menuitem = gtk_menu_item_new_with_label (buffer);
- gtk_widget_show (menuitem);
- gtk_container_add (GTK_CONTAINER (menu), menuitem);
-
- submenu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
-
- g_object_set_data(G_OBJECT(submenu), "year",
- GINT_TO_POINTER (year));
- g_object_set_data(G_OBJECT(submenu), "month_offset",
- GINT_TO_POINTER (month_offset));
-
- for (month = 0; month < 12; month++) {
- memset (&tmp_tm, 0, sizeof (tmp_tm));
- tmp_tm.tm_year = year - 1900;
- tmp_tm.tm_mon = month;
- tmp_tm.tm_mday = 1;
- tmp_tm.tm_isdst = -1;
- mktime (&tmp_tm);
- strftime (buffer, sizeof (buffer), "%B", &tmp_tm);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_container_add (GTK_CONTAINER (submenu), menuitem);
-
- label = gtk_label_new (buffer);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (menuitem), label);
-
- g_object_set_data(G_OBJECT(menuitem), "month",
- GINT_TO_POINTER (month));
-
- g_signal_connect((menuitem), "activate",
- G_CALLBACK (e_calendar_item_on_menu_item_activate), calitem);
- }
- }
-
- /* Run the menu modal so we can destroy it after. */
- g_signal_connect((menu), "deactivate",
- G_CALLBACK (gtk_main_quit), NULL);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- e_calendar_item_position_menu, calitem,
- event->button, event->time);
- gtk_grab_add (menu);
- gtk_main ();
- gtk_grab_remove (menu);
- gtk_widget_destroy (menu);
-}
-
-
-static void
-e_calendar_item_on_menu_item_activate (GtkWidget *menuitem,
- ECalendarItem *calitem)
-{
- gint year, month_offset, month;
-
- year = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "year"));
- month_offset = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "month_offset"));
- month = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem), "month"));
-
- month -= month_offset;
- e_calendar_item_normalize_date (calitem, &year, &month);
- e_calendar_item_set_first_month (calitem, year, month);
-}
-
-
-static void
-e_calendar_item_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data)
-{
- GtkRequisition requisition;
- gint screen_width, screen_height;
-
- gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
-
- *x -= 2;
- *y -= requisition.height / 2;
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- *x = CLAMP (*x, 0, screen_width - requisition.width);
- *y = CLAMP (*y, 0, screen_height - requisition.height);
-}
-
-
-/* Sets the function to call to get the colors to use for a particular day. */
-void
-e_calendar_item_set_style_callback (ECalendarItem *calitem,
- ECalendarItemStyleCallback cb,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
-
- if (calitem->style_callback_data && calitem->style_callback_destroy)
- (*calitem->style_callback_destroy) (calitem->style_callback_data);
-
- calitem->style_callback = cb;
- calitem->style_callback_data = data;
- calitem->style_callback_destroy = destroy;
-}
-
-
-static void
-e_calendar_item_date_range_changed (ECalendarItem *calitem)
-{
- g_free (calitem->styles);
- calitem->styles = NULL;
- calitem->date_range_changed = TRUE;
- e_calendar_item_queue_signal_emission (calitem);
-}
-
-
-static void
-e_calendar_item_queue_signal_emission (ECalendarItem *calitem)
-{
- if (calitem->signal_emission_idle_id == 0) {
- calitem->signal_emission_idle_id = g_idle_add_full (G_PRIORITY_HIGH, e_calendar_item_signal_emission_idle_cb, calitem, NULL);
- }
-}
-
-
-static gboolean
-e_calendar_item_signal_emission_idle_cb (gpointer data)
-{
- ECalendarItem *calitem;
-
- g_return_val_if_fail (E_IS_CALENDAR_ITEM (data), FALSE);
-
- GDK_THREADS_ENTER ();
-
- calitem = E_CALENDAR_ITEM (data);
-
- calitem->signal_emission_idle_id = 0;
-
- /* We ref the calitem & check in case it gets destroyed, since we
- were getting a free memory write here. */
- g_object_ref((calitem));
-
- if (calitem->date_range_changed) {
- calitem->date_range_changed = FALSE;
- gtk_signal_emit (GTK_OBJECT (calitem),
- e_calendar_item_signals[DATE_RANGE_CHANGED]);
- }
-
- if (calitem->selection_changed) {
- calitem->selection_changed = FALSE;
- gtk_signal_emit (GTK_OBJECT (calitem),
- e_calendar_item_signals[SELECTION_CHANGED]);
- }
-
- g_object_unref((calitem));
-
- GDK_THREADS_LEAVE ();
- return FALSE;
-}
-
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void
-e_calendar_item_set_get_time_callback (ECalendarItem *calitem,
- ECalendarItemGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
-
- if (calitem->time_callback_data && calitem->time_callback_destroy)
- (*calitem->time_callback_destroy) (calitem->time_callback_data);
-
- calitem->time_callback = cb;
- calitem->time_callback_data = data;
- calitem->time_callback_destroy = destroy;
-}
diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h
deleted file mode 100644
index f63282b080..0000000000
--- a/widgets/misc/e-calendar-item.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_CALENDAR_ITEM_H_
-#define _E_CALENDAR_ITEM_H_
-
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * ECalendarItem - canvas item displaying a calendar.
- */
-
-#define E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME 1
-#define E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME 1
-
-/* Used to mark days as bold in e_calendar_item_mark_day(). */
-#define E_CALENDAR_ITEM_MARK_BOLD 1
-
-
-/* These index our colors array. */
-typedef enum
-{
- E_CALENDAR_ITEM_COLOR_TODAY_BOX,
- E_CALENDAR_ITEM_COLOR_SELECTION_FG,
- E_CALENDAR_ITEM_COLOR_SELECTION_BG,
- E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG,
-
- E_CALENDAR_ITEM_COLOR_LAST
-} ECalendarItemColors;
-
-typedef struct _ECalendarItem ECalendarItem;
-typedef struct _ECalendarItemClass ECalendarItemClass;
-
-/* The type of the callback function optionally used to get the colors to
- use for each day. */
-typedef void (*ECalendarItemStyleCallback) (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gpointer data);
-
-/* The type of the callback function optionally used to get the current time.
- */
-typedef struct tm (*ECalendarItemGetTimeCallback) (ECalendarItem *calitem,
- gpointer data);
-
-
-#define E_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- e_calendar_item_get_type (), ECalendarItem))
-#define E_CALENDAR_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k),\
- e_calendar_item_get_type ()))
-#define E_IS_CALENDAR_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
- e_calendar_item_get_type ()))
-
-struct _ECalendarItem
-{
- GnomeCanvasItem canvas_item;
-
- /* The year & month of the first calendar being displayed. */
- gint year;
- gint month; /* 0 to 11 */
-
- /* Points to an array of styles, one char for each day. We use 32
- chars for each month, with n + 2 months, where n is the number of
- complete months shown (since we show some days before the first
- month and after the last month grayes out).
- A value of 0 is the default, and 1 is bold. */
- guint8 *styles;
-
- /*
- * Options.
- */
-
- /* The minimum & maximum number of rows & columns of months.
- If the maximum values are -1 then there is no maximum.
- The minimum valies default to 1. The maximum values to -1. */
- gint min_rows;
- gint min_cols;
- gint max_rows;
- gint max_cols;
-
- /* The actual number of rows & columns of months. */
- gint rows;
- gint cols;
-
- /* Whether we show week nubers. */
- gboolean show_week_numbers;
-
- /* The first day of the week, 0 (Monday) to 6 (Sunday). */
- gint week_start_day;
-
- /* Whether the cells expand to fill extra space. */
- gboolean expand;
-
- /* The maximum number of days that can be selected. Defaults to 1. */
- gint max_days_selected;
-
- /* The number of days selected before we switch to selecting whole
- weeks, or -1 if we never switch. Defaults to -1. */
- gint days_to_start_week_selection;
-
- /* Whether the selection is moved when we move back/forward one month.
- Used for things like the EDateEdit which only want the selection to
- be changed when the user explicitly selects a day. */
- gboolean move_selection_when_moving;
-
- /* Whether the selection is rounded down to the nearest week when we
- move back/forward one month. Used for the week view. */
- gboolean round_selection_when_moving;
-
- /* Whether to display the pop-up, TRUE by default */
- gboolean display_popup;
-
- /*
- * Internal stuff.
- */
-
- /* Bounds of item. */
- gdouble x1, y1, x2, y2;
-
- /* The minimum size of each month, based on the fonts used. */
- gint min_month_width;
- gint min_month_height;
-
- /* The actual size of each month, after dividing extra space. */
- gint month_width;
- gint month_height;
-
- /* The offset to the left edge of the first calendar. */
- gint x_offset;
-
- /* The padding around each calendar month. */
- gint month_lpad, month_rpad;
- gint month_tpad, month_bpad;
-
- /* The size of each cell. */
- gint cell_width;
- gint cell_height;
-
- /* The current selection. The month offsets are from 0, which is the
- top-left calendar month view. Note that -1 is used for the last days
- from the previous month. The days are real month days. */
- gboolean selecting;
- gboolean selection_dragging_end;
- gboolean selection_from_full_week;
- gboolean selection_set;
- gint selection_start_month_offset;
- gint selection_start_day;
- gint selection_end_month_offset;
- gint selection_end_day;
- gint selection_real_start_month_offset;
- gint selection_real_start_day;
-
- /* The first character of each day of the week, e.g. 'MTWTFSS'. */
- gchar *days;
-
- /* Widths of the day characters. */
- gint day_widths[7];
-
- /* Widths of the digits, '0' .. '9'. */
- gint digit_widths[10];
- gint max_digit_width;
- gint week_number_digit_widths[10];
- gint max_week_number_digit_width;
-
- /* Fonts for drawing text. If font isn't set it uses the font from the
- canvas widget. If week_number_font isn't set it uses font. */
- GdkFont *font, *old_font;
- GdkFont *week_number_font, *old_week_number_font;
-
- ECalendarItemStyleCallback style_callback;
- gpointer style_callback_data;
- GtkDestroyNotify style_callback_destroy;
-
- ECalendarItemGetTimeCallback time_callback;
- gpointer time_callback_data;
- GtkDestroyNotify time_callback_destroy;
-
- /* Colors for drawing. */
- GdkColor colors[E_CALENDAR_ITEM_COLOR_LAST];
-
- /* Our idle handler for emitting signals. */
- gint signal_emission_idle_id;
-
- /* A flag to indicate that the selection or date range has changed.
- When set the idle function will emit the signal and reset it to
- FALSE. This is so we don't emit it several times when args are set
- etc. */
- gboolean selection_changed;
- gboolean date_range_changed;
-};
-
-struct _ECalendarItemClass
-{
- GnomeCanvasItemClass parent_class;
-
- void (* date_range_changed) (ECalendarItem *calitem);
- void (* selection_changed) (ECalendarItem *calitem);
-};
-
-
-GtkType e_calendar_item_get_type (void);
-
-/* FIXME: months are 0-11 throughout, but 1-12 may be better. */
-
-void e_calendar_item_get_first_month (ECalendarItem *calitem,
- gint *year,
- gint *month);
-void e_calendar_item_set_first_month (ECalendarItem *calitem,
- gint year,
- gint month);
-
-/* Get the maximum number of days selectable */
-gint e_calendar_item_get_max_days_sel (ECalendarItem *calitem);
-
-/* Set the maximum number of days selectable */
-void e_calendar_item_set_max_days_sel (ECalendarItem *calitem,
- gint days);
-
-/* Get the maximum number of days selectable */
-gint e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem);
-
-/* Get the maximum number of days before whole weeks are selected */
-void e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
- gint days);
-
-/* Set the maximum number of days before whole weeks are selected */
-gboolean e_calendar_item_get_display_popup (ECalendarItem *calitem);
-
-/* Get the maximum number of days before whole weeks are selected */
-void e_calendar_item_set_display_popup (ECalendarItem *calitem,
- gboolean display);
-
-/* Set the maximum number of days before whole weeks are selected */
-gint e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem);
-
-/* Set the maximum number of days selectable */
-void e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
- gint days);
-
-/* Gets the range of dates actually shown. Months are 0 to 11.
- This also includes the last days of the previous month and the first days
- of the following month, which are normally shown in gray.
- It returns FALSE if no dates are currently shown. */
-gboolean e_calendar_item_get_date_range (ECalendarItem *calitem,
- gint *start_year,
- gint *start_month,
- gint *start_day,
- gint *end_year,
- gint *end_month,
- gint *end_day);
-
-/* Returns the selected date range. It returns FALSE if no days are currently
- selected. */
-gboolean e_calendar_item_get_selection (ECalendarItem *calitem,
- GDate *start_date,
- GDate *end_date);
-/* Sets the selected date range, and changes the date range shown so at least
- the start of the selection is shown. If start_date is NULL it clears the
- selection. */
-void e_calendar_item_set_selection (ECalendarItem *calitem,
- GDate *start_date,
- GDate *end_date);
-
-/* Marks a particular day. Passing E_CALENDAR_ITEM_MARK_BOLD as the day style
- will result in the day being shown as bold by default. The style callback
- could support more day_styles, or the style callback could determine the
- colors itself, without needing to mark days. */
-void e_calendar_item_clear_marks (ECalendarItem *calitem);
-void e_calendar_item_mark_day (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- guint8 day_style);
-
-/* Mark a range of days. Any days outside the currently shown range are
- ignored. */
-void e_calendar_item_mark_days (ECalendarItem *calitem,
- gint start_year,
- gint start_month,
- gint start_day,
- gint end_year,
- gint end_month,
- gint end_day,
- guint8 day_style);
-
-/* Sets the function to call to get the colors to use for a particular day. */
-void e_calendar_item_set_style_callback (ECalendarItem *calitem,
- ECalendarItemStyleCallback cb,
- gpointer data,
- GtkDestroyNotify destroy);
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void e_calendar_item_set_get_time_callback (ECalendarItem *calitem,
- ECalendarItemGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CALENDAR_ITEM_H_ */
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
deleted file mode 100644
index 105afc555a..0000000000
--- a/widgets/misc/e-calendar.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECalendar - displays a table of monthly calendars, allowing highlighting
- * and selection of one or more days. Like GtkCalendar with more features.
- * Most of the functionality is in the ECalendarItem canvas item, though
- * we also add GnomeCanvasWidget buttons to go to the previous/next month and
- * to got to the current day.
- */
-
-#include <config.h>
-
-#include "e-calendar.h"
-
-#include <glib.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtksignal.h>
-#include <libgnomecanvas/gnome-canvas-widget.h>
-#include <gal/util/e-util.h>
-
-#define E_CALENDAR_SMALL_FONT \
- "-adobe-utopia-regular-r-normal-*-*-100-*-*-p-*-iso8859-*"
-#define E_CALENDAR_SMALL_FONT_FALLBACK \
- "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-*"
-
-/* The space between the arrow buttons and the edge of the widget. */
-#define E_CALENDAR_ARROW_BUTTON_X_PAD 2
-#define E_CALENDAR_ARROW_BUTTON_Y_PAD 0
-
-/* Vertical padding. The padding above the button includes the space for the
- horizontal line. */
-#define E_CALENDAR_YPAD_ABOVE_LOWER_BUTTONS 4
-#define E_CALENDAR_YPAD_BELOW_LOWER_BUTTONS 3
-
-/* Horizontal padding inside & between buttons. */
-#define E_CALENDAR_IXPAD_BUTTONS 4
-#define E_CALENDAR_XPAD_BUTTONS 8
-
-/* The time between steps when the prev/next buttons is pressed, in 1/1000ths
- of a second, and the number of timeouts we skip before we start
- automatically moving back/forward. */
-#define E_CALENDAR_AUTO_MOVE_TIMEOUT 150
-#define E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY 2
-
-static char * left_arrow_xpm[] = {
- "7 7 3 1",
- " c None",
- ". c #949594",
- "+ c #000000",
- " .+",
- " .+++",
- " .+++++",
- "+++++++",
- " .+++++",
- " .+++",
- " .+"
-};
-
-static char * right_arrow_xpm[] = {
- "7 7 3 1",
- " c None",
- ". c #949594",
- "+ c #000000",
- "+. ",
- "+++. ",
- "+++++. ",
- "+++++++",
- "+++++. ",
- "+++. ",
- "+. "
-};
-
-
-static void e_calendar_class_init (ECalendarClass *class);
-static void e_calendar_init (ECalendar *cal);
-static void e_calendar_destroy (GtkObject *object);
-static void e_calendar_realize (GtkWidget *widget);
-static void e_calendar_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static void e_calendar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void e_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint e_calendar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
-static void e_calendar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time);
-
-static void e_calendar_on_prev_pressed (ECalendar *cal);
-static void e_calendar_on_prev_released (ECalendar *cal);
-static void e_calendar_on_next_pressed (ECalendar *cal);
-static void e_calendar_on_next_released (ECalendar *cal);
-
-static void e_calendar_start_auto_move (ECalendar *cal,
- gboolean moving_forward);
-static gboolean e_calendar_auto_move_handler (gpointer data);
-static void e_calendar_stop_auto_move (ECalendar *cal);
-
-static GnomeCanvasClass *parent_class;
-static GtkLayoutClass *grandparent_class;
-
-E_MAKE_TYPE (e_calendar, "ECalendar", ECalendar,
- e_calendar_class_init, e_calendar_init, E_CANVAS_TYPE)
-
-
-static void
-e_calendar_class_init (ECalendarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = g_type_class_ref(E_CANVAS_TYPE);
- grandparent_class = g_type_class_ref(GTK_TYPE_LAYOUT);
-
- object_class->destroy = e_calendar_destroy;
-
- widget_class->realize = e_calendar_realize;
- widget_class->style_set = e_calendar_style_set;
- widget_class->size_request = e_calendar_size_request;
- widget_class->size_allocate = e_calendar_size_allocate;
- widget_class->drag_motion = e_calendar_drag_motion;
- widget_class->drag_leave = e_calendar_drag_leave;
-}
-
-
-static void
-e_calendar_init (ECalendar *cal)
-{
- GnomeCanvasGroup *canvas_group;
- GdkFont *small_font;
- GtkWidget *button, *pixmap;
- GdkColormap *colormap;
- GdkPixmap *gdk_pixmap;
- GdkBitmap *gdk_mask;
-
- GTK_WIDGET_UNSET_FLAGS (cal, GTK_CAN_FOCUS);
-
- /* Create the small font. */
- small_font = gdk_font_load (E_CALENDAR_SMALL_FONT);
- if (!small_font)
- small_font = gdk_font_load (E_CALENDAR_SMALL_FONT_FALLBACK);
- if (!small_font)
- g_warning ("Couldn't load font");
-
- canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (cal)->root);
-
- cal->calitem = E_CALENDAR_ITEM (gnome_canvas_item_new (canvas_group,
- e_calendar_item_get_type (),
- "week_number_font", small_font,
- NULL));
-
- if (small_font)
- gdk_font_unref (small_font);
-
-
- /* Create the arrow buttons to move to the previous/next month. */
- button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- gtk_widget_show (button);
- gtk_signal_connect_object (GTK_OBJECT (button), "pressed",
- G_CALLBACK (e_calendar_on_prev_pressed),
- GTK_OBJECT (cal));
- gtk_signal_connect_object (GTK_OBJECT (button), "released",
- G_CALLBACK (e_calendar_on_prev_released),
- GTK_OBJECT (cal));
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (cal));
- gdk_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap,
- &gdk_mask, NULL,
- left_arrow_xpm);
- pixmap = gtk_pixmap_new (gdk_pixmap, gdk_mask);
- gtk_widget_show (pixmap);
- gdk_pixmap_unref (gdk_pixmap);
- g_object_unref (gdk_mask);
- gtk_container_add (GTK_CONTAINER (button), pixmap);
-
- cal->prev_item = gnome_canvas_item_new (canvas_group,
- gnome_canvas_widget_get_type (),
- "widget", button,
- NULL);
-
- button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- gtk_widget_show (button);
- gtk_signal_connect_object (GTK_OBJECT (button), "pressed",
- G_CALLBACK (e_calendar_on_next_pressed),
- GTK_OBJECT (cal));
- gtk_signal_connect_object (GTK_OBJECT (button), "released",
- G_CALLBACK (e_calendar_on_next_released),
- GTK_OBJECT (cal));
-
- gdk_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap,
- &gdk_mask, NULL,
- right_arrow_xpm);
- pixmap = gtk_pixmap_new (gdk_pixmap, gdk_mask);
- gtk_widget_show (pixmap);
- gdk_pixmap_unref (gdk_pixmap);
- g_object_unref (gdk_mask);
- gtk_container_add (GTK_CONTAINER (button), pixmap);
-
- cal->next_item = gnome_canvas_item_new (canvas_group,
- gnome_canvas_widget_get_type (),
- "widget", button,
- NULL);
-
- cal->min_rows = 1;
- cal->min_cols = 1;
- cal->max_rows = -1;
- cal->max_cols = -1;
-
- cal->timeout_id = 0;
-}
-
-
-/**
- * e_calendar_new:
- * @Returns: a new #ECalendar.
- *
- * Creates a new #ECalendar.
- **/
-GtkWidget *
-e_calendar_new (void)
-{
- GtkWidget *cal;
-
- cal = gtk_type_new (e_calendar_get_type ());
-
- return cal;
-}
-
-
-static void
-e_calendar_destroy (GtkObject *object)
-{
- ECalendar *cal;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_CALENDAR (object));
-
- cal = E_CALENDAR (object);
-
- if (cal->timeout_id != 0) {
- gtk_timeout_remove (cal->timeout_id);
- cal->timeout_id = 0;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-e_calendar_realize (GtkWidget *widget)
-{
- (*GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- /* Set the background of the canvas window to the normal color,
- or the arrow buttons are not displayed properly. */
- gdk_window_set_background (GTK_LAYOUT (widget)->bin_window,
- &widget->style->bg[GTK_STATE_NORMAL]);
-}
-
-
-static void
-e_calendar_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- if (GTK_WIDGET_CLASS (parent_class)->style_set)
- (*GTK_WIDGET_CLASS (parent_class)->style_set) (widget,
- previous_style);
-
- /* Set the background of the canvas window to the normal color,
- or the arrow buttons are not displayed properly. */
- if (GTK_WIDGET_REALIZED (widget->parent))
- gdk_window_set_background (GTK_LAYOUT (widget)->bin_window,
- &widget->style->bg[GTK_STATE_NORMAL]);
-}
-
-
-static void
-e_calendar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- ECalendar *cal;
- GtkStyle *style;
- gint col_width, row_height, width, height;
-
- cal = E_CALENDAR (widget);
- style = GTK_WIDGET (cal)->style;
-
- g_object_get((cal->calitem),
- "row_height", &row_height,
- "column_width", &col_width,
- NULL);
-
- height = row_height * cal->min_rows;
- width = col_width * cal->min_cols;
-
- requisition->width = width + style->xthickness * 2;
- requisition->height = height + style->ythickness * 2;
-}
-
-
-static void
-e_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- ECalendar *cal;
- GdkFont *font;
- gdouble old_x2, old_y2, new_x2, new_y2;
- gdouble xthickness, ythickness, arrow_button_size;
-
- cal = E_CALENDAR (widget);
- font = gtk_style_get_font (widget->style);
- xthickness = widget->style->xthickness;
- ythickness = widget->style->ythickness;
-
- (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- /* Set the scroll region to its allocated size, if changed. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (cal),
- NULL, NULL, &old_x2, &old_y2);
- new_x2 = widget->allocation.width - 1;
- new_y2 = widget->allocation.height - 1;
- if (old_x2 != new_x2 || old_y2 != new_y2)
- gnome_canvas_set_scroll_region (GNOME_CANVAS (cal),
- 0, 0, new_x2, new_y2);
-
- /* Take off space for line & buttons if shown. */
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem),
- "x1", 0.0,
- "y1", 0.0,
- "x2", new_x2,
- "y2", new_y2,
- NULL);
-
-
- /* Position the arrow buttons. */
- arrow_button_size = font->ascent + font->descent
- + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME
- + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME
- - E_CALENDAR_ARROW_BUTTON_Y_PAD * 2;
-
- gnome_canvas_item_set (cal->prev_item,
- "x", xthickness * 2
- + E_CALENDAR_ARROW_BUTTON_X_PAD,
- "y", ythickness * 2
- + E_CALENDAR_ARROW_BUTTON_Y_PAD,
- "width", arrow_button_size,
- "height", arrow_button_size,
- NULL);
-
- gnome_canvas_item_set (cal->next_item,
- "x", new_x2 + 1 - xthickness * 2
- - E_CALENDAR_ARROW_BUTTON_X_PAD
- - arrow_button_size,
- "y", ythickness * 2
- + E_CALENDAR_ARROW_BUTTON_Y_PAD,
- "width", arrow_button_size,
- "height", arrow_button_size,
- NULL);
-}
-
-void
-e_calendar_set_minimum_size (ECalendar *cal,
- gint rows,
- gint cols)
-{
- g_return_if_fail (E_IS_CALENDAR (cal));
-
- cal->min_rows = rows;
- cal->min_cols = cols;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem),
- "minimum_rows", rows,
- "minimum_columns", cols,
- NULL);
-
- gtk_widget_queue_resize (GTK_WIDGET (cal));
-}
-
-
-void
-e_calendar_set_maximum_size (ECalendar *cal,
- gint rows,
- gint cols)
-{
- g_return_if_fail (E_IS_CALENDAR (cal));
-
- cal->max_rows = rows;
- cal->max_cols = cols;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem),
- "maximum_rows", rows,
- "maximum_columns", cols,
- NULL);
-
- gtk_widget_queue_resize (GTK_WIDGET (cal));
-}
-
-
-/* Returns the border size on each side of the month displays. */
-void
-e_calendar_get_border_size (ECalendar *cal,
- gint *top,
- gint *bottom,
- gint *left,
- gint *right)
-{
- GtkStyle *style;
-
- g_return_if_fail (E_IS_CALENDAR (cal));
-
- style = GTK_WIDGET (cal)->style;
-
- if (style) {
- *top = style->ythickness;
- *bottom = style->ythickness;
- *left = style->xthickness;
- *right = style->xthickness;
- } else {
- *top = *bottom = *left = *right = 0;
- }
-}
-
-
-static void
-e_calendar_on_prev_pressed (ECalendar *cal)
-{
- e_calendar_start_auto_move (cal, FALSE);
-}
-
-
-static void
-e_calendar_on_next_pressed (ECalendar *cal)
-{
- e_calendar_start_auto_move (cal, TRUE);
-}
-
-
-static void
-e_calendar_start_auto_move (ECalendar *cal,
- gboolean moving_forward)
-{
- ECalendarItem *calitem;
- gint offset;
-
- if (cal->timeout_id == 0) {
- cal->timeout_id = g_timeout_add (E_CALENDAR_AUTO_MOVE_TIMEOUT,
- e_calendar_auto_move_handler,
- cal);
- }
- cal->timeout_delay = E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY;
- cal->moving_forward = moving_forward;
-
- calitem = cal->calitem;
- offset = cal->moving_forward ? 1 : -1;
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month + offset);
-}
-
-
-static gboolean
-e_calendar_auto_move_handler (gpointer data)
-{
- ECalendar *cal;
- ECalendarItem *calitem;
- gint offset;
-
- g_return_val_if_fail (E_IS_CALENDAR (data), FALSE);
-
- cal = E_CALENDAR (data);
- calitem = cal->calitem;
-
- GDK_THREADS_ENTER ();
-
- if (cal->timeout_delay > 0) {
- cal->timeout_delay--;
- } else {
- offset = cal->moving_forward ? 1 : -1;
- e_calendar_item_set_first_month (calitem, calitem->year,
- calitem->month + offset);
- }
-
- GDK_THREADS_LEAVE ();
- return TRUE;
-}
-
-
-static void
-e_calendar_on_prev_released (ECalendar *cal)
-{
- e_calendar_stop_auto_move (cal);
-}
-
-
-static void
-e_calendar_on_next_released (ECalendar *cal)
-{
- e_calendar_stop_auto_move (cal);
-}
-
-
-static void
-e_calendar_stop_auto_move (ECalendar *cal)
-{
- if (cal->timeout_id != 0) {
- gtk_timeout_remove (cal->timeout_id);
- cal->timeout_id = 0;
- }
-}
-
-
-static gint
-e_calendar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
-{
- ECalendar *cal;
-
- g_return_val_if_fail (E_IS_CALENDAR (widget), FALSE);
-
- cal = E_CALENDAR (widget);
-
-#if 0
- g_print ("In e_calendar_drag_motion\n");
-#endif
-
- return FALSE;
-}
-
-
-static void
-e_calendar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time)
-{
- ECalendar *cal;
-
- g_return_if_fail (E_IS_CALENDAR (widget));
-
- cal = E_CALENDAR (widget);
-
-#if 0
- g_print ("In e_calendar_drag_leave\n");
-#endif
-}
-
diff --git a/widgets/misc/e-calendar.h b/widgets/misc/e-calendar.h
deleted file mode 100644
index aadde962f4..0000000000
--- a/widgets/misc/e-calendar.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_CALENDAR_H_
-#define _E_CALENDAR_H_
-
-#include <gtk/gtkwidget.h>
-#include <gal/widgets/e-canvas.h>
-#include "e-calendar-item.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * ECalendar - displays a table of monthly calendars, allowing highlighting
- * and selection of one or more days. Like GtkCalendar with more features.
- * Most of the functionality is in the ECalendarItem canvas item, though
- * we also add GnomeCanvasWidget buttons to go to the previous/next month and
- * to got to the current day.
- */
-
-#define E_CALENDAR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_get_type (), ECalendar)
-#define E_CALENDAR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_get_type (), ECalendarClass)
-#define E_IS_CALENDAR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_get_type ())
-
-
-typedef struct _ECalendar ECalendar;
-typedef struct _ECalendarClass ECalendarClass;
-
-struct _ECalendar
-{
- ECanvas canvas;
-
- ECalendarItem *calitem;
-
- GnomeCanvasItem *prev_item;
- GnomeCanvasItem *next_item;
-
- gint min_rows;
- gint min_cols;
-
- gint max_rows;
- gint max_cols;
-
- /* These are all used when the prev/next buttons are held down.
- moving_forward is TRUE if we are moving forward in time, i.e. the
- next button is pressed. */
- gint timeout_id;
- gint timeout_delay;
- gboolean moving_forward;
-};
-
-struct _ECalendarClass
-{
- ECanvasClass parent_class;
-};
-
-
-GtkType e_calendar_get_type (void);
-GtkWidget* e_calendar_new (void);
-
-void e_calendar_set_minimum_size (ECalendar *cal,
- gint rows,
- gint cols);
-void e_calendar_set_maximum_size (ECalendar *cal,
- gint rows,
- gint cols);
-
-/* Returns the border size on each side of the month displays. */
-void e_calendar_get_border_size (ECalendar *cal,
- gint *top,
- gint *bottom,
- gint *left,
- gint *right);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CALENDAR_H_ */
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
deleted file mode 100644
index d2d68d180f..0000000000
--- a/widgets/misc/e-canvas-background.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-background.c - background color for canvas.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-canvas-background.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include "gal/widgets/e-hsv-utils.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-#include <string.h>
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define d(x)
-
-struct _ECanvasBackgroundPrivate {
- guint rgba; /* Fill color, RGBA */
- GdkColor color; /* Fill color */
- GdkBitmap *stipple; /* Stipple for fill */
- GdkGC *gc; /* GC for filling */
- double x1;
- double x2;
- double y1;
- double y2;
-
- guint needs_redraw : 1;
-};
-
-static GnomeCanvasItemClass *parent_class;
-
-enum {
- PROP_0,
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
- PROP_FILL_COLOR_RGBA,
- PROP_FILL_STIPPLE,
- PROP_X1,
- PROP_X2,
- PROP_Y1,
- PROP_Y2,
-};
-
-static void
-get_color(ECanvasBackground *ecb)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb);
- ecb->priv->color.pixel = gnome_canvas_get_color_pixel (item->canvas,
- GNOME_CANVAS_COLOR (ecb->priv->color.red >> 8,
- ecb->priv->color.green>> 8,
- ecb->priv->color.blue>> 8));
-}
-
-static void
-ecb_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
-{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- /* Wrong BBox's are the source of redraw nightmares */
-
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (ecb), i2c);
-
- i1.x = ecb->priv->x1;
- i1.y = ecb->priv->y1;
- i2.x = ecb->priv->x2;
- i2.y = ecb->priv->y2;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- if (ecb->priv->x1 < 0)
- c1.x = -(double)UINT_MAX;
-
- if (ecb->priv->y1 < 0)
- c1.y = -(double)UINT_MAX;
-
- if (ecb->priv->x2 < 0)
- c2.x = (double)UINT_MAX;
-
- if (ecb->priv->y2 < 0)
- c2.y = (double)UINT_MAX;
-
- *x1 = c1.x;
- *y1 = c1.y;
- *x2 = c2.x + 1;
- *y2 = c2.y + 1;
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-ecb_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ArtPoint o1, o2;
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->update (item, affine, clip_path, flags);
-
- o1.x = item->x1;
- o1.y = item->y1;
- o2.x = item->x2;
- o2.y = item->y2;
-
- ecb_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- if (item->x1 != o1.x ||
- item->y1 != o1.y ||
- item->x2 != o2.x ||
- item->y2 != o2.y) {
- gnome_canvas_request_redraw (item->canvas, o1.x, o1.y, o2.x, o2.y);
- ecb->priv->needs_redraw = 1;
- }
-
- if (ecb->priv->needs_redraw) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
- item->x2, item->y2);
- ecb->priv->needs_redraw = 0;
- }
-}
-
-/* Sets the stipple pattern for the text */
-static void
-set_stipple (ECanvasBackground *ecb, GdkBitmap *stipple, int use_value)
-{
- if (use_value) {
- if (ecb->priv->stipple)
- gdk_bitmap_unref (ecb->priv->stipple);
-
- ecb->priv->stipple = stipple;
- if (stipple)
- gdk_bitmap_ref (stipple);
- }
-
- if (ecb->priv->gc) {
- if (stipple) {
- gdk_gc_set_stipple (ecb->priv->gc, stipple);
- gdk_gc_set_fill (ecb->priv->gc, GDK_STIPPLED);
- } else
- gdk_gc_set_fill (ecb->priv->gc, GDK_SOLID);
- }
-}
-
-static void
-ecb_dispose (GObject *object)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (object);
-
- if (ecb->priv) {
- if (ecb->priv->stipple)
- gdk_bitmap_unref (ecb->priv->stipple);
- ecb->priv->stipple = NULL;
-
- g_free (ecb->priv);
- ecb->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-ecb_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasBackground *ecb;
-
- GdkColor color = { 0, 0, 0, 0, };
- GdkColor *pcolor;
- gboolean color_changed = FALSE;
-
- item = GNOME_CANVAS_ITEM (object);
- ecb = E_CANVAS_BACKGROUND (object);
-
- switch (prop_id){
- case PROP_FILL_COLOR:
- if (g_value_get_string (value))
- gdk_color_parse (g_value_get_string (value), &color);
-
- ecb->priv->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_GDK:
- pcolor = g_value_get_pointer (value);
- if (pcolor) {
- color = *pcolor;
- }
-
- ecb->priv->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_RGBA:
- ecb->priv->rgba = g_value_get_uint (value);
- color.red = ((ecb->priv->rgba >> 24) & 0xff) * 0x101;
- color.green = ((ecb->priv->rgba >> 16) & 0xff) * 0x101;
- color.blue = ((ecb->priv->rgba >> 8) & 0xff) * 0x101;
- color_changed = TRUE;
- break;
-
- case PROP_FILL_STIPPLE:
- set_stipple (ecb, g_value_get_object (value), TRUE);
- break;
-
- case PROP_X1:
- ecb->priv->x1 = g_value_get_double (value);
- break;
- case PROP_X2:
- ecb->priv->x2 = g_value_get_double (value);
- break;
- case PROP_Y1:
- ecb->priv->y1 = g_value_get_double (value);
- break;
- case PROP_Y2:
- ecb->priv->y2 = g_value_get_double (value);
- break;
- }
-
- if (color_changed) {
- ecb->priv->color = color;
-
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) {
- get_color (ecb);
- if (!item->canvas->aa) {
- gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color);
- }
- }
- }
-
- ecb->priv->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ecb));
-}
-
-static void
-ecb_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasBackground *ecb;
-
- item = GNOME_CANVAS_ITEM (object);
- ecb = E_CANVAS_BACKGROUND (object);
-
- switch (prop_id){
- case PROP_FILL_COLOR_GDK:
- g_value_set_pointer (value, gdk_color_copy (&ecb->priv->color));
- break;
- case PROP_FILL_COLOR_RGBA:
- g_value_set_uint (value, ecb->priv->rgba);
- break;
- case PROP_FILL_STIPPLE:
- g_value_set_object (value, ecb->priv->stipple);
- break;
- case PROP_X1:
- g_value_set_double (value, ecb->priv->x1);
- break;
- case PROP_X2:
- g_value_set_double (value, ecb->priv->x2);
- break;
- case PROP_Y1:
- g_value_set_double (value, ecb->priv->y1);
- break;
- case PROP_Y2:
- g_value_set_double (value, ecb->priv->y2);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-ecb_init (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- ecb->priv = g_new (ECanvasBackgroundPrivate, 1);
-
- ecb->priv->color.pixel = 0;
- ecb->priv->color.red = 0;
- ecb->priv->color.green = 0;
- ecb->priv->color.blue = 0;
- ecb->priv->stipple = NULL;
- ecb->priv->gc = NULL;
- ecb->priv->x1 = -1.0;
- ecb->priv->x2 = -1.0;
- ecb->priv->y1 = -1.0;
- ecb->priv->y2 = -1.0;
-}
-
-static void
-ecb_realize (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item);
-
- ecb->priv->gc = gdk_gc_new (item->canvas->layout.bin_window);
- get_color (ecb);
- if (!item->canvas->aa)
- gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color);
-
- set_stipple (ecb, NULL, FALSE);
-
- ecb->priv->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb));
-}
-
-static void
-ecb_unrealize (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- gdk_gc_unref (ecb->priv->gc);
- ecb->priv->gc = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize (item);
-}
-
-static void
-ecb_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
- int x1, x2, y1, y2;
- double i2c [6];
- ArtPoint upper_left, lower_right, ecb_base_point;
-
- /*
- * Find out our real position after grouping
- */
- gnome_canvas_item_i2c_affine (item, i2c);
- ecb_base_point.x = ecb->priv->x1;
- ecb_base_point.y = ecb->priv->y1;
- art_affine_point (&upper_left, &ecb_base_point, i2c);
-
- ecb_base_point.x = ecb->priv->x2;
- ecb_base_point.y = ecb->priv->y2;
- art_affine_point (&lower_right, &ecb_base_point, i2c);
-
- x1 = 0;
- y1 = 0;
- x2 = width;
- y2 = height;
- if (ecb->priv->x1 >= 0 && upper_left.x > x1)
- x1 = upper_left.x;
- if (ecb->priv->y1 >= 0 && upper_left.y > y1)
- y1 = upper_left.y;
- if (ecb->priv->x2 >= 0 && lower_right.x < x2)
- x2 = lower_right.x;
- if (ecb->priv->y2 >= 0 && lower_right.y < y2)
- y2 = lower_right.y;
-
- gdk_draw_rectangle (drawable, ecb->priv->gc, TRUE,
- x1, y1, x2 - x1, y2 - y1);
-}
-
-static double
-ecb_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (ecb->priv->x1 >= 0 && ecb->priv->x1 > x)
- return 1.0;
- if (ecb->priv->x2 >= 0 && ecb->priv->x2 < x)
- return 1.0;
- if (ecb->priv->y1 >= 0 && ecb->priv->y1 > y)
- return 1.0;
- if (ecb->priv->y2 >= 0 && ecb->priv->y2 < y)
- return 1.0;
- *actual_item = item;
-
- return 0.0;
-}
-
-static void
-ecb_class_init (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- object_class->dispose = ecb_dispose;
- object_class->set_property = ecb_set_property;
- object_class->get_property = ecb_get_property;
-
- item_class->update = ecb_update;
- item_class->realize = ecb_realize;
- item_class->unrealize = ecb_unrealize;
- item_class->draw = ecb_draw;
- item_class->point = ecb_point;
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR,
- g_param_spec_string ("fill_color",
- _( "Fill color" ),
- _( "Fill color" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK,
- g_param_spec_pointer ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill_color_rgba",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_STIPPLE,
- g_param_spec_object ("fill_stipple",
- _( "Fill stipple" ),
- _( "FIll stipple" ),
- GDK_TYPE_WINDOW,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_X1,
- g_param_spec_double ("x1",
- _( "X1" ),
- _( "X1" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_X2,
- g_param_spec_double ("x2",
- _( "X2" ),
- _( "X2" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_Y1,
- g_param_spec_double ("y1",
- _( "Y1" ),
- _( "Y1" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_Y2,
- g_param_spec_double ("y2",
- _( "Y2" ),
- _( "Y2" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-}
-
-E_MAKE_TYPE (e_canvas_background,
- "ECanvasBackground",
- ECanvasBackground,
- ecb_class_init,
- ecb_init,
- PARENT_OBJECT_TYPE)
diff --git a/widgets/misc/e-canvas-background.h b/widgets/misc/e-canvas-background.h
deleted file mode 100644
index 4a8e3294fb..0000000000
--- a/widgets/misc/e-canvas-background.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-background.h - background color for canvas.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef E_CANVAS_BACKGROUND_H
-#define E_CANVAS_BACKGROUND_H
-
-#include <libgnomecanvas/gnome-canvas.h>
-
-G_BEGIN_DECLS
-
-/*
- * name type read/write description
- * ------------------------------------------------------------------------------------------
- * fill_color string W X color specification for fill color,
- * or NULL pointer for no color (transparent)
- * fill_color_gdk GdkColor* RW Allocated GdkColor for fill
- * fill_stipple GdkBitmap* RW Stipple pattern for fill
- * x1 double RW Coordinates for edges of background rectangle
- * x2 double RW Default is all of them = -1.
- * y1 double RW Which means that the entire space is shown.
- * y2 double RW If you need the rectangle to have negative coordinates, use an affine.
- */
-
-
-#define E_CANVAS_BACKGROUND_TYPE (e_canvas_background_get_type ())
-#define E_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_BACKGROUND_TYPE, ECanvasBackground))
-#define E_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_BACKGROUND_TYPE, ECanvasBackgroundClass))
-#define E_IS_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_BACKGROUND_TYPE))
-#define E_IS_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_CANVAS_BACKGROUND_TYPE))
-
-typedef struct _ECanvasBackground ECanvasBackground;
-typedef struct _ECanvasBackgroundClass ECanvasBackgroundClass;
-typedef struct _ECanvasBackgroundPrivate ECanvasBackgroundPrivate;
-
-struct _ECanvasBackground {
- GnomeCanvasItem item;
-
- ECanvasBackgroundPrivate *priv;
-};
-
-struct _ECanvasBackgroundClass {
- GnomeCanvasItemClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType e_canvas_background_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c
deleted file mode 100644
index 629804a2d7..0000000000
--- a/widgets/misc/e-canvas-utils.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "e-canvas-utils.h"
-
-void
-e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy)
-{
- double translate[6];
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- art_affine_translate (translate, dx, dy);
-
- gnome_canvas_item_affine_absolute (item, translate);
-}
-
-static double
-compute_offset(int top, int bottom, int page_top, int page_bottom)
-{
- int size = bottom - top;
- int offset = 0;
-
- if (top <= page_top && bottom >= page_bottom)
- return 0;
-
- if (bottom > page_bottom)
- offset = (bottom - page_bottom);
- if (top < page_top + offset)
- offset = (top - page_top);
-
- if (top <= page_top + offset && bottom >= page_bottom + offset)
- return offset;
-
- if (top < page_top + size * 3 / 2 + offset)
- offset = top - (page_top + size * 3 / 2);
- if (bottom > page_bottom - size * 3 / 2 + offset)
- offset = bottom - (page_bottom - size * 3 / 2);
- if (top < page_top + size * 3 / 2 + offset)
- offset = top - ((page_top + page_bottom - (bottom - top)) / 2);
-
- return offset;
-}
-
-
-static void
-e_canvas_show_area (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
-{
- GtkAdjustment *h, *v;
- int dx = 0, dy = 0;
-
- g_return_if_fail (canvas != NULL);
- g_return_if_fail (GNOME_IS_CANVAS (canvas));
-
- h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
- dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
- if (dx)
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
-
- v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
- dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
- if (dy)
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
-}
-
-void
-e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
-{
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- e_canvas_show_area(item->canvas, x1, y1, x2, y2);
-}
-
-
-static gboolean
-e_canvas_area_shown (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
-{
- GtkAdjustment *h, *v;
- int dx = 0, dy = 0;
-
- g_return_val_if_fail (canvas != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE);
-
- h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
- dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
- if (CLAMP(h->value + dx, h->lower, h->upper - h->page_size) - h->value != 0)
- return FALSE;
-
- v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
- dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
- if (CLAMP(v->value + dy, v->lower, v->upper - v->page_size) - v->value != 0)
- return FALSE;
- return TRUE;
-}
-
-gboolean
-e_canvas_item_area_shown (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
-{
- g_return_val_if_fail (item != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), FALSE);
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- return e_canvas_area_shown(item->canvas, x1, y1, x2, y2);
-}
-
-typedef struct {
- double x1;
- double y1;
- double x2;
- double y2;
- GnomeCanvas *canvas;
-} DoubsAndCanvas;
-
-static gboolean
-show_area_timeout (gpointer data)
-{
- DoubsAndCanvas *dac = data;
-
- e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2);
- g_object_unref (dac->canvas);
- g_free(dac);
- return FALSE;
-}
-
-void
-e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay)
-{
- DoubsAndCanvas *dac;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- dac = g_new(DoubsAndCanvas, 1);
- dac->x1 = x1;
- dac->y1 = y1;
- dac->x2 = x2;
- dac->y2 = y2;
- dac->canvas = item->canvas;
- g_object_ref (item->canvas);
- g_timeout_add(delay, show_area_timeout, dac);
-}
diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h
deleted file mode 100644
index 5b1a329140..0000000000
--- a/widgets/misc/e-canvas-utils.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __E_CANVAS_UTILS__
-#define __E_CANVAS_UTILS__
-
-#include <libgnomecanvas/gnome-canvas.h>
-
-G_BEGIN_DECLS
-
-void e_canvas_item_move_absolute (GnomeCanvasItem *item,
- double dx,
- double dy);
-void e_canvas_item_show_area (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2);
-void e_canvas_item_show_area_delayed (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2,
- gint delay);
-/* Returns TRUE if the area is already shown on the screen (including
- spacing.) This is equivelent to returning FALSE iff show_area
- would do anything. */
-gboolean e_canvas_item_area_shown (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2);
-
-G_END_DECLS
-
-#endif /* __E_CANVAS_UTILS__ */
diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c
deleted file mode 100644
index 354da5d872..0000000000
--- a/widgets/misc/e-canvas-vbox.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-vbox.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include "e-canvas-vbox.h"
-#include "e-canvas-utils.h"
-#include "e-canvas.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-
-static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox);
-static void e_canvas_vbox_class_init (ECanvasVboxClass *klass);
-static void e_canvas_vbox_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_canvas_vbox_dispose (GObject *object);
-
-static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_canvas_vbox_realize (GnomeCanvasItem *item);
-
-static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags);
-
-static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-static void e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-static void e_canvas_vbox_resize_children (GnomeCanvasItem *item);
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_WIDTH,
- PROP_MINIMUM_WIDTH,
- PROP_HEIGHT,
- PROP_SPACING
-};
-
-E_MAKE_TYPE (e_canvas_vbox,
- "ECanvasVbox",
- ECanvasVbox,
- e_canvas_vbox_class_init,
- e_canvas_vbox_init,
- PARENT_TYPE)
-
-static void
-e_canvas_vbox_class_init (ECanvasVboxClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- klass->add_item = e_canvas_vbox_real_add_item;
- klass->add_item_start = e_canvas_vbox_real_add_item_start;
-
- object_class->set_property = e_canvas_vbox_set_property;
- object_class->get_property = e_canvas_vbox_get_property;
- object_class->dispose = e_canvas_vbox_dispose;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_canvas_vbox_event;
- item_class->realize = e_canvas_vbox_realize;
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_SPACING,
- g_param_spec_double ("spacing",
- _( "Spacing" ),
- _( "Spacing" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-}
-
-static void
-e_canvas_vbox_init (ECanvasVbox *vbox)
-{
- vbox->items = NULL;
-
- vbox->width = 10;
- vbox->minimum_width = 10;
- vbox->height = 10;
- vbox->spacing = 0;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow);
-}
-
-static void
-e_canvas_vbox_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasVbox *e_canvas_vbox;
-
- item = GNOME_CANVAS_ITEM (object);
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (prop_id){
- case PROP_WIDTH:
- case PROP_MINIMUM_WIDTH:
- e_canvas_vbox->minimum_width = g_value_get_double (value);
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
- break;
- case PROP_SPACING:
- e_canvas_vbox->spacing = g_value_get_double (value);
- e_canvas_item_request_reflow(item);
- break;
- }
-}
-
-static void
-e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (prop_id) {
- case PROP_WIDTH:
- g_value_set_double (value, e_canvas_vbox->width);
- break;
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, e_canvas_vbox->minimum_width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, e_canvas_vbox->height);
- break;
- case PROP_SPACING:
- g_value_set_double (value, e_canvas_vbox->spacing);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* Used from g_list_foreach(); disconnects from an item's signals */
-static void
-disconnect_item_cb (gpointer data, gpointer user_data)
-{
- ECanvasVbox *vbox;
- GnomeCanvasItem *item;
-
- vbox = E_CANVAS_VBOX (user_data);
-
- item = GNOME_CANVAS_ITEM (data);
- g_signal_handlers_disconnect_matched (item,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- vbox);
-}
-
-static void
-e_canvas_vbox_dispose (GObject *object)
-{
- ECanvasVbox *vbox = E_CANVAS_VBOX(object);
-
- if (vbox->items) {
- g_list_foreach(vbox->items, disconnect_item_cb, vbox);
- g_list_free(vbox->items);
- vbox->items = NULL;
- }
-
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static gint
-e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- gint return_val = TRUE;
-
- switch (event->type) {
- case GDK_KEY_PRESS:
- switch (event->key.keyval) {
- case GDK_Left:
- case GDK_KP_Left:
- case GDK_Right:
- case GDK_KP_Right:
- case GDK_Down:
- case GDK_KP_Down:
- case GDK_Up:
- case GDK_KP_Up:
- case GDK_Return:
- case GDK_KP_Enter:
- return_val = TRUE;
- break;
- default:
- return_val = FALSE;
- break;
- }
- break;
- default:
- return_val = FALSE;
- break;
- }
- if (!return_val) {
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event);
- }
- return return_val;
-
-}
-
-static void
-e_canvas_vbox_realize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_canvas_vbox_remove_item (gpointer data, GObject *where_object_was)
-{
- ECanvasVbox *vbox = data;
- vbox->items = g_list_remove(vbox->items, where_object_was);
-}
-
-static void
-e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
- g_object_weak_ref (G_OBJECT (item),
- e_canvas_vbox_remove_item, e_canvas_vbox);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- e_canvas_item_request_reflow(item);
- }
-}
-
-
-static void
-e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- e_canvas_vbox->items = g_list_prepend(e_canvas_vbox->items, item);
- g_object_weak_ref (G_OBJECT (item),
- e_canvas_vbox_remove_item, e_canvas_vbox);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- e_canvas_item_request_reflow(item);
- }
-}
-
-static void
-e_canvas_vbox_resize_children (GnomeCanvasItem *item)
-{
- GList *list;
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (item);
- for ( list = e_canvas_vbox->items; list; list = list->next ) {
- GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(child,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- }
-}
-
-static void
-e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags )
-{
- ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
-
- gdouble old_height;
- gdouble running_height;
- gdouble old_width;
- gdouble max_width;
-
- old_width = e_canvas_vbox->width;
- max_width = e_canvas_vbox->minimum_width;
-
- old_height = e_canvas_vbox->height;
- running_height = 0;
-
- if (e_canvas_vbox->items == NULL) {
- } else {
- GList *list;
- gdouble item_height;
- gdouble item_width;
-
- list = e_canvas_vbox->items;
- g_object_get (list->data,
- "height", &item_height,
- "width", &item_width,
- NULL);
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
- running_height += item_height;
- if (max_width < item_width)
- max_width = item_width;
- list = g_list_next(list);
-
- for( ; list; list = g_list_next(list)) {
- running_height += e_canvas_vbox->spacing;
-
- g_object_get (list->data,
- "height", &item_height,
- "width", &item_width,
- NULL);
-
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
-
- running_height += item_height;
- if (max_width < item_width)
- max_width = item_width;
- }
-
- }
- e_canvas_vbox->height = running_height;
- e_canvas_vbox->width = max_width;
- if (old_height != e_canvas_vbox->height ||
- old_width != e_canvas_vbox->width)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-void
-e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item) (e_canvas_vbox, item);
-}
-
-void
-e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start) (e_canvas_vbox, item);
-}
-
diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h
deleted file mode 100644
index 7d80e7c056..0000000000
--- a/widgets/misc/e-canvas-vbox.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-vbox.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __E_CANVAS_VBOX_H__
-#define __E_CANVAS_VBOX_H__
-
-#include <gtk/gtktypeutils.h>
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ECanvasVbox - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the CanvasVbox
- * height double R height of the CanvasVbox
- * spacing double RW Spacing between items.
- */
-
-#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ())
-#define E_CANVAS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox))
-#define E_CANVAS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass))
-#define E_IS_CANVAS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-#define E_IS_CANVAS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-
-
-typedef struct _ECanvasVbox ECanvasVbox;
-typedef struct _ECanvasVboxClass ECanvasVboxClass;
-
-struct _ECanvasVbox
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- GList *items; /* Of type GnomeCanvasItem */
-
- double width;
- double minimum_width;
- double height;
- double spacing;
-};
-
-struct _ECanvasVboxClass
-{
- GnomeCanvasGroupClass parent_class;
-
- /* Virtual methods. */
- void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
- void (* add_item_start) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
-};
-
-/*
- * To be added to a CanvasVbox, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent CanvasVbox request if its size
- * changes.
- */
-void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-void e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-GtkType e_canvas_vbox_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CANVAS_VBOX_H__ */
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
deleted file mode 100644
index 310ae9a01a..0000000000
--- a/widgets/misc/e-canvas.c
+++ /dev/null
@@ -1,1168 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtksignal.h>
-#include "e-canvas.h"
-#include "gal/util/e-util.h"
-#include <X11/Xlib.h>
-#include <gtk/gtkmain.h>
-
-static void e_canvas_init (ECanvas *card);
-static void e_canvas_dispose (GObject *object);
-static void e_canvas_class_init (ECanvasClass *klass);
-static void e_canvas_realize (GtkWidget *widget);
-static void e_canvas_unrealize (GtkWidget *widget);
-static gint e_canvas_key (GtkWidget *widget,
- GdkEventKey *event);
-static gint e_canvas_button (GtkWidget *widget,
- GdkEventButton *event);
-
-static gint e_canvas_visibility (GtkWidget *widget,
- GdkEventVisibility *event,
- ECanvas *canvas);
-
-static gint e_canvas_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint e_canvas_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-
-static void e_canvas_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-
-static int emit_event (GnomeCanvas *canvas, GdkEvent *event);
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS
-static GnomeCanvasClass *parent_class = NULL;
-
-#define d(x)
-
-enum {
- REFLOW,
- LAST_SIGNAL
-};
-
-static guint e_canvas_signals [LAST_SIGNAL] = { 0, };
-
-E_MAKE_TYPE (e_canvas,
- "ECanvas",
- ECanvas,
- e_canvas_class_init,
- e_canvas_init,
- PARENT_TYPE)
-
-static void
-e_canvas_class_init (ECanvasClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasClass *canvas_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GObjectClass*) klass;
- canvas_class = (GnomeCanvasClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = e_canvas_dispose;
-
- widget_class->key_press_event = e_canvas_key;
- widget_class->key_release_event = e_canvas_key;
- widget_class->button_press_event = e_canvas_button;
- widget_class->button_release_event = e_canvas_button;
- widget_class->focus_in_event = e_canvas_focus_in;
- widget_class->focus_out_event = e_canvas_focus_out;
- widget_class->style_set = e_canvas_style_set;
- widget_class->realize = e_canvas_realize;
- widget_class->unrealize = e_canvas_unrealize;
-
- klass->reflow = NULL;
-
- e_canvas_signals [REFLOW] =
- g_signal_new ("reflow",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECanvasClass, reflow),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-e_canvas_init (ECanvas *canvas)
-{
- canvas->selection = NULL;
- canvas->cursor = NULL;
-#ifdef GAL_GDK_IM
- canvas->ic = NULL;
- canvas->ic_attr = NULL;
-#endif
- canvas->tooltip_window = NULL;
-}
-
-static void
-e_canvas_dispose (GObject *object)
-{
- ECanvas *canvas = E_CANVAS(object);
-
- if (canvas->idle_id)
- g_source_remove(canvas->idle_id);
- canvas->idle_id = 0;
-
- if (canvas->toplevel) {
- if (canvas->visibility_notify_id)
- g_signal_handler_disconnect (canvas->toplevel,
- canvas->visibility_notify_id);
- canvas->visibility_notify_id = 0;
-
- g_object_unref (canvas->toplevel);
- canvas->toplevel = NULL;
- }
-
- e_canvas_hide_tooltip(canvas);
-
- if ((G_OBJECT_CLASS (parent_class))->dispose)
- (*(G_OBJECT_CLASS (parent_class))->dispose) (object);
-}
-
-GtkWidget *
-e_canvas_new ()
-{
- return GTK_WIDGET (g_object_new (E_CANVAS_TYPE, NULL));
-}
-
-
-/* Emits an event for an item in the canvas, be it the current item, grabbed
- * item, or focused item, as appropriate.
- */
-static int
-emit_event (GnomeCanvas *canvas, GdkEvent *event)
-{
- GdkEvent ev;
- gint finished;
- GnomeCanvasItem *item;
- GnomeCanvasItem *parent;
- guint mask;
-
- /* Choose where we send the event */
-
- item = canvas->current_item;
-
- if (canvas->focused_item
- && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE)))
- item = canvas->focused_item;
-
- if (canvas->grabbed_item)
- item = canvas->grabbed_item;
-
- /* Perform checks for grabbed items */
-
- if (canvas->grabbed_item) {
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- mask = GDK_ENTER_NOTIFY_MASK;
- break;
-
- case GDK_LEAVE_NOTIFY:
- mask = GDK_LEAVE_NOTIFY_MASK;
- break;
-
- case GDK_MOTION_NOTIFY:
- mask = GDK_POINTER_MOTION_MASK;
- break;
-
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- mask = GDK_BUTTON_PRESS_MASK;
- break;
-
- case GDK_BUTTON_RELEASE:
- mask = GDK_BUTTON_RELEASE_MASK;
- break;
-
- case GDK_KEY_PRESS:
- mask = GDK_KEY_PRESS_MASK;
- break;
-
- case GDK_KEY_RELEASE:
- mask = GDK_KEY_RELEASE_MASK;
- break;
-
- default:
- mask = 0;
- break;
- }
-
- if (!(mask & canvas->grabbed_event_mask))
- return FALSE;
- }
-
- /* Convert to world coordinates -- we have two cases because of diferent
- * offsets of the fields in the event structures.
- */
-
- ev = *event;
-
- switch (ev.type) {
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- gnome_canvas_window_to_world (canvas,
- ev.crossing.x, ev.crossing.y,
- &ev.crossing.x, &ev.crossing.y);
- break;
-
- case GDK_MOTION_NOTIFY:
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- gnome_canvas_window_to_world (canvas,
- ev.motion.x, ev.motion.y,
- &ev.motion.x, &ev.motion.y);
- break;
-
- default:
- break;
- }
-
- /* The event is propagated up the hierarchy (for if someone connected to
- * a group instead of a leaf event), and emission is stopped if a
- * handler returns TRUE, just like for GtkWidget events.
- */
-
- finished = FALSE;
-
- while (item && !finished) {
- g_object_ref (item);
-
- g_signal_emit_by_name (item, "event",
- &ev,
- &finished);
-
-#ifndef NO_WARNINGS
-#warning FIXME - needs thought
-#endif
-#if 0
- if (GTK_OBJECT_DESTROYED (item))
- finished = TRUE;
-#endif
-
- parent = item->parent;
- g_object_unref (item);
-
- item = parent;
- }
-
- return finished;
-}
-
-/* Key event handler for the canvas */
-static gint
-e_canvas_key (GtkWidget *widget, GdkEventKey *event)
-{
- GnomeCanvas *canvas;
- GdkEvent full_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- canvas = GNOME_CANVAS (widget);
-
- full_event.key = *event;
-
- return emit_event (canvas, &full_event);
-}
-
-
-/* This routine invokes the point method of the item. The argument x, y should
- * be in the parent's item-relative coordinate system. This routine applies the
- * inverse of the item's transform, maintaining the affine invariant.
- */
-#define HACKISH_AFFINE
-
-static double
-gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
-#ifdef HACKISH_AFFINE
- double i2w[6], w2c[6], i2c[6], c2i[6];
- ArtPoint c, i;
-#endif
-
-#ifdef HACKISH_AFFINE
- gnome_canvas_item_i2w_affine (item, i2w);
- gnome_canvas_w2c_affine (item->canvas, w2c);
- art_affine_multiply (i2c, i2w, w2c);
- art_affine_invert (c2i, i2c);
- c.x = cx;
- c.y = cy;
- art_affine_point (&i, &c, c2i);
- x = i.x;
- y = i.y;
-#endif
-
- return (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT_GET_CLASS (item))->point) (
- item, x, y, cx, cy, actual_item);
-}
-
-/* Re-picks the current item in the canvas, based on the event's coordinates.
- * Also emits enter/leave events for items as appropriate.
- */
-#define DISPLAY_X1(canvas) (GNOME_CANVAS (canvas)->layout.xoffset)
-#define DISPLAY_Y1(canvas) (GNOME_CANVAS (canvas)->layout.yoffset)
-static int
-pick_current_item (GnomeCanvas *canvas, GdkEvent *event)
-{
- int button_down;
- double x, y;
- int cx, cy;
- int retval;
-
- retval = FALSE;
-
- /* If a button is down, we'll perform enter and leave events on the
- * current item, but not enter on any other item. This is more or less
- * like X pointer grabbing for canvas items.
- */
- button_down = canvas->state & (GDK_BUTTON1_MASK
- | GDK_BUTTON2_MASK
- | GDK_BUTTON3_MASK
- | GDK_BUTTON4_MASK
- | GDK_BUTTON5_MASK);
- d(g_print ("%s:%d: button_down = %s\n", __FUNCTION__, __LINE__, button_down ? "TRUE" : "FALSE"));
- if (!button_down)
- canvas->left_grabbed_item = FALSE;
-
- /* Save the event in the canvas. This is used to synthesize enter and
- * leave events in case the current item changes. It is also used to
- * re-pick the current item if the current one gets deleted. Also,
- * synthesize an enter event.
- */
- if (event != &canvas->pick_event) {
- if ((event->type == GDK_MOTION_NOTIFY) || (event->type == GDK_BUTTON_RELEASE)) {
- /* these fields have the same offsets in both types of events */
-
- canvas->pick_event.crossing.type = GDK_ENTER_NOTIFY;
- canvas->pick_event.crossing.window = event->motion.window;
- canvas->pick_event.crossing.send_event = event->motion.send_event;
- canvas->pick_event.crossing.subwindow = NULL;
- canvas->pick_event.crossing.x = event->motion.x;
- canvas->pick_event.crossing.y = event->motion.y;
- canvas->pick_event.crossing.mode = GDK_CROSSING_NORMAL;
- canvas->pick_event.crossing.detail = GDK_NOTIFY_NONLINEAR;
- canvas->pick_event.crossing.focus = FALSE;
- canvas->pick_event.crossing.state = event->motion.state;
-
- /* these fields don't have the same offsets in both types of events */
-
- if (event->type == GDK_MOTION_NOTIFY) {
- canvas->pick_event.crossing.x_root = event->motion.x_root;
- canvas->pick_event.crossing.y_root = event->motion.y_root;
- } else {
- canvas->pick_event.crossing.x_root = event->button.x_root;
- canvas->pick_event.crossing.y_root = event->button.y_root;
- }
- } else
- canvas->pick_event = *event;
- }
-
- /* Don't do anything else if this is a recursive call */
-
- if (canvas->in_repick)
- return retval;
-
- /* LeaveNotify means that there is no current item, so we don't look for one */
-
- if (canvas->pick_event.type != GDK_LEAVE_NOTIFY) {
- /* these fields don't have the same offsets in both types of events */
-
- if (canvas->pick_event.type == GDK_ENTER_NOTIFY) {
- x = canvas->pick_event.crossing.x + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.crossing.y + canvas->scroll_y1 - canvas->zoom_yofs;
- } else {
- x = canvas->pick_event.motion.x + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.motion.y + canvas->scroll_y1 - canvas->zoom_yofs;
- }
-
- /* canvas pixel coords */
-
- cx = (int) (x + 0.5);
- cy = (int) (y + 0.5);
-
- /* world coords */
-
- x = canvas->scroll_x1 + x / canvas->pixels_per_unit;
- y = canvas->scroll_y1 + y / canvas->pixels_per_unit;
-
- /* find the closest item */
-
- if (canvas->root->object.flags & GNOME_CANVAS_ITEM_VISIBLE)
- gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy,
- &canvas->new_current_item);
- else
- canvas->new_current_item = NULL;
- } else
- canvas->new_current_item = NULL;
-
- if ((canvas->new_current_item == canvas->current_item) && !canvas->left_grabbed_item)
- return retval; /* current item did not change */
-
- /* Synthesize events for old and new current items */
-
- if ((canvas->new_current_item != canvas->current_item)
- && (canvas->current_item != NULL)
- && !canvas->left_grabbed_item) {
- GdkEvent new_event;
- GnomeCanvasItem *item;
-
- item = canvas->current_item;
-
- new_event = canvas->pick_event;
- new_event.type = GDK_LEAVE_NOTIFY;
-
- new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
- canvas->in_repick = TRUE;
- retval = emit_event (canvas, &new_event);
- canvas->in_repick = FALSE;
- }
-
- /* new_current_item may have been set to NULL during the call to emit_event() above */
-
- if ((canvas->new_current_item != canvas->current_item) && button_down) {
- canvas->left_grabbed_item = TRUE;
- return retval;
- }
-
- /* Handle the rest of cases */
-
- canvas->left_grabbed_item = FALSE;
- canvas->current_item = canvas->new_current_item;
-
- if (canvas->current_item != NULL) {
- GdkEvent new_event;
-
- new_event = canvas->pick_event;
- new_event.type = GDK_ENTER_NOTIFY;
- new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
- retval = emit_event (canvas, &new_event);
- }
-
- return retval;
-}
-
-/* Button event handler for the canvas */
-static gint
-e_canvas_button (GtkWidget *widget, GdkEventButton *event)
-{
- GnomeCanvas *canvas;
- int mask;
- int retval;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- retval = FALSE;
-
- canvas = GNOME_CANVAS (widget);
-
- d(g_print ("button %d, event type %d, grabbed=%p, current=%p\n",
- event->button,
- event->type,
- canvas->grabbed_item,
- canvas->current_item));
-
- /* dispatch normally regardless of the event's window if an item has
- has a pointer grab in effect */
- if (!canvas->grabbed_item && event->window != canvas->layout.bin_window)
- return retval;
-
- switch (event->button) {
- case 1:
- mask = GDK_BUTTON1_MASK;
- break;
- case 2:
- mask = GDK_BUTTON2_MASK;
- break;
- case 3:
- mask = GDK_BUTTON3_MASK;
- break;
- case 4:
- mask = GDK_BUTTON4_MASK;
- break;
- case 5:
- mask = GDK_BUTTON5_MASK;
- break;
- default:
- mask = 0;
- }
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- /* Pick the current item as if the button were not pressed, and
- * then process the event.
- */
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- canvas->state ^= mask;
- retval = emit_event (canvas, (GdkEvent *) event);
- break;
-
- case GDK_BUTTON_RELEASE:
- /* Process the event as if the button were pressed, then repick
- * after the button has been released
- */
- canvas->state = event->state;
- retval = emit_event (canvas, (GdkEvent *) event);
- event->state ^= mask;
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- event->state ^= mask;
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- return retval;
-}
-
-/* Key event handler for the canvas */
-static gint
-e_canvas_visibility (GtkWidget *widget, GdkEventVisibility *event, ECanvas *canvas)
-{
- if (! canvas->visibility_first) {
- e_canvas_hide_tooltip(canvas);
- }
- canvas->visibility_first = FALSE;
-
- return FALSE;
-}
-
-
-/**
- * e_canvas_item_grab_focus:
- * @item: A canvas item.
- * @widget_too: Whether or not to grab the widget-level focus too
- *
- * Makes the specified item take the keyboard focus, so all keyboard
- * events will be sent to it. If the canvas widget itself did not have
- * the focus and @widget_too is %TRUE, it grabs that focus as well.
- **/
-void
-e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too)
-{
- GnomeCanvasItem *focused_item;
- GdkEvent ev;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
- g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas)));
-
- focused_item = item->canvas->focused_item;
-
- if (focused_item) {
- ev.focus_change.type = GDK_FOCUS_CHANGE;
- ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window;
- ev.focus_change.send_event = FALSE;
- ev.focus_change.in = FALSE;
-
- emit_event (item->canvas, &ev);
- }
-
- item->canvas->focused_item = item;
-
- if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
- gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
- }
-
- if (item) {
- ev.focus_change.type = GDK_FOCUS_CHANGE;
- ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window;
- ev.focus_change.send_event = FALSE;
- ev.focus_change.in = TRUE;
-
- emit_event (item->canvas, &ev);
- }
-}
-
-/* Focus in handler for the canvas */
-static gint
-e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
- GdkEvent full_event;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic)
- gdk_im_begin (ecanvas->ic, canvas->layout.bin_window);
-#endif
-
- if (canvas->focused_item) {
- full_event.focus_change = *event;
- return emit_event (canvas, &full_event);
- } else {
- return FALSE;
- }
-}
-
-/* Focus out handler for the canvas */
-static gint
-e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
- GdkEvent full_event;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic)
- gdk_im_end ();
-#endif
-
- if (canvas->focused_item) {
- full_event.focus_change = *event;
- return emit_event (canvas, &full_event);
- } else {
- return FALSE;
- }
-}
-
-static void
-ec_style_set_recursive (GnomeCanvasItem *item, GtkStyle *previous_style)
-{
- guint signal_id = g_signal_lookup ("style_set", G_OBJECT_TYPE (item));
- if (signal_id >= 1) {
- GSignalQuery query;
- g_signal_query (signal_id, &query);
- if (query.return_type == GTK_TYPE_NONE && query.n_params == 1 && query.param_types[0] == GTK_TYPE_STYLE) {
- g_signal_emit (item, signal_id, 0, previous_style);
- }
- }
-
- if (GNOME_IS_CANVAS_GROUP (item) ) {
- GList *items = GNOME_CANVAS_GROUP (item)->item_list;
- for (; items; items = items->next)
- ec_style_set_recursive (items->data, previous_style);
- }
-}
-
-static void
-e_canvas_style_set (GtkWidget *widget, GtkStyle *previous_style)
-{
- ec_style_set_recursive (GNOME_CANVAS_ITEM (gnome_canvas_root (GNOME_CANVAS (widget))), previous_style);
-}
-
-
-static void
-e_canvas_realize (GtkWidget *widget)
-{
- gint width, height;
-#ifdef GAL_GDK_IM
- ECanvas *ecanvas = E_CANVAS (widget);
-#endif
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE);
-
-#ifdef GAL_GDK_IM
- if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) {
- GdkEventMask mask;
- GdkICAttr *attr = ecanvas->ic_attr;
- GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
- GdkIMStyle style;
- GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING;
-
- if(widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style &= ~GDK_IM_PREEDIT_POSITION;
-
- attr->style = style = gdk_im_decide_style (supported_style);
- attr->client_window = ecanvas->parent.layout.bin_window;
-
- switch (style & GDK_IM_PREEDIT_MASK)
- {
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
-
- gdk_window_get_size (attr->client_window, &width, &height);
- height = widget->style->font->ascent +
- widget->style->font->descent;
-
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
-
- break;
- }
-
- ecanvas->ic = gdk_ic_new (attr, attrmask);
- if (ecanvas->ic != NULL) {
- mask = gdk_window_get_events (attr->client_window);
- mask |= gdk_ic_get_events (ecanvas->ic);
- gdk_window_set_events (attr->client_window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_im_begin (ecanvas->ic, attr->client_window);
- } else
- g_warning ("Can't create input context.");
- }
-#endif
-}
-
-static void
-e_canvas_unrealize (GtkWidget *widget)
-{
- ECanvas * ecanvas = E_CANVAS (widget);
-
- if (ecanvas->idle_id) {
- g_source_remove(ecanvas->idle_id);
- ecanvas->idle_id = 0;
- }
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic) {
- gdk_ic_destroy (ecanvas->ic);
- ecanvas->ic = NULL;
- }
- if (ecanvas->ic_attr) {
- gdk_ic_attr_destroy (ecanvas->ic_attr);
- ecanvas->ic_attr = NULL;
- }
-#endif
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-e_canvas_item_invoke_reflow (GnomeCanvasItem *item, int flags)
-{
- GnomeCanvasGroup *group;
- GList *list;
- GnomeCanvasItem *child;
-
- if (GNOME_IS_CANVAS_GROUP (item)) {
- group = GNOME_CANVAS_GROUP (item);
- for (list = group->item_list; list; list = list->next) {
- child = GNOME_CANVAS_ITEM (list->data);
- if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (child, flags);
- }
- }
-
- if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) {
- ECanvasItemReflowFunc func;
- func = (ECanvasItemReflowFunc)
- g_object_get_data (G_OBJECT (item),
- "ECanvasItem::reflow_callback");
- if (func)
- func (item, flags);
- }
-
- item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW;
- item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
-}
-
-static void
-do_reflow (ECanvas *canvas)
-{
- if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0);
-}
-
-/* Idle handler for the e-canvas. It deals with pending reflows. */
-static gint
-idle_handler (gpointer data)
-{
- ECanvas *canvas;
-
- GDK_THREADS_ENTER();
-
- canvas = E_CANVAS (data);
- do_reflow (canvas);
-
- /* Reset idle id */
- canvas->idle_id = 0;
-
- g_signal_emit (canvas,
- e_canvas_signals [REFLOW], 0);
-
- GDK_THREADS_LEAVE();
-
- return FALSE;
-}
-
-/* Convenience function to add an idle handler to a canvas */
-static void
-add_idle (ECanvas *canvas)
-{
- if (canvas->idle_id != 0)
- return;
-
- canvas->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_handler, (gpointer) canvas, NULL);
-}
-
-static void
-e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- return;
-
- item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
- if (item->parent)
- e_canvas_item_descendent_needs_reflow(item->parent);
-}
-
-void
-e_canvas_item_request_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) {
- item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW;
- e_canvas_item_descendent_needs_reflow(item);
- add_idle(E_CANVAS(item->canvas));
- }
-}
-
-void
-e_canvas_item_request_parent_reflow (GnomeCanvasItem *item)
-{
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- e_canvas_item_request_reflow(item->parent);
-}
-
-void
-e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func)
-{
- g_object_set_data(G_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func);
-}
-
-
-void
-e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func)
-{
- g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func)
-{
- g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id)
-{
- GList *list;
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- canvas = E_CANVAS(item->canvas);
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(info->item),
- "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- g_message ("ECANVAS: free info (2): item %p, id %p",
- info->item, info->id);
- g_object_unref (info->item);
- g_free(info);
- }
- g_list_free(canvas->selection);
-
- canvas->selection = NULL;
-
- gnome_canvas_item_grab_focus(item);
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- g_object_ref (info->item);
- info->id = id;
- g_message ("ECANVAS: new info item %p, id %p", item, id);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item),
- "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id)
-{
-}
-
-void
-e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT;
- canvas = E_CANVAS(item->canvas);
-
- if (canvas->cursor) {
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(canvas->cursor->item),
- "ECanvasItem::selection_callback");
- if (func)
- func(canvas->cursor->item, flags, canvas->cursor->id);
- }
-
- gnome_canvas_item_grab_focus(item);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- ECanvasSelectionInfo *search;
- search = list->data;
-
- if (search->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(search->item),
- "ECanvasItem::selection_compare_callback");
-
- if (compare_func(search->item, search->id, id, 0) == 0) {
- canvas->cursor = search;
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item),
- "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, search->id);
- return;
- }
- }
- }
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- g_object_ref (info->item);
- info->id = id;
- g_message ("ECANVAS: new info (2): item %p, id %p", item, id);
-
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item),
- "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
- canvas = E_CANVAS(item->canvas);
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- if (info->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(info->item),
- "ECanvasItem::selection_compare_callback");
-
- if (compare_func(info->item, info->id, id, 0) == 0) {
- ECanvasItemSelectionFunc func;
- func = (ECanvasItemSelectionFunc) g_object_get_data(G_OBJECT(info->item),
- "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- canvas->selection = g_list_remove_link(canvas->selection, list);
-
- if (canvas->cursor == info)
- canvas->cursor = NULL;
-
- g_message ("ECANVAS: removing info: item %p, info %p",
- info->item, info->id);
- g_object_unref (info->item);
- g_free(info);
- g_list_free_1(list);
- break;
- }
- }
- }
-}
-
-void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y)
-{
- if (canvas->tooltip_window && canvas->tooltip_window != widget) {
- e_canvas_hide_tooltip(canvas);
- }
- canvas->tooltip_window = widget;
- canvas->visibility_first = TRUE;
- if (canvas->toplevel == NULL) {
- canvas->toplevel = gtk_widget_get_toplevel (GTK_WIDGET(canvas));
- if (canvas->toplevel) {
- gtk_widget_add_events(canvas->toplevel, GDK_VISIBILITY_NOTIFY_MASK);
- g_object_ref (canvas->toplevel);
- canvas->visibility_notify_id =
- g_signal_connect (canvas->toplevel, "visibility_notify_event",
- G_CALLBACK (e_canvas_visibility), canvas);
- }
- }
- gtk_widget_set_uposition (widget, x, y);
- gtk_widget_show (widget);
-}
-
-void e_canvas_hide_tooltip (ECanvas *canvas)
-{
- if (canvas->tooltip_window) {
- gtk_widget_destroy (canvas->tooltip_window);
- canvas->tooltip_window = NULL;
- }
-}
-
-
-static gboolean
-grab_cancelled_check (gpointer data)
-{
- ECanvas *canvas = data;
-
- if (GNOME_CANVAS (canvas)->grabbed_item == NULL) {
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- return FALSE;
- }
-
- if (gtk_grab_get_current ()) {
- gnome_canvas_item_ungrab(GNOME_CANVAS (canvas)->grabbed_item, canvas->grab_cancelled_time);
- if (canvas->grab_cancelled_cb) {
- canvas->grab_cancelled_cb (canvas,
- GNOME_CANVAS (canvas)->grabbed_item,
- canvas->grab_cancelled_data);
- }
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- return FALSE;
- }
- return TRUE;
-}
-
-int
-e_canvas_item_grab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint event_mask,
- GdkCursor *cursor,
- guint32 etime,
- ECanvasItemGrabCancelled cancelled_cb,
- gpointer cancelled_data)
-{
- if (gtk_grab_get_current ()) {
- return AlreadyGrabbed;
- } else {
- int ret_val = gnome_canvas_item_grab (item, event_mask, cursor, etime);
- if (ret_val == GrabSuccess) {
- canvas->grab_cancelled_cb = cancelled_cb;
- canvas->grab_cancelled_check_id =
- g_timeout_add_full (G_PRIORITY_LOW,
- 100,
- grab_cancelled_check,
- canvas,
- NULL);
- canvas->grab_cancelled_time = etime;
- canvas->grab_cancelled_data = cancelled_data;
- }
-
- return ret_val;
- }
-}
-
-void
-e_canvas_item_ungrab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint32 etime)
-{
- if (canvas->grab_cancelled_check_id) {
- g_source_remove (canvas->grab_cancelled_check_id);
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- gnome_canvas_item_ungrab (item, etime);
- }
-}
diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h
deleted file mode 100644
index 5cdcc4ab90..0000000000
--- a/widgets/misc/e-canvas.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __E_CANVAS_H__
-#define __E_CANVAS_H__
-
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ECanvas - A class derived from canvas for the purpose of adding
- * evolution specific canvas hacks.
- */
-
-#define E_CANVAS_TYPE (e_canvas_get_type ())
-#define E_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_TYPE, ECanvas))
-#define E_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass))
-#define E_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_TYPE))
-#define E_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE))
-
-typedef void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item,
- gint flags);
-
-typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item,
- gint flags,
- gpointer user_data);
-/* Returns the same as strcmp does. */
-typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item,
- gpointer data1,
- gpointer data2,
- gint flags);
-
-
-typedef struct _ECanvas ECanvas;
-typedef struct _ECanvasClass ECanvasClass;
-
-/* Object flags for items */
-enum {
- E_CANVAS_ITEM_NEEDS_REFLOW = 1 << 13,
- E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14
-};
-
-enum {
- E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */
- E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */
- E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2
-};
-
-typedef struct {
- GnomeCanvasItem *item;
- gpointer id;
-} ECanvasSelectionInfo;
-
-typedef void (*ECanvasItemGrabCancelled) (ECanvas *canvas, GnomeCanvasItem *item, gpointer data);
-
-struct _ECanvas
-{
- GnomeCanvas parent;
-
- int idle_id;
- GList *selection;
- ECanvasSelectionInfo *cursor;
-
- GtkWidget *tooltip_window;
- int visibility_notify_id;
- GtkWidget *toplevel;
- guint visibility_first : 1;
-#ifdef GAL_GDK_IM
- /* Input context for dead key support */
- GdkIC *ic;
- GdkICAttr *ic_attr;
-#endif
-
- ECanvasItemGrabCancelled grab_cancelled_cb;
- guint grab_cancelled_check_id;
- guint32 grab_cancelled_time;
- gpointer grab_cancelled_data;
-};
-
-struct _ECanvasClass
-{
- GnomeCanvasClass parent_class;
- void (* reflow) (ECanvas *canvas);
-};
-
-
-GtkType e_canvas_get_type (void);
-GtkWidget *e_canvas_new (void);
-
-/* Used to send all of the keystroke events to a specific item as well as
- * GDK_FOCUS_CHANGE events.
- */
-void e_canvas_item_grab_focus (GnomeCanvasItem *item,
- gboolean widget_too);
-void e_canvas_item_request_reflow (GnomeCanvasItem *item);
-void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item);
-void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item,
- ECanvasItemReflowFunc func);
-void e_canvas_item_set_selection_callback (GnomeCanvasItem *item,
- ECanvasItemSelectionFunc func);
-void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item,
- ECanvasItemSelectionCompareFunc func);
-void e_canvas_item_set_cursor (GnomeCanvasItem *item,
- gpointer id);
-void e_canvas_item_add_selection (GnomeCanvasItem *item,
- gpointer id);
-void e_canvas_item_remove_selection (GnomeCanvasItem *item,
- gpointer id);
-
-int e_canvas_item_grab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint event_mask,
- GdkCursor *cursor,
- guint32 etime,
- ECanvasItemGrabCancelled cancelled,
- gpointer cancelled_data);
-void e_canvas_item_ungrab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint32 etime);
-
-/* Not implemented yet. */
-void e_canvas_item_set_cursor_end (GnomeCanvasItem *item,
- gpointer id);
-void e_canvas_popup_tooltip (ECanvas *canvas,
- GtkWidget *widget,
- int x,
- int y);
-void e_canvas_hide_tooltip (ECanvas *canvas);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CANVAS_H__ */
diff --git a/widgets/misc/e-cell-date-edit.c b/widgets/misc/e-cell-date-edit.c
deleted file mode 100644
index 4e2dfe8831..0000000000
--- a/widgets/misc/e-cell-date-edit.c
+++ /dev/null
@@ -1,974 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECellDateEdit - a subclass of ECellPopup used to show a date with a popup
- * window to edit it.
- */
-
-#include <config.h>
-
-#include "e-cell-date-edit.h"
-
-#include <string.h>
-#include <time.h>
-#include <glib.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include <gal/util/e-util.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-cell-text.h>
-
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "e-util/e-time-utils.h"
-/* This depends on ECalendar which is why I didn't put it in gal. */
-#include "e-calendar.h"
-
-static void e_cell_date_edit_class_init (GtkObjectClass *object_class);
-static void e_cell_date_edit_init (ECellDateEdit *ecde);
-static void e_cell_date_edit_destroy (GtkObject *object);
-static void e_cell_date_edit_get_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id);
-static void e_cell_date_edit_set_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id);
-
-static gint e_cell_date_edit_do_popup (ECellPopup *ecp,
- GdkEvent *event,
- int row,
- int view_col);
-static void e_cell_date_edit_set_popup_values (ECellDateEdit *ecde);
-static void e_cell_date_edit_select_matching_time(ECellDateEdit *ecde,
- char *time);
-static void e_cell_date_edit_show_popup (ECellDateEdit *ecde,
- int row,
- int view_col);
-static void e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
- int row,
- int view_col,
- gint *x,
- gint *y,
- gint *height,
- gint *width);
-
-static void e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde);
-
-static int e_cell_date_edit_key_press (GtkWidget *popup_window,
- GdkEventKey *event,
- ECellDateEdit *ecde);
-static int e_cell_date_edit_button_press (GtkWidget *popup_window,
- GdkEventButton *event,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_on_ok_clicked (GtkWidget *button,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde);
-static void e_cell_date_edit_on_now_clicked (GtkWidget *button,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_on_none_clicked (GtkWidget *button,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_on_today_clicked (GtkWidget *button,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_update_cell (ECellDateEdit *ecde,
- char *text);
-static void e_cell_date_edit_on_time_selected (GtkList *list,
- ECellDateEdit *ecde);
-static void e_cell_date_edit_hide_popup (ECellDateEdit *ecde);
-
-
-/* Our arguments. */
-enum {
- ARG_0,
- ARG_SHOW_TIME,
- ARG_SHOW_NOW_BUTTON,
- ARG_SHOW_TODAY_BUTTON,
- ARG_ALLOW_NO_DATE_SET,
- ARG_USE_24_HOUR_FORMAT,
- ARG_LOWER_HOUR,
- ARG_UPPER_HOUR
-};
-
-static ECellPopupClass *parent_class;
-
-
-E_MAKE_TYPE (e_cell_date_edit, "ECellDateEdit", ECellDateEdit,
- e_cell_date_edit_class_init, e_cell_date_edit_init,
- e_cell_popup_get_type());
-
-
-static void
-e_cell_date_edit_class_init (GtkObjectClass *object_class)
-{
- ECellPopupClass *ecpc = (ECellPopupClass *) object_class;
-
- gtk_object_add_arg_type ("ECellDateEdit::show_time",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_SHOW_TIME);
- gtk_object_add_arg_type ("ECellDateEdit::show_now_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_SHOW_NOW_BUTTON);
- gtk_object_add_arg_type ("ECellDateEdit::show_today_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_SHOW_TODAY_BUTTON);
- gtk_object_add_arg_type ("ECellDateEdit::allow_no_date_set",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_ALLOW_NO_DATE_SET);
- gtk_object_add_arg_type ("ECellDateEdit::use_24_hour_format",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE,
- ARG_USE_24_HOUR_FORMAT);
- gtk_object_add_arg_type ("ECellDateEdit::lower_hour",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_LOWER_HOUR);
- gtk_object_add_arg_type ("ECellDateEdit::upper_hour",
- GTK_TYPE_INT, GTK_ARG_READWRITE,
- ARG_UPPER_HOUR);
-
- object_class->destroy = e_cell_date_edit_destroy;
- object_class->get_arg = e_cell_date_edit_get_arg;
- object_class->set_arg = e_cell_date_edit_set_arg;
-
- ecpc->popup = e_cell_date_edit_do_popup;
-
- parent_class = g_type_class_ref(e_cell_popup_get_type ());
-}
-
-
-static void
-e_cell_date_edit_init (ECellDateEdit *ecde)
-{
- GtkWidget *frame, *vbox, *hbox, *vbox2;
- GtkWidget *scrolled_window, *list, *bbox;
- GtkWidget *now_button, *today_button, *none_button, *ok_button;
-
- ecde->lower_hour = 0;
- ecde->upper_hour = 24;
- ecde->use_24_hour_format = TRUE;
- ecde->need_time_list_rebuild = TRUE;
- ecde->freeze_count = 0;
- ecde->time_callback = NULL;
- ecde->time_callback_data = NULL;
- ecde->time_callback_destroy = NULL;
-
- /* We create one popup window for the ECell, since there will only
- ever be one popup in use at a time. */
- ecde->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
-
- gtk_window_set_policy (GTK_WINDOW (ecde->popup_window),
- TRUE, TRUE, FALSE);
-
- frame = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (ecde->popup_window), frame);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
- gtk_widget_show (frame);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- ecde->calendar = e_calendar_new ();
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (ecde->calendar)->calitem),
- "move_selection_when_moving", FALSE,
- NULL);
- gtk_box_pack_start (GTK_BOX (hbox), ecde->calendar, TRUE, TRUE, 0);
- gtk_widget_show (ecde->calendar);
-
- vbox2 = gtk_vbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- gtk_widget_show (vbox2);
-
- ecde->time_entry = gtk_entry_new ();
- gtk_widget_set_size_request (ecde->time_entry, 50, -1);
- gtk_box_pack_start (GTK_BOX (vbox2), ecde->time_entry,
- FALSE, FALSE, 0);
- gtk_widget_show (ecde->time_entry);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_NEVER,
- GTK_POLICY_ALWAYS);
- gtk_widget_show (scrolled_window);
-
- list = gtk_list_new ();
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), list);
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
- gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
- gtk_widget_show (list);
- ecde->time_list = list;
- g_signal_connect((list), "selection-changed",
- G_CALLBACK (e_cell_date_edit_on_time_selected),
- ecde);
-
- bbox = gtk_hbutton_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (bbox), 4);
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 2);
- gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (bbox), 2, 0);
- gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
- gtk_widget_show (bbox);
-
- now_button = gtk_button_new_with_label (_("Now"));
- gtk_container_add (GTK_CONTAINER (bbox), now_button);
- gtk_widget_show (now_button);
- g_signal_connect((now_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_now_clicked),
- ecde);
- ecde->now_button = now_button;
-
- today_button = gtk_button_new_with_label (_("Today"));
- gtk_container_add (GTK_CONTAINER (bbox), today_button);
- gtk_widget_show (today_button);
- g_signal_connect((today_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_today_clicked),
- ecde);
- ecde->today_button = today_button;
-
- none_button = gtk_button_new_with_label (_("None"));
- gtk_container_add (GTK_CONTAINER (bbox), none_button);
- gtk_widget_show (none_button);
- g_signal_connect((none_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_none_clicked),
- ecde);
- ecde->none_button = none_button;
-
- ok_button = gtk_button_new_with_label (_("OK"));
- gtk_container_add (GTK_CONTAINER (bbox), ok_button);
- gtk_widget_show (ok_button);
- g_signal_connect((ok_button), "clicked",
- G_CALLBACK (e_cell_date_edit_on_ok_clicked),
- ecde);
-
-
- g_signal_connect((ecde->popup_window),
- "key_press_event",
- G_CALLBACK (e_cell_date_edit_key_press),
- ecde);
- g_signal_connect((ecde->popup_window),
- "button_press_event",
- G_CALLBACK (e_cell_date_edit_button_press),
- ecde);
-}
-
-
-/**
- * e_cell_date_edit_new:
- *
- * Creates a new ECellDateEdit renderer.
- *
- * Returns: an ECellDateEdit object.
- */
-ECell *
-e_cell_date_edit_new (void)
-{
- ECellDateEdit *ecde = gtk_type_new (e_cell_date_edit_get_type ());
-
- return (ECell*) ecde;
-}
-
-
-/*
- * GtkObject::destroy method
- */
-static void
-e_cell_date_edit_destroy (GtkObject *object)
-{
- ECellDateEdit *ecde = E_CELL_DATE_EDIT (object);
-
- e_cell_date_edit_set_get_time_callback (ecde, NULL, NULL, NULL);
-
- gtk_widget_destroy (ecde->popup_window);
- ecde->popup_window = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-
-static void
-e_cell_date_edit_get_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id)
-{
- ECellDateEdit *ecde;
-
- ecde = E_CELL_DATE_EDIT (o);
-
- switch (arg_id) {
- case ARG_SHOW_TIME:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_VISIBLE (ecde->time_entry) ? TRUE : FALSE;
- break;
- case ARG_SHOW_NOW_BUTTON:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_VISIBLE (ecde->now_button) ? TRUE : FALSE;
- break;
- case ARG_SHOW_TODAY_BUTTON:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_VISIBLE (ecde->today_button) ? TRUE : FALSE;
- break;
- case ARG_ALLOW_NO_DATE_SET:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_VISIBLE (ecde->none_button) ? TRUE : FALSE;
- break;
- case ARG_USE_24_HOUR_FORMAT:
- GTK_VALUE_BOOL (*arg) = ecde->use_24_hour_format;
- break;
- case ARG_LOWER_HOUR:
- GTK_VALUE_INT (*arg) = ecde->lower_hour;
- break;
- case ARG_UPPER_HOUR:
- GTK_VALUE_INT (*arg) = ecde->upper_hour;
- break;
- default:
- g_warning ("Invalid arg");
- }
-}
-
-
-static void
-e_cell_date_edit_set_arg (GtkObject *o,
- GtkArg *arg,
- guint arg_id)
-{
- ECellDateEdit *ecde;
- gint ivalue;
- gboolean bvalue;
-
- ecde = E_CELL_DATE_EDIT (o);
-
- switch (arg_id){
- case ARG_SHOW_TIME:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (bvalue) {
- gtk_widget_show (ecde->time_entry);
- gtk_widget_show (ecde->time_list);
- } else {
- gtk_widget_hide (ecde->time_entry);
- gtk_widget_hide (ecde->time_list);
- }
- break;
- case ARG_SHOW_NOW_BUTTON:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (bvalue) {
- gtk_widget_show (ecde->now_button);
- } else {
- gtk_widget_hide (ecde->now_button);
- }
- break;
- case ARG_SHOW_TODAY_BUTTON:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (bvalue) {
- gtk_widget_show (ecde->today_button);
- } else {
- gtk_widget_hide (ecde->today_button);
- }
- break;
- case ARG_ALLOW_NO_DATE_SET:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (bvalue) {
- gtk_widget_show (ecde->none_button);
- } else {
- /* FIXME: What if we have no date set now. */
- gtk_widget_hide (ecde->none_button);
- }
- break;
- case ARG_USE_24_HOUR_FORMAT:
- bvalue = GTK_VALUE_BOOL (*arg);
- if (ecde->use_24_hour_format != bvalue) {
- ecde->use_24_hour_format = bvalue;
- ecde->need_time_list_rebuild = TRUE;
- }
- break;
- case ARG_LOWER_HOUR:
- ivalue = GTK_VALUE_INT (*arg);
- ivalue = CLAMP (ivalue, 0, 24);
- if (ecde->lower_hour != ivalue) {
- ecde->lower_hour = ivalue;
- ecde->need_time_list_rebuild = TRUE;
- }
- break;
- case ARG_UPPER_HOUR:
- ivalue = GTK_VALUE_INT (*arg);
- ivalue = CLAMP (ivalue, 0, 24);
- if (ecde->upper_hour != ivalue) {
- ecde->upper_hour = ivalue;
- ecde->need_time_list_rebuild = TRUE;
- }
- break;
- default:
- g_warning ("Invalid arg");
- }
-
-#if 0
- if (ecde->need_time_list_rebuild && ecde->freeze_count == 0)
- e_cell_date_edit_rebuild_time_list (ecde);
-#endif
-}
-
-
-static gint
-e_cell_date_edit_do_popup (ECellPopup *ecp,
- GdkEvent *event,
- int row,
- int view_col)
-{
- ECellDateEdit *ecde = E_CELL_DATE_EDIT (ecp);
- guint32 time;
-
- e_cell_date_edit_show_popup (ecde, row, view_col);
- e_cell_date_edit_set_popup_values (ecde);
-
- if (event->type == GDK_BUTTON_PRESS) {
- time = event->button.time;
- } else {
- time = event->key.time;
- }
-
- gdk_keyboard_grab (ecde->popup_window->window, TRUE, time);
- gtk_grab_add (ecde->popup_window);
-
- /* Set the focus to the first widget. */
- gtk_widget_grab_focus (ecde->time_entry);
-
- return TRUE;
-}
-
-
-static void
-e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecde);
- ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ECellView *ecv = (ECellView*) ecp->popup_cell_view;
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- ETableCol *ecol;
- char *cell_text;
- ETimeParseStatus status;
- struct tm date_tm;
- GDate date;
- ECalendarItem *calitem;
- char buffer[64];
- gboolean is_date = TRUE;
-
- ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
- cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
-
- /* Try to parse just a date first. If the value is only a date, we
- use a DATE value. */
- status = e_time_parse_date (cell_text, &date_tm);
- if (status == E_TIME_PARSE_INVALID) {
- is_date = FALSE;
- status = e_time_parse_date_and_time (cell_text, &date_tm);
- }
-
- /* If there is no date and time set, or the date is invalid, we clear
- the selections, else we select the appropriate date & time. */
- calitem = E_CALENDAR_ITEM (E_CALENDAR (ecde->calendar)->calitem);
- if (status == E_TIME_PARSE_NONE || status == E_TIME_PARSE_INVALID) {
- gtk_entry_set_text (GTK_ENTRY (ecde->time_entry), "");
- e_calendar_item_set_selection (calitem, NULL, NULL);
- gtk_list_unselect_all (GTK_LIST (ecde->time_list));
- } else {
- if (is_date) {
- buffer[0] = '\0';
- } else {
- e_time_format_time (&date_tm, ecde->use_24_hour_format,
- FALSE, buffer, sizeof (buffer));
- }
- gtk_entry_set_text (GTK_ENTRY (ecde->time_entry), buffer);
-
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, date_tm.tm_mday, date_tm.tm_mon + 1,
- date_tm.tm_year + 1900);
- e_calendar_item_set_selection (calitem, &date, &date);
-
- if (is_date) {
- gtk_list_unselect_all (GTK_LIST (ecde->time_list));
- } else {
- e_cell_date_edit_select_matching_time (ecde, buffer);
- }
- }
-
- e_cell_text_free_text (ecell_text, cell_text);
-}
-
-
-static void
-e_cell_date_edit_select_matching_time (ECellDateEdit *ecde,
- char *time)
-{
- GtkList *list;
- GtkWidget *listitem, *label;
- GList *elem;
- gboolean found = FALSE;
- char *list_item_text;
-
- list = GTK_LIST (ecde->time_list);
- elem = list->children;
- while (elem) {
- listitem = GTK_WIDGET (elem->data);
- label = GTK_BIN (listitem)->child;
- gtk_label_get (GTK_LABEL (label), &list_item_text);
-
- if (!strcmp (list_item_text, time)) {
- found = TRUE;
- gtk_list_select_child (list, listitem);
- break;
- }
-
- elem = elem->next;
- }
-
- if (!found)
- gtk_list_unselect_all (list);
-}
-
-
-static void
-e_cell_date_edit_show_popup (ECellDateEdit *ecde,
- int row,
- int view_col)
-{
- gint x, y, width, height, old_width, old_height;
-
- if (ecde->need_time_list_rebuild)
- e_cell_date_edit_rebuild_time_list (ecde);
-
- /* This code is practically copied from GtkCombo. */
- old_width = ecde->popup_window->allocation.width;
- old_height = ecde->popup_window->allocation.height;
-
- e_cell_date_edit_get_popup_pos (ecde, row, view_col, &x, &y, &height, &width);
-
- gtk_widget_set_uposition (ecde->popup_window, x, y);
- gtk_widget_set_size_request (ecde->popup_window, width, height);
- gtk_widget_realize (ecde->popup_window);
- gdk_window_resize (ecde->popup_window->window, width, height);
- gtk_widget_show (ecde->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecde), TRUE);
-}
-
-
-/* Calculates the size and position of the popup window (like GtkCombo). */
-static void
-e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
- int row,
- int view_col,
- gint *x,
- gint *y,
- gint *height,
- gint *width)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecde);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
- GtkRequisition popup_requisition;
- gint avail_height, screen_width, column_width, row_height;
- double x1, y1, wx, wy;
-
- gdk_window_get_origin (canvas->window, x, y);
-
- x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
- y1 = e_table_item_row_diff (eti, 0, row + 1);
- column_width = e_table_header_col_diff (eti->header, view_col,
- view_col + 1);
- row_height = e_table_item_row_diff (eti, row,
- row + 1);
- gnome_canvas_item_i2w (GNOME_CANVAS_ITEM (eti), &x1, &y1);
-
- gnome_canvas_world_to_window (GNOME_CANVAS (canvas),
- x1,
- y1,
- &wx,
- &wy);
-
- *x += wx;
- /* The ETable positions don't include the grid lines, I think, so we
- add 1. */
- *y += wy + 1;
-
- avail_height = gdk_screen_height () - *y;
-
- /* We'll use the entire screen width if needed, but we save space for
- the vertical scrollbar in case we need to show that. */
- screen_width = gdk_screen_width ();
-
- gtk_widget_size_request (ecde->popup_window, &popup_requisition);
-
- /* Calculate the desired width. */
- *width = popup_requisition.width;
-
- /* Use at least the same width as the column. */
- if (*width < column_width)
- *width = column_width;
-
- /* Check if it fits in the available height. */
- if (popup_requisition.height > avail_height) {
- /* It doesn't fit, so we see if we have the minimum space
- needed. */
- if (*y - row_height > avail_height) {
- /* We don't, so we show the popup above the cell
- instead of below it. */
- avail_height = *y - row_height;
- *y -= (popup_requisition.height + row_height);
- if (*y < 0)
- *y = 0;
- }
- }
-
- /* We try to line it up with the right edge of the column, but we don't
- want it to go off the edges of the screen. */
- if (*x > screen_width)
- *x = screen_width;
- *x -= *width;
- if (*x < 0)
- *x = 0;
-
- *height = popup_requisition.height;
-}
-
-
-/* This handles key press events in the popup window. If the Escape key is
- pressed we hide the popup, and do not change the cell contents. */
-static int
-e_cell_date_edit_key_press (GtkWidget *popup_window,
- GdkEventKey *event,
- ECellDateEdit *ecde)
-{
- /* If the Escape key is pressed we hide the popup. */
- if (event->keyval != GDK_Escape)
- return FALSE;
-
- e_cell_date_edit_hide_popup (ecde);
-
- return TRUE;
-}
-
-
-/* This handles button press events in the popup window. If the button is
- pressed outside the popup, we hide it and do not change the cell contents.
-*/
-static int
-e_cell_date_edit_button_press (GtkWidget *popup_window,
- GdkEventButton *event,
- ECellDateEdit *ecde)
-{
- GtkWidget *event_widget;
-
- event_widget = gtk_get_event_widget ((GdkEvent*) event);
- if (gtk_widget_get_toplevel (event_widget) != popup_window) {
- e_cell_date_edit_hide_popup (ecde);
- }
-
- return TRUE;
-}
-
-
-/* Clears the time list and rebuilds it using the lower_hour, upper_hour
- and use_24_hour_format settings. */
-static void
-e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde)
-{
- GtkList *list;
- GtkWidget *listitem;
- char buffer[40];
- struct tm tmp_tm;
- gint hour, min;
-
- list = GTK_LIST (ecde->time_list);
-
- gtk_list_clear_items (list, 0, -1);
-
- /* Fill the struct tm with some sane values. */
- tmp_tm.tm_year = 2000;
- tmp_tm.tm_mon = 0;
- tmp_tm.tm_mday = 1;
- tmp_tm.tm_sec = 0;
- tmp_tm.tm_isdst = 0;
-
- for (hour = ecde->lower_hour; hour <= ecde->upper_hour; hour++) {
-
- /* We don't want to display midnight at the end, since that is
- really in the next day. */
- if (hour == 24)
- break;
-
- /* We want to finish on upper_hour, with min == 0. */
- for (min = 0;
- min == 0 || (min < 60 && hour != ecde->upper_hour);
- min += 30) {
- tmp_tm.tm_hour = hour;
- tmp_tm.tm_min = min;
- e_time_format_time (&tmp_tm, ecde->use_24_hour_format,
- FALSE, buffer, sizeof (buffer));
- listitem = gtk_list_item_new_with_label (buffer);
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (list), listitem);
- }
- }
-
- ecde->need_time_list_rebuild = FALSE;
-}
-
-
-static void
-e_cell_date_edit_on_ok_clicked (GtkWidget *button,
- ECellDateEdit *ecde)
-{
- ECalendarItem *calitem;
- GDate start_date, end_date;
- gboolean day_selected;
- struct tm date_tm;
- char buffer[64];
- const char *text;
- ETimeParseStatus status;
- gboolean is_date = FALSE;
-
- calitem = E_CALENDAR_ITEM (E_CALENDAR (ecde->calendar)->calitem);
- day_selected = e_calendar_item_get_selection (calitem, &start_date,
- &end_date);
-
- text = gtk_entry_get_text (GTK_ENTRY (ecde->time_entry));
- status = e_time_parse_time (text, &date_tm);
- if (status == E_TIME_PARSE_INVALID) {
- e_cell_date_edit_show_time_invalid_warning (ecde);
- return;
- } else if (status == E_TIME_PARSE_NONE) {
- is_date = TRUE;
- }
-
- if (day_selected) {
- date_tm.tm_year = g_date_year (&start_date) - 1900;
- date_tm.tm_mon = g_date_month (&start_date) - 1;
- date_tm.tm_mday = g_date_day (&start_date);
- /* We need to call this to set the weekday. */
- mktime (&date_tm);
- e_time_format_date_and_time (&date_tm,
- ecde->use_24_hour_format,
- !is_date, FALSE,
- buffer, sizeof (buffer));
- } else {
- buffer[0] = '\0';
- }
-
- e_cell_date_edit_update_cell (ecde, buffer);
- e_cell_date_edit_hide_popup (ecde);
-}
-
-
-static void
-e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde)
-{
- GtkWidget *dialog;
- struct tm date_tm;
- char buffer[64], *message;
-
- /* Create a useful error message showing the correct format. */
- date_tm.tm_year = 100;
- date_tm.tm_mon = 0;
- date_tm.tm_mday = 1;
- date_tm.tm_hour = 1;
- date_tm.tm_min = 30;
- date_tm.tm_sec = 0;
- date_tm.tm_isdst = -1;
- e_time_format_time (&date_tm, ecde->use_24_hour_format, FALSE,
- buffer, sizeof (buffer));
-
- message = g_strdup_printf (_("The time must be in the format: %s"),
- buffer);
-
- dialog = gnome_message_box_new (message, GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK, NULL);
- /* FIXME: Fix transient settings - I'm not sure it works with popup
- windows. Maybe we need to use a normal window without decorations.*/
- gtk_window_set_transient_for (GTK_WINDOW (dialog),
- GTK_WINDOW (ecde->popup_window));
- gnome_dialog_run (GNOME_DIALOG (dialog));
-
- g_free (message);
-}
-
-
-static void
-e_cell_date_edit_on_now_clicked (GtkWidget *button,
- ECellDateEdit *ecde)
-{
- struct tm tmp_tm;
- time_t t;
- char buffer[64];
-
- if (ecde->time_callback) {
- tmp_tm = (*ecde->time_callback) (ecde, ecde->time_callback_data);
- } else {
- t = time (NULL);
- tmp_tm = *localtime (&t);
- }
- e_time_format_date_and_time (&tmp_tm,
- ecde->use_24_hour_format,
- TRUE, FALSE,
- buffer, sizeof (buffer));
-
- e_cell_date_edit_update_cell (ecde, buffer);
- e_cell_date_edit_hide_popup (ecde);
-}
-
-
-static void
-e_cell_date_edit_on_none_clicked (GtkWidget *button,
- ECellDateEdit *ecde)
-{
- e_cell_date_edit_update_cell (ecde, "");
- e_cell_date_edit_hide_popup (ecde);
-}
-
-
-static void
-e_cell_date_edit_on_today_clicked (GtkWidget *button,
- ECellDateEdit *ecde)
-{
- struct tm tmp_tm;
- time_t t;
- char buffer[64];
-
- if (ecde->time_callback) {
- tmp_tm = (*ecde->time_callback) (ecde, ecde->time_callback_data);
- } else {
- t = time (NULL);
- tmp_tm = *localtime (&t);
- }
-
- tmp_tm.tm_hour = 0;
- tmp_tm.tm_min = 0;
- tmp_tm.tm_sec = 0;
- e_time_format_date_and_time (&tmp_tm,
- ecde->use_24_hour_format,
- FALSE, FALSE,
- buffer, sizeof (buffer));
-
- e_cell_date_edit_update_cell (ecde, buffer);
- e_cell_date_edit_hide_popup (ecde);
-}
-
-
-static void
-e_cell_date_edit_update_cell (ECellDateEdit *ecde,
- char *text)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecde);
- ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ECellView *ecv = (ECellView*) ecp->popup_cell_view;
- ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view);
- ETableCol *ecol;
- gchar *old_text;
-
- /* Compare the new text with the existing cell contents. */
- ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
-
- old_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
-
- /* If they are different, update the cell contents. */
- if (strcmp (old_text, text)) {
- e_cell_text_set_value (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row, text);
- }
-
- e_cell_text_free_text (ecell_text, old_text);
-}
-
-
-static void
-e_cell_date_edit_on_time_selected (GtkList *list,
- ECellDateEdit *ecde)
-{
- GtkWidget *listitem, *label;
- char *list_item_text;
-
- if (!list->selection)
- return;
-
- listitem = list->selection->data;
- label = GTK_BIN (listitem)->child;
- gtk_label_get (GTK_LABEL (label), &list_item_text);
- gtk_entry_set_text (GTK_ENTRY (ecde->time_entry), list_item_text);
-}
-
-
-static void
-e_cell_date_edit_hide_popup (ECellDateEdit *ecde)
-{
- gtk_grab_remove (ecde->popup_window);
- gtk_widget_hide (ecde->popup_window);
- e_cell_popup_set_shown (E_CELL_POPUP (ecde), FALSE);
-}
-
-
-/* These freeze and thaw the rebuilding of the time list. They are useful when
- setting several properties which result in rebuilds of the list, e.g. the
- lower_hour, upper_hour and use_24_hour_format properties. */
-void
-e_cell_date_edit_freeze (ECellDateEdit *ecde)
-{
- g_return_if_fail (E_IS_CELL_DATE_EDIT (ecde));
-
- ecde->freeze_count++;
-}
-
-
-void
-e_cell_date_edit_thaw (ECellDateEdit *ecde)
-{
- g_return_if_fail (E_IS_CELL_DATE_EDIT (ecde));
-
- if (ecde->freeze_count > 0) {
- ecde->freeze_count--;
-
- if (ecde->freeze_count == 0)
- e_cell_date_edit_rebuild_time_list (ecde);
- }
-}
-
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void
-e_cell_date_edit_set_get_time_callback (ECellDateEdit *ecde,
- ECellDateEditGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- g_return_if_fail (E_IS_CELL_DATE_EDIT (ecde));
-
- if (ecde->time_callback_data && ecde->time_callback_destroy)
- (*ecde->time_callback_destroy) (ecde->time_callback_data);
-
- ecde->time_callback = cb;
- ecde->time_callback_data = data;
- ecde->time_callback_destroy = destroy;
-}
diff --git a/widgets/misc/e-cell-date-edit.h b/widgets/misc/e-cell-date-edit.h
deleted file mode 100644
index 6f1dacbb58..0000000000
--- a/widgets/misc/e-cell-date-edit.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECellDateEdit - a subclass of ECellPopup used to show a date with a popup
- * window to edit it.
- */
-
-#ifndef _E_CELL_DATE_EDIT_H_
-#define _E_CELL_DATE_EDIT_H_
-
-#include <time.h>
-#include <gal/e-table/e-cell-popup.h>
-
-#define E_CELL_DATE_EDIT_TYPE (e_cell_date_edit_get_type ())
-#define E_CELL_DATE_EDIT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_DATE_EDIT_TYPE, ECellDateEdit))
-#define E_CELL_DATE_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_CELL_DATE_EDIT_TYPE, ECellDateEditClass))
-#define E_IS_CELL_DATE_EDIT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_DATE_EDIT_TYPE))
-#define E_IS_CELL_DATE_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_DATE_EDIT_TYPE))
-
-
-typedef struct _ECellDateEdit ECellDateEdit;
-typedef struct _ECellDateEditClass ECellDateEditClass;
-
-/* The type of the callback function optionally used to get the current time.
- */
-typedef struct tm (*ECellDateEditGetTimeCallback) (ECellDateEdit *ecde,
- gpointer data);
-
-struct _ECellDateEdit {
- ECellPopup parent;
-
- GtkWidget *popup_window;
- GtkWidget *calendar;
- GtkWidget *time_entry;
- GtkWidget *time_list;
-
- GtkWidget *now_button;
- GtkWidget *today_button;
- GtkWidget *none_button;
-
- /* This is the range of hours we show in the time list. */
- gint lower_hour;
- gint upper_hour;
-
- /* TRUE if we use 24-hour format for the time list and entry. */
- gboolean use_24_hour_format;
-
- /* This is TRUE if we need to rebuild the list of times. */
- gboolean need_time_list_rebuild;
-
- /* The freeze count for rebuilding the time list. We only rebuild when
- this is 0. */
- gint freeze_count;
-
- ECellDateEditGetTimeCallback time_callback;
- gpointer time_callback_data;
- GtkDestroyNotify time_callback_destroy;
-};
-
-struct _ECellDateEditClass {
- ECellPopupClass parent_class;
-};
-
-
-GtkType e_cell_date_edit_get_type (void);
-ECell *e_cell_date_edit_new (void);
-
-
-/* These freeze and thaw the rebuilding of the time list. They are useful when
- setting several properties which result in rebuilds of the list, e.g. the
- lower_hour, upper_hour and use_24_hour_format properties. */
-void e_cell_date_edit_freeze (ECellDateEdit *ecde);
-void e_cell_date_edit_thaw (ECellDateEdit *ecde);
-
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void e_cell_date_edit_set_get_time_callback(ECellDateEdit *ecde,
- ECellDateEditGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy);
-
-
-#endif /* _E_CELL_DATE_EDIT_H_ */
diff --git a/widgets/misc/e-cell-percent.c b/widgets/misc/e-cell-percent.c
deleted file mode 100644
index e2e6ae6b6b..0000000000
--- a/widgets/misc/e-cell-percent.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECellPercent - a subclass of ECellText used to show an integer percentage
- * in an ETable.
- */
-
-#include <config.h>
-
-#include <ctype.h>
-
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <gal/util/e-util.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "e-cell-percent.h"
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-
-static char *
-ecp_get_text (ECellText *cell, ETableModel *model, int col, int row)
-{
- int percent;
- static char buffer[8];
-
- percent = GPOINTER_TO_INT (e_table_model_value_at (model, col, row));
-
- /* A -ve value means the property is not set. */
- if (percent < 0) {
- buffer[0] = '\0';
- } else {
- g_snprintf (buffer, sizeof (buffer), "%i%%", percent);
- }
-
- return buffer;
-}
-
-static void
-ecp_free_text(ECellText *cell, char *text)
-{
- /* Do Nothing. */
-}
-
-/* FIXME: We need to set the "transient_for" property for the dialog. */
-static void
-show_percent_warning (void)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (_("The percent value must be between 0 and 100, inclusive"),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK, NULL);
- gtk_widget_show (dialog);
-}
-
-static void
-ecp_set_value (ECellText *cell, ETableModel *model, int col, int row,
- const char *text)
-{
- int matched, percent;
- gboolean empty = TRUE;
- const char *p;
-
- if (text) {
- p = text;
- while (*p) {
- if (!isspace ((unsigned char) *p)) {
- empty = FALSE;
- break;
- }
- p++;
- }
- }
-
- if (empty) {
- percent = -1;
- } else {
- matched = sscanf (text, "%i", &percent);
-
- if (matched != 1 || percent < 0 || percent > 100) {
- show_percent_warning ();
- return;
- }
- }
-
- e_table_model_set_value_at (model, col, row,
- GINT_TO_POINTER (percent));
-}
-
-static void
-e_cell_percent_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-
- ectc->get_text = ecp_get_text;
- ectc->free_text = ecp_free_text;
- ectc->set_value = ecp_set_value;
-}
-
-static void
-e_cell_percent_init (GtkObject *object)
-{
-}
-
-/**
- * e_cell_percent_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render an integer
- * percentage that comes from the model. The value returned from the model is
- * interpreted as being an int.
- *
- * See ECellText for other features.
- *
- * Returns: an ECell object that can be used to render numbers.
- */
-ECell *
-e_cell_percent_new (const char *fontname, GtkJustification justify)
-{
- ECellPercent *ecn = gtk_type_new (e_cell_percent_get_type ());
-
- e_cell_text_construct (E_CELL_TEXT(ecn), fontname, justify);
-
- return (ECell *) ecn;
-}
-
-E_MAKE_TYPE (e_cell_percent, "ECellPercent", ECellPercent,
- e_cell_percent_class_init, e_cell_percent_init, PARENT_TYPE);
diff --git a/widgets/misc/e-cell-percent.h b/widgets/misc/e-cell-percent.h
deleted file mode 100644
index 74f56ae225..0000000000
--- a/widgets/misc/e-cell-percent.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ECellPercent - a subclass of ECellText used to show an integer percentage
- * in an ETable.
- */
-
-#ifndef _E_CELL_PERCENT_H_
-#define _E_CELL_PERCENT_H_
-
-#include <gal/e-table/e-cell-text.h>
-
-#define E_CELL_PERCENT_TYPE (e_cell_percent_get_type ())
-#define E_CELL_PERCENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_PERCENT_TYPE, ECellPercent))
-#define E_CELL_PERCENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_CELL_PERCENT_TYPE, ECellPercentClass))
-#define E_IS_CELL_NUMBER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_PERCENT_TYPE))
-#define E_IS_CELL_NUMBER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_PERCENT_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellPercent;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellPercentClass;
-
-GtkType e_cell_percent_get_type (void);
-ECell *e_cell_percent_new (const char *fontname, GtkJustification justify);
-
-#endif /* _E_CELL_PERCENT_H_ */
diff --git a/widgets/misc/e-charset-picker.c b/widgets/misc/e-charset-picker.c
deleted file mode 100644
index 0199da5bfc..0000000000
--- a/widgets/misc/e-charset-picker.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-charset-picker.h"
-#include <gal/widgets/e-gui-utils.h>
-
-#include <iconv.h>
-
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtksignal.h>
-
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnome/gnome-i18n.h>
-
-#include <bonobo/bonobo-ui-node.h>
-#include <bonobo/bonobo-ui-util.h>
-
-typedef enum {
- E_CHARSET_UNKNOWN,
- E_CHARSET_BALTIC,
- E_CHARSET_CENTRAL_EUROPEAN,
- E_CHARSET_CHINESE,
- E_CHARSET_CYRILLIC,
- E_CHARSET_GREEK,
- E_CHARSET_HEBREW,
- E_CHARSET_JAPANESE,
- E_CHARSET_KOREAN,
- E_CHARSET_TURKISH,
- E_CHARSET_UNICODE,
- E_CHARSET_WESTERN_EUROPEAN
-} ECharsetClass;
-
-static const char *classnames[] = {
- N_("Unknown"),
- N_("Baltic"),
- N_("Central European"),
- N_("Chinese"),
- N_("Cyrillic"),
- N_("Greek"),
- N_("Hebrew"),
- N_("Japanese"),
- N_("Korean"),
- N_("Turkish"),
- N_("Unicode"),
- N_("Western European"),
-};
-
-typedef struct {
- char *name;
- ECharsetClass class;
- char *subclass;
-} ECharset;
-
-/* This list is based on what other mailers/browsers support. There's
- * not a lot of point in using, say, ISO-8859-3, if anything that can
- * read that can read UTF8 too.
- */
-static ECharset charsets[] = {
- { "ISO-8859-13", E_CHARSET_BALTIC, NULL },
- { "ISO-8859-4", E_CHARSET_BALTIC, NULL },
- { "ISO-8859-2", E_CHARSET_CENTRAL_EUROPEAN, NULL },
- { "Big5", E_CHARSET_CHINESE, N_("Traditional") },
- { "GB-2312", E_CHARSET_CHINESE, N_("Simplified") },
- { "HZ", E_CHARSET_CHINESE, N_("Simplified") },
- { "ISO-2022-CN", E_CHARSET_CHINESE, NULL },
- { "KOI8-R", E_CHARSET_CYRILLIC, NULL },
- { "Windows-1251", E_CHARSET_CYRILLIC, NULL },
- { "KOI8-U", E_CHARSET_CYRILLIC, N_("Ukrainian") },
- { "ISO-8859-5", E_CHARSET_CYRILLIC, NULL },
- { "ISO-8859-7", E_CHARSET_GREEK, NULL },
- { "ISO-8859-8", E_CHARSET_HEBREW, N_("Visual") },
- { "ISO-2022-JP", E_CHARSET_JAPANESE, NULL },
- { "EUC-JP", E_CHARSET_JAPANESE, NULL },
- { "Shift_JIS", E_CHARSET_JAPANESE, NULL },
- { "EUC-KR", E_CHARSET_KOREAN, NULL },
- { "ISO-8859-9", E_CHARSET_TURKISH, NULL },
- { "UTF-8", E_CHARSET_UNICODE, NULL },
- { "UTF-7", E_CHARSET_UNICODE, NULL },
- { "ISO-8859-1", E_CHARSET_WESTERN_EUROPEAN, NULL },
- { "ISO-8859-15", E_CHARSET_WESTERN_EUROPEAN, N_("New") },
-};
-static const int num_charsets = sizeof (charsets) / sizeof (charsets[0]);
-
-static void
-select_item (GtkMenuShell *menu_shell, GtkWidget *item)
-{
- gtk_menu_shell_select_item (menu_shell, item);
- gtk_menu_shell_deactivate (menu_shell);
-}
-
-static void
-activate (GtkWidget *item, gpointer menu)
-{
- g_object_set_data(G_OBJECT(menu), "activated_item", item);
-}
-
-static GtkWidget *
-add_charset (GtkWidget *menu, ECharset *charset, gboolean free_name)
-{
- GtkWidget *item;
- char *label;
-
- if (charset->subclass) {
- label = g_strdup_printf ("%s, %s (%s)",
- _(classnames[charset->class]),
- _(charset->subclass),
- charset->name);
- } else if (charset->class) {
- label = g_strdup_printf ("%s (%s)",
- _(classnames[charset->class]),
- charset->name);
- } else {
- label = g_strdup (charset->name);
- }
-
- item = gtk_menu_item_new_with_label (label);
- g_object_set_data_full(G_OBJECT(item), "charset",
- charset->name, free_name ? g_free : NULL);
- g_free (label);
-
- gtk_widget_show (item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
- g_signal_connect((item), "activate",
- G_CALLBACK (activate), menu);
-
- return item;
-}
-
-static gboolean
-add_other_charset (GtkWidget *menu, GtkWidget *other, char *new_charset)
-{
- ECharset charset = { NULL, E_CHARSET_UNKNOWN, NULL };
- GtkWidget *item;
- iconv_t ic;
-
- ic = iconv_open ("UTF-8", new_charset);
- if (ic == (iconv_t)-1) {
- GtkWidget *window = gtk_widget_get_ancestor (other, GTK_TYPE_WINDOW);
- e_notice (GTK_WINDOW (window), GTK_MESSAGE_ERROR,
- _("Unknown character set: %s"), new_charset);
- return FALSE;
- }
- iconv_close (ic);
-
- /* Temporarily remove the "Other..." item */
- g_object_ref((other));
- gtk_container_remove (GTK_CONTAINER (menu), other);
-
- /* Create new menu item */
- charset.name = new_charset;
- item = add_charset (menu, &charset, TRUE);
-
- /* And re-add "Other..." */
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), other);
- g_object_unref((other));
-
- g_object_set_data_full(G_OBJECT(menu), "other_charset",
- g_strdup (new_charset), g_free);
-
- g_object_set_data(G_OBJECT(menu), "activated_item", item);
- select_item (GTK_MENU_SHELL (menu), item);
- return TRUE;
-}
-
-static void
-other_charset_callback (char *new_charset, gpointer data)
-{
- char **out = data;
-
- *out = new_charset;
-}
-
-static void
-activate_other (GtkWidget *item, gpointer menu)
-{
- GtkWidget *window, *dialog;
- char *old_charset, *new_charset;
-
- window = gtk_widget_get_ancestor (item, GTK_TYPE_WINDOW);
- old_charset = g_object_get_data(G_OBJECT(menu), "other_charset");
- dialog = gnome_request_dialog (FALSE,
- _("Enter the character set to use"),
- old_charset, 0, other_charset_callback,
- &new_charset, GTK_WINDOW (window));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- if (new_charset) {
- if (add_other_charset (menu, item, new_charset))
- return;
- g_free (new_charset);
- }
-
- /* Revert to previous selection */
- select_item (GTK_MENU_SHELL (menu), g_object_get_data(G_OBJECT(menu), "activated_item"));
-}
-
-/**
- * e_charset_picker_new:
- * @default_charset: the default character set, or %NULL to use the
- * locale character set.
- *
- * This creates an option menu widget and fills it in with a selection
- * of available character sets. The @default_charset (or locale character
- * set if @default_charset is %NULL) will be listed first, and selected
- * by default (except that iso-8859-1 will always be used instead of
- * US-ASCII). Any other character sets of the same language class as
- * the default will be listed next, followed by the remaining character
- * sets, a separator, and an "Other..." menu item, which can be used to
- * select other charsets.
- *
- * Return value: an option menu widget, filled in and with signals
- * attached.
- */
-GtkWidget *
-e_charset_picker_new (const char *default_charset)
-{
- GtkWidget *menu, *item;
- int def, i;
- const char *locale_charset;
-
- g_get_charset (&locale_charset);
- if (!g_strcasecmp (locale_charset, "US-ASCII"))
- locale_charset = "iso-8859-1";
-
- if (!default_charset)
- default_charset = locale_charset;
- for (def = 0; def < num_charsets; def++) {
- if (!g_strcasecmp (charsets[def].name, default_charset))
- break;
- }
-
- menu = gtk_menu_new ();
- for (i = 0; i < num_charsets; i++) {
- item = add_charset (menu, &charsets[i], FALSE);
- if (i == def) {
- activate (item, menu);
- select_item (GTK_MENU_SHELL (menu), item);
- }
- }
-
- /* do the Unknown/Other section */
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtk_menu_item_new ());
-
- if (def == num_charsets) {
- ECharset other = { NULL, E_CHARSET_UNKNOWN, NULL };
-
- /* Add an entry for @default_charset */
- other.name = g_strdup (default_charset);
- item = add_charset (menu, &other, TRUE);
- activate (item, menu);
- select_item (GTK_MENU_SHELL (menu), item);
- g_object_set_data_full(G_OBJECT(menu), "other_charset",
- g_strdup (default_charset), g_free);
- def++;
- }
-
- item = gtk_menu_item_new_with_label (_("Other..."));
- g_signal_connect((item), "activate",
- G_CALLBACK (activate_other), menu);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-
- gtk_widget_show_all (menu);
- return menu;
-}
-
-/**
- * e_charset_picker_get_charset:
- * @menu: a character set menu from e_charset_picker_new()
- *
- * Return value: the currently-selected character set in @picker,
- * which must be freed with g_free().
- **/
-char *
-e_charset_picker_get_charset (GtkWidget *menu)
-{
- GtkWidget *item;
- char *charset;
-
- g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
- item = gtk_menu_get_active (GTK_MENU (menu));
- charset = g_object_get_data(G_OBJECT(item), "charset");
-
- return g_strdup (charset);
-}
-
-/**
- * e_charset_picker_dialog:
- * @title: title for the dialog box
- * @prompt: prompt string for the dialog box
- * @default_charset: as for e_charset_picker_new()
- * @parent: a parent window for the dialog box, or %NULL
- *
- * This creates a new dialog box with the given @title and @prompt and
- * a character set picker menu. It then runs the dialog and returns
- * the selected character set, or %NULL if the user clicked "Cancel".
- *
- * Return value: the selected character set (which must be freed with
- * g_free()), or %NULL.
- **/
-char *
-e_charset_picker_dialog (const char *title, const char *prompt,
- const char *default_charset, GtkWindow *parent)
-{
- GnomeDialog *dialog;
- GtkWidget *label, *omenu, *picker;
- int button;
- char *charset;
-
- dialog = GNOME_DIALOG (gnome_dialog_new (title, GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL));
- if (parent)
- gnome_dialog_set_parent (dialog, parent);
-
- label = gtk_label_new (prompt);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- picker = e_charset_picker_new (default_charset);
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), picker);
-
- gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 4);
- gtk_box_pack_start (GTK_BOX (dialog->vbox), label, FALSE, FALSE, 4);
- gtk_box_pack_start (GTK_BOX (dialog->vbox), omenu, FALSE, FALSE, 4);
-
- gtk_widget_show_all (GTK_WIDGET (dialog));
- button = gnome_dialog_run (dialog);
-
- if (button == 0)
- charset = e_charset_picker_get_charset (picker);
- else
- charset = NULL;
- gnome_dialog_close (dialog);
-
- return charset;
-}
-
-/**
- * e_charset_picker_bonobo_ui_populate:
- * @uic: Bonobo UI Component
- * @path: menu path
- * @default_charset: the default character set, or %NULL to use the
- * locale character set.
- * @cb: Callback function
- * @user_data: data to be passed to the callback.
- *
- * This creates a Bonobo UI menu and fills it in with a selection
- * of available character sets. The @default_charset (or locale character
- * set if @default_charset is %NULL) will be listed first, and selected
- * by default (except that iso-8859-1 will always be used instead of
- * US-ASCII). Any other character sets of the same language class as
- * the default will be listed next, followed by the remaining character
- * sets.
- **/
-void
-e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb, gpointer user_data)
-{
- char *encoded_label, *label;
- const char *locale_charset;
- GString *menuitems;
- int def, i;
-
- g_get_charset (&locale_charset);
- if (!g_strcasecmp (locale_charset, "US-ASCII"))
- locale_charset = "iso-8859-1";
-
- if (!default_charset)
- default_charset = locale_charset;
- for (def = 0; def < num_charsets; def++) {
- if (!g_strcasecmp (charsets[def].name, default_charset))
- break;
- }
-
- label = g_strdup (_("Character Encoding"));
- encoded_label = bonobo_ui_util_encode_str (label);
- menuitems = g_string_new ("");
- g_string_sprintf (menuitems, "<submenu name=\"ECharsetPicker\" label=\"%s\">\n", encoded_label);
- g_free (encoded_label);
- g_free (label);
-
- for (i = 0; i < num_charsets; i++) {
- char *command, *label, *encoded_label;
-
- if (charsets[i].subclass) {
- label = g_strdup_printf ("%s, %s (%s)",
- _(classnames[charsets[i].class]),
- _(charsets[i].subclass),
- charsets[i].name);
- } else {
- label = g_strdup_printf ("%s (%s)",
- _(classnames[charsets[i].class]),
- charsets[i].name);
- }
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"%d\"/>\n",
- charsets[i].name, encoded_label, i == def);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_sprintfa (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- charsets[i].name);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", charsets[i].name);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- if (def == num_charsets) {
- char *command, *label, *encoded_label;
-
- label = g_strdup_printf ("%s (%s)", _("Unknown"), default_charset);
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"1\"/>\n",
- default_charset, encoded_label);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_append (menuitems, " <separator/>\n");
- g_string_sprintfa (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- default_charset);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", default_charset);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- g_string_append (menuitems, "</submenu>\n");
-
- bonobo_ui_component_set (uic, path, menuitems->str, NULL);
- g_string_free (menuitems, TRUE);
-}
diff --git a/widgets/misc/e-charset-picker.h b/widgets/misc/e-charset-picker.h
deleted file mode 100644
index 97c945c32e..0000000000
--- a/widgets/misc/e-charset-picker.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _E_CHARSETPICKER_H_
-#define _E_CHARSETPICKER_H_
-
-#include <gtk/gtkwindow.h>
-#include <bonobo/bonobo-ui-component.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-GtkWidget *e_charset_picker_new (const char *default_charset);
-char *e_charset_picker_get_charset (GtkWidget *picker);
-
-char *e_charset_picker_dialog (const char *title, const char *prompt,
- const char *default_charset,
- GtkWindow *parent);
-
-/* bonobo equivalents */
-void e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb, gpointer user_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CHARSETPICKER_H_ */
diff --git a/widgets/misc/e-clipped-label.c b/widgets/misc/e-clipped-label.c
deleted file mode 100644
index e650b4ee96..0000000000
--- a/widgets/misc/e-clipped-label.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 1999, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This is similar to GtkLabel but clips itself and displays '...' if it
- * can't fit inside its allocated area. The intended use is for inside buttons
- * that are a fixed size. The GtkLabel would normally display only the middle
- * part of the text, which doesn't look very good. This only supports one line
- * of text (so no wrapping/justification), without underlined characters.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-clipped-label.h"
-
-#include <math.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gdk/gdki18n.h>
-#include <libgnome/gnome-i18n.h>
-
-
-static void e_clipped_label_class_init (EClippedLabelClass *class);
-static void e_clipped_label_init (EClippedLabel *label);
-static void e_clipped_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void e_clipped_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint e_clipped_label_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void e_clipped_label_recalc_chars_displayed (EClippedLabel *label);
-static void e_clipped_label_finalize (GObject *object);
-
-static void build_layout (EClippedLabel *label, const char *text);
-
-static GtkMiscClass *parent_class;
-
-/* This is the string to draw when the label is clipped, e.g. '...'. */
-static gchar *e_clipped_label_ellipsis;
-
-/* Flags used in chars_displayed field. Must be negative. */
-#define E_CLIPPED_LABEL_NEED_RECALC -1
-#define E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL -2
-
-
-GtkType
-e_clipped_label_get_type (void)
-{
- static GtkType e_clipped_label_type = 0;
-
- if (!e_clipped_label_type){
- GtkTypeInfo e_clipped_label_info = {
- "EClippedLabel",
- sizeof (EClippedLabel),
- sizeof (EClippedLabelClass),
- (GtkClassInitFunc) e_clipped_label_class_init,
- (GtkObjectInitFunc) e_clipped_label_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = g_type_class_ref(GTK_TYPE_MISC);
- e_clipped_label_type = gtk_type_unique (GTK_TYPE_MISC,
- &e_clipped_label_info);
- }
-
- return e_clipped_label_type;
-}
-
-
-static void
-e_clipped_label_class_init (EClippedLabelClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- /* Method override */
- widget_class->size_request = e_clipped_label_size_request;
- widget_class->size_allocate = e_clipped_label_size_allocate;
- widget_class->expose_event = e_clipped_label_expose;
-
- object_class->finalize = e_clipped_label_finalize;
-
- e_clipped_label_ellipsis = _("...");
-}
-
-
-static void
-e_clipped_label_init (EClippedLabel *label)
-{
- GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW);
-
- label->label = NULL;
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-}
-
-
-/**
- * e_clipped_label_new:
- *
- * @text: The label text.
- * @Returns: A new #EClippedLabel.
- *
- * Creates a new #EClippedLabel with the given text.
- **/
-GtkWidget *
-e_clipped_label_new (const gchar *text)
-{
- GtkWidget *label;
- EClippedLabel *clipped;
-
- label = GTK_WIDGET (gtk_type_new (e_clipped_label_get_type ()));
-
- clipped = E_CLIPPED_LABEL (label);
-
- build_layout (clipped, e_clipped_label_ellipsis);
- pango_layout_get_pixel_size (clipped->layout, &clipped->ellipsis_width, NULL);
-
- if (text && *text)
- e_clipped_label_set_text (clipped, text);
-
- return label;
-}
-
-static void
-build_layout (EClippedLabel *label, const char *text)
-{
- if (!label->layout) {
- label->layout = gtk_widget_create_pango_layout (GTK_WIDGET (label), text);
-#ifdef FROB_FONT_DESC
- {
- /* this makes the font used a little bigger than the
- default style for this widget, as well as makes it
- bold... */
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (label));
- PangoFontDescription *desc = pango_font_description_copy (style->font_desc);
- pango_font_description_set_size (desc,
- pango_font_description_get_size (desc) * 1.2);
-
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
- }
-#endif
- }
- else {
- pango_layout_set_text (label->layout, text, -1);
- }
-}
-
-static void
-e_clipped_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EClippedLabel *label;
- GdkFont *font;
- int height;
- int width;
-
- g_return_if_fail (E_IS_CLIPPED_LABEL (widget));
- g_return_if_fail (requisition != NULL);
-
- label = E_CLIPPED_LABEL (widget);
-
- pango_layout_get_pixel_size (label->layout, &width, &height);
-
- requisition->width = 0;
- requisition->height = height + 2 * GTK_MISC (widget)->ypad;
-}
-
-
-static void
-e_clipped_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EClippedLabel *label;
-
- label = E_CLIPPED_LABEL (widget);
-
- widget->allocation = *allocation;
-
- /* Flag that we need to recalculate how many characters to display. */
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-}
-
-
-static gint
-e_clipped_label_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EClippedLabel *label;
- GtkMisc *misc;
- gint x, y;
- gchar *tmp_str, tmp_ch;
- PangoRectangle rect;
-
- g_return_val_if_fail (E_IS_CLIPPED_LABEL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- label = E_CLIPPED_LABEL (widget);
- misc = GTK_MISC (widget);
-
- /* If the label isn't visible or has no text, just return. */
- if (!GTK_WIDGET_VISIBLE (widget) || !GTK_WIDGET_MAPPED (widget)
- || !label->label || (*label->label == '\0'))
- return TRUE;
-
- /* Recalculate the number of characters displayed, if necessary. */
- if (label->chars_displayed == E_CLIPPED_LABEL_NEED_RECALC)
- e_clipped_label_recalc_chars_displayed (label);
-
- /*
- * GC Clipping
- */
- gdk_gc_set_clip_rectangle (widget->style->white_gc,
- &event->area);
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
- &event->area);
-
- pango_layout_get_pixel_extents (label->layout, &rect, NULL);
-
- if (label->chars_displayed == E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL) {
- x = floor (widget->allocation.x + (gint)misc->xpad
- + (((gint)widget->allocation.width -
- (gint)label->label_width - 2 * (gint)misc->xpad)
- * misc->xalign) + 0.5);
-
- gdk_draw_layout (widget->window, widget->style->fg_gc[widget->state],
- x, label->label_y, label->layout);
- } else {
- int layout_width;
-
- x = widget->allocation.x + (gint)misc->xpad;
-
- /* trim the layout to the number of characters we're displaying */
- pango_layout_set_text (label->layout, label->label, label->chars_displayed);
-
- /* draw it */
- gdk_draw_layout (widget->window, widget->style->fg_gc[widget->state],
- x, label->label_y, label->layout);
-
- pango_layout_get_pixel_size (label->layout, &layout_width, NULL);
-
- /* offset the X position for the ellipsis */
- x = widget->allocation.x + (gint)misc->xpad
- + label->ellipsis_x;
-
- /* then draw the ellipsis */
- pango_layout_set_text (label->layout, e_clipped_label_ellipsis, strlen (e_clipped_label_ellipsis));
-
- gdk_draw_layout (widget->window, widget->style->fg_gc[widget->state],
- x, label->label_y, label->layout);
-
- /* then reset the layout to our original label text */
- pango_layout_set_text (label->layout, label->label, -1);
- }
-
- gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
- gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
-
- return TRUE;
-}
-
-
-static void
-e_clipped_label_finalize (GObject *object)
-{
- EClippedLabel *label;
-
- g_return_if_fail (E_IS_CLIPPED_LABEL (object));
-
- label = E_CLIPPED_LABEL(object);
-
- g_free (label->label);
-
- g_object_unref (label->layout);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-/**
- * e_clipped_label_get_text:
- *
- * @label: An #EClippedLabel.
- * @Return: The label text.
- *
- * Returns the label text, or NULL.
- **/
-gchar*
-e_clipped_label_get_text (EClippedLabel *label)
-{
- g_return_val_if_fail (E_IS_CLIPPED_LABEL (label), NULL);
-
- return label->label;
-}
-
-
-/**
- * e_clipped_label_set_text:
- *
- * @label: An #EClippedLabel.
- * @text: The new label text.
- *
- * Sets the label text.
- **/
-void
-e_clipped_label_set_text (EClippedLabel *label,
- const gchar *text)
-{
- gint len;
-
- g_return_if_fail (E_IS_CLIPPED_LABEL (label));
-
- if (label->label != text || !label->label || !text
- || strcmp (label->label, text)) {
- g_free (label->label);
- label->label = NULL;
-
- if (text)
- label->label = g_strdup (text);
-
- build_layout (label, text);
-
- /* Reset the number of characters displayed, so it is
- recalculated when needed. */
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-
- /* We don't queue a resize, since the label should not affect
- the widget size, but we queue a draw. */
- gtk_widget_queue_draw (GTK_WIDGET (label));
- }
-}
-
-
-static void
-e_clipped_label_recalc_chars_displayed (EClippedLabel *label)
-{
- gint max_width, width, ch, last_width, ellipsis_width;
- GSList *lines;
- PangoLayoutLine *line;
- int index;
- PangoRectangle rect;
- GtkWidget *widget = GTK_WIDGET (label);
- GtkMisc *misc = GTK_MISC (label);
-
- max_width = GTK_WIDGET (label)->allocation.width
- - 2 * GTK_MISC (label)->xpad;
-
- if (!label->label) {
- label->chars_displayed = 0;
- return;
- }
-
- /* See if the entire label fits in the allocated width. */
- pango_layout_set_text (label->layout, label->label, -1);
-
- pango_layout_get_pixel_extents (label->layout, &rect, NULL);
-
- label->label_y = floor (widget->allocation.y + (gint)misc->ypad
- + (((gint)widget->allocation.height - 2 * (gint)misc->ypad
- + (gint)PANGO_ASCENT (rect) - PANGO_DESCENT(rect))
- * misc->yalign) + 0.5);
-
- pango_layout_get_pixel_size (label->layout, &label->label_width, NULL);
- if (label->label_width <= max_width) {
- label->chars_displayed = E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL;
- return;
- }
-
- if (max_width <= 0) {
- label->chars_displayed = 0;
- label->ellipsis_x = 0;
- return;
- }
-
- max_width -= label->ellipsis_width;
-
- lines = pango_layout_get_lines (label->layout);
- line = lines->data;
-
- if (!pango_layout_line_x_to_index (line,
- max_width * PANGO_SCALE,
- &index,
- NULL)) {
- g_warning ("pango_layout_line_x_to_index returned false");
- return;
- }
-
-#if 0
- g_slist_foreach (lines, (GFunc)pango_layout_line_unref, NULL);
- g_slist_free (lines);
-#endif
-
- label->chars_displayed = index;
-
- pango_layout_set_text (label->layout, label->label, label->chars_displayed);
- pango_layout_get_pixel_size (label->layout, &width, NULL);
-
- label->ellipsis_x = width;
-}
-
diff --git a/widgets/misc/e-clipped-label.h b/widgets/misc/e-clipped-label.h
deleted file mode 100644
index ab0d741ebf..0000000000
--- a/widgets/misc/e-clipped-label.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 1999, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This is similar to GtkLabel but clips itself and displays '...' if it
- * can't fit inside its allocated area. The intended use is for inside buttons
- * that are a fixed size. The GtkLabel would normally display only the middle
- * part of the text, which doesn't look very good. This only supports one line
- * of text (so no wrapping/justification), without underlined characters.
- */
-#ifndef _E_CLIPPED_LABEL_H_
-#define _E_CLIPPED_LABEL_H_
-
-#include <gtk/gtkmisc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_CLIPPED_LABEL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_clipped_label_get_type (), EClippedLabel)
-#define E_CLIPPED_LABEL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_clipped_label_get_type (), EClippedLabelClass)
-#define E_IS_CLIPPED_LABEL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_clipped_label_get_type ())
-
-
-typedef struct _EClippedLabel EClippedLabel;
-typedef struct _EClippedLabelClass EClippedLabelClass;
-
-struct _EClippedLabel
-{
- GtkMisc misc;
-
- gchar *label;
-
- /* Our PangoLayout */
- PangoLayout *layout;
-
- /* This is the width of the entire label string, in pixels. */
- gint label_width;
-
- /* This is the label's y coord. we store it here so it won't
- change as the label's baseline changes (for example if we
- ellide the 'y' from 'Summary' the baseline drops) */
- gint label_y;
-
- /* This is the number of characters we can fit in, or
- E_CLIPPED_LABEL_NEED_RECALC if it needs to be recalculated, or
- E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL to show the entire label. */
- gint chars_displayed;
-
- /* This is the x position to display the ellipsis string, e.g. '...',
- relative to the start of the label. */
- gint ellipsis_x;
-
- /* This is the width of the ellipsis, in pixels */
- gint ellipsis_width;
-};
-
-struct _EClippedLabelClass
-{
- GtkMiscClass parent_class;
-};
-
-
-GtkType e_clipped_label_get_type (void);
-GtkWidget* e_clipped_label_new (const gchar *text);
-
-gchar* e_clipped_label_get_text (EClippedLabel *label);
-void e_clipped_label_set_text (EClippedLabel *label,
- const gchar *text);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CLIPPED_LABEL_H_ */
diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c
deleted file mode 100644
index 3f16437bee..0000000000
--- a/widgets/misc/e-colors.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-colors.c - General color allocation utilities
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/* We keep our own color context, as the color allocation might take
- * place before things are realized.
- */
-
-#include <config.h>
-#include <gtk/gtkwidget.h>
-#include "e-colors.h"
-
-GdkColor e_white, e_dark_gray, e_black;
-
-gulong
-e_color_alloc (gushort red, gushort green, gushort blue)
-{
- e_color_init ();
-
- red >>= 8;
- green >>= 8;
- blue >>= 8;
- return gdk_rgb_xpixel_from_rgb (
- ((red & 0xff) << 16) | ((green & 0xff) << 8) |
- (blue & 0xff));
-}
-
-void
-e_color_alloc_gdk (GtkWidget *widget, GdkColor *c)
-{
- GdkColormap *map;
-
- e_color_init ();
-
- if (widget)
- map = gtk_widget_get_colormap (widget);
- else /* FIXME: multi depth broken ? */
- map = gtk_widget_get_default_colormap ();
-
- gdk_rgb_find_color (map, c);
-}
-
-void
-e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *c)
-{
- GdkColormap *map;
-
- e_color_init ();
-
- gdk_color_parse (name, c);
-
- if (widget)
- map = gtk_widget_get_colormap (widget);
- else /* FIXME: multi depth broken ? */
- map = gtk_widget_get_default_colormap ();
-
- gdk_rgb_find_color (map, c);
-}
-
-void
-e_color_init (void)
-{
- static gboolean e_color_inited = FALSE;
-
- /* It's surprisingly easy to end up calling this twice. Survive. */
- if (e_color_inited)
- return;
-
- e_color_inited = TRUE;
-
- /* Allocate the default colors */
- e_white.red = 65535;
- e_white.green = 65535;
- e_white.blue = 65535;
- e_color_alloc_gdk (NULL, &e_white);
-
- e_black.red = 0;
- e_black.green = 0;
- e_black.blue = 0;
- e_color_alloc_gdk (NULL, &e_black);
-
- e_color_alloc_name (NULL, "gray20", &e_dark_gray);
-}
-
diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h
deleted file mode 100644
index 596fd2b0a5..0000000000
--- a/widgets/misc/e-colors.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-colors.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef GNOME_APP_LIBS_COLOR_H
-#define GNOME_APP_LIBS_COLOR_H
-
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-G_BEGIN_DECLS
-
-void e_color_init (void);
-
-/* Return the pixel value for the given red, green and blue */
-gulong e_color_alloc (gushort red, gushort green, gushort blue);
-void e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *color);
-void e_color_alloc_gdk (GtkWidget *widget, GdkColor *color);
-
-extern GdkColor e_white, e_dark_gray, e_black;
-
-G_END_DECLS
-
-#endif /* GNOME_APP_LIBS_COLOR_H */
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
deleted file mode 100644
index 0929d0bbd5..0000000000
--- a/widgets/misc/e-combo-button.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-combo-button.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-combo-button.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtksignal.h>
-
-#include <gal/util/e-util.h>
-
-
-struct _EComboButtonPrivate {
- GdkPixbuf *icon;
-
- GtkWidget *icon_pixmap;
- GtkWidget *label;
- GtkWidget *arrow_pixmap;
- GtkWidget *hbox;
-
- GtkMenu *menu;
-
- gboolean menu_popped_up;
-};
-
-
-#define SPACING 2
-
-static const char *arrow_xpm[] = {
- "11 5 2 1",
- " c none",
- ". c #000000000000",
- " ......... ",
- " ....... ",
- " ..... ",
- " ... ",
- " . ",
-};
-
-
-#define PARENT_TYPE gtk_button_get_type ()
-static GtkButtonClass *parent_class = NULL;
-
-enum {
- ACTIVATE_DEFAULT,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-/* Utility functions. */
-
-static GtkWidget *
-create_pixmap_widget_from_pixbuf (GdkPixbuf *pixbuf)
-{
- GtkWidget *pixmap_widget;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128);
-
- pixmap_widget = gtk_pixmap_new (pixmap, mask);
-
- gdk_pixmap_unref (pixmap);
- g_object_unref (mask);
-
- return pixmap_widget;
-}
-
-static GtkWidget *
-create_empty_pixmap_widget (void)
-{
- GtkWidget *pixmap_widget;
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
-
- pixmap_widget = create_pixmap_widget_from_pixbuf (pixbuf);
-
- g_object_unref (pixbuf);
-
- return pixmap_widget;
-}
-
-static GtkWidget *
-create_arrow_pixmap_widget (void)
-{
- GtkWidget *pixmap_widget;
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_new_from_xpm_data (arrow_xpm);
-
- pixmap_widget = create_pixmap_widget_from_pixbuf (pixbuf);
-
- g_object_unref (pixbuf);
-
- return pixmap_widget;
-}
-
-static void
-set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf)
-{
- EComboButtonPrivate *priv;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- priv = combo_button->priv;
-
- if (priv->icon != NULL)
- g_object_unref (priv->icon);
-
- if (pixbuf == NULL) {
- priv->icon = NULL;
- gtk_widget_hide (priv->icon_pixmap);
- return;
- }
-
- priv->icon = g_object_ref (pixbuf);
-
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128);
- gtk_pixmap_set (GTK_PIXMAP (priv->icon_pixmap), pixmap, mask);
-
- gtk_widget_show (priv->icon_pixmap);
-
- gdk_pixmap_unref (pixmap);
- gdk_pixmap_unref (mask);
-}
-
-
-/* Paint the borders. */
-
-static void
-paint (EComboButton *combo_button,
- GdkRectangle *area)
-{
- EComboButtonPrivate *priv = combo_button->priv;
- GtkShadowType shadow_type;
- int separator_x;
-
- gdk_window_set_back_pixmap (GTK_WIDGET (combo_button)->window, NULL, TRUE);
- gdk_window_clear_area (GTK_WIDGET (combo_button)->window,
- area->x, area->y,
- area->width, area->height);
-
- /* Only paint the outline if we are in prelight state. */
- if (GTK_WIDGET_STATE (combo_button) != GTK_STATE_PRELIGHT
- && GTK_WIDGET_STATE (combo_button) != GTK_STATE_ACTIVE)
- return;
-
- separator_x = (priv->label->allocation.width
- + priv->label->allocation.x
- + priv->arrow_pixmap->allocation.x) / 2;
-
- if (GTK_WIDGET_STATE (combo_button) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_paint_box (GTK_WIDGET (combo_button)->style,
- GTK_WIDGET (combo_button)->window,
- GTK_STATE_PRELIGHT,
- shadow_type,
- area,
- GTK_WIDGET (combo_button),
- "button",
- 0,
- 0,
- separator_x,
- GTK_WIDGET (combo_button)->allocation.height);
-
- gtk_paint_box (GTK_WIDGET (combo_button)->style,
- GTK_WIDGET (combo_button)->window,
- GTK_STATE_PRELIGHT,
- shadow_type,
- area,
- GTK_WIDGET (combo_button),
- "button",
- separator_x,
- 0,
- GTK_WIDGET (combo_button)->allocation.width - separator_x,
- GTK_WIDGET (combo_button)->allocation.height);
-}
-
-
-/* Callbacks for the associated menu. */
-
-static void
-menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (menu), combo_button);
- priv->menu = NULL;
-}
-
-static void
-menu_deactivate_callback (GtkMenuShell *menu_shell,
- void *data)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (data);
- priv = combo_button->priv;
-
- priv->menu_popped_up = FALSE;
-
- GTK_BUTTON (combo_button)->button_down = FALSE;
- gtk_button_leave (GTK_BUTTON (combo_button));
- gtk_button_clicked (GTK_BUTTON (combo_button));
-}
-
-static void
-menu_position_func (GtkMenu *menu,
- gint *x_return,
- gint *y_return,
- gboolean *push_in,
- void *data)
-{
- EComboButton *combo_button;
- GtkAllocation *allocation;
-
- combo_button = E_COMBO_BUTTON (data);
- allocation = & (GTK_WIDGET (combo_button)->allocation);
-
- gdk_window_get_origin (GTK_WIDGET (combo_button)->window, x_return, y_return);
-
- *y_return += allocation->height;
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_destroy (GtkObject *object)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (object);
- priv = combo_button->priv;
-
- if (priv->arrow_pixmap != NULL) {
- gtk_widget_destroy (priv->arrow_pixmap);
- priv->arrow_pixmap = NULL;
- }
-
- if (priv->icon != NULL) {
- g_object_unref (priv->icon);
- priv->icon = NULL;
- }
-
- g_free (priv);
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static int
-impl_button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
-
- if (event->type == GDK_BUTTON_PRESS &&
- (event->button == 1 || event->button == 3)) {
- GTK_BUTTON (widget)->button_down = TRUE;
-
- if (event->button == 3 ||
- event->x >= priv->arrow_pixmap->allocation.x) {
- /* User clicked on the right side: pop up the menu. */
- gtk_button_pressed (GTK_BUTTON (widget));
-
- priv->menu_popped_up = TRUE;
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_func, combo_button,
- event->button, event->time);
- } else {
- /* User clicked on the left side: just behave like a
- normal button (i.e. not a toggle). */
- gtk_button_pressed (GTK_BUTTON (widget));
- }
- }
-
- return TRUE;
-}
-
-static int
-impl_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
-
- /* This is to override the standard behavior of deactivating the button
- when the pointer gets out of the widget, in the case in which we
- have just popped up the menu. Otherwise, the button would look as
- inactive when the menu is popped up. */
- if (! priv->menu_popped_up)
- return (* GTK_WIDGET_CLASS (parent_class)->leave_notify_event) (widget, event);
-
- return FALSE;
-}
-
-static int
-impl_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- if (! GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- bin = GTK_BIN (widget);
-
- paint (E_COMBO_BUTTON (widget), &event->area);
-
- child_event = *event;
- if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_container_propagate_expose (GTK_CONTAINER (widget), bin->child, &child_event);
-
- return FALSE;
-}
-
-
-/* GtkButton methods. */
-
-static void
-impl_released (GtkButton *button)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (button);
- priv = combo_button->priv;
-
- /* Massive cut & paste from GtkButton here... The only change in
- behavior here is that we want to emit ::activate_default when not
- the menu hasn't been popped up. */
-
- if (button->button_down) {
- int new_state;
-
- button->button_down = FALSE;
-
- if (button->in_button) {
- gtk_button_clicked (button);
-
- if (! priv->menu_popped_up)
- gtk_signal_emit (GTK_OBJECT (button), signals[ACTIVATE_DEFAULT]);
- }
-
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state) {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
-
- /* We _draw () instead of queue_draw so that if the
- operation blocks, the label doesn't vanish. */
- gtk_widget_draw (GTK_WIDGET (button), NULL);
- }
- }
-}
-
-
-static void
-class_init (GtkObjectClass *object_class)
-{
- GtkWidgetClass *widget_class;
- GtkButtonClass *button_class;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-
- object_class->destroy = impl_destroy;
-
- widget_class = GTK_WIDGET_CLASS (object_class);
- widget_class->button_press_event = impl_button_press_event;
- widget_class->leave_notify_event = impl_leave_notify_event;
- widget_class->expose_event = impl_expose_event;
-
- button_class = GTK_BUTTON_CLASS (object_class);
- button_class->released = impl_released;
-
- signals[ACTIVATE_DEFAULT] = gtk_signal_new ("activate_default",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EComboButtonClass, activate_default),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-}
-
-static void
-init (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- priv = g_new (EComboButtonPrivate, 1);
- combo_button->priv = priv;
-
- priv->hbox = gtk_hbox_new (FALSE, SPACING);
- gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
- gtk_widget_show (priv->hbox);
-
- priv->icon_pixmap = create_empty_pixmap_widget ();
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_pixmap, TRUE, TRUE, 0);
- gtk_widget_show (priv->icon_pixmap);
-
- priv->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, TRUE, TRUE,
- 2 * GTK_WIDGET (combo_button)->style->xthickness);
- gtk_widget_show (priv->label);
-
- priv->arrow_pixmap = create_arrow_pixmap_widget ();
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->arrow_pixmap, TRUE, TRUE,
- GTK_WIDGET (combo_button)->style->xthickness);
- gtk_widget_show (priv->arrow_pixmap);
-
- priv->icon = NULL;
- priv->menu = NULL;
- priv->menu_popped_up = FALSE;
-}
-
-
-void
-e_combo_button_construct (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
-
- priv = combo_button->priv;
- g_return_if_fail (priv->menu == NULL);
-
- GTK_WIDGET_UNSET_FLAGS (combo_button, GTK_CAN_FOCUS);
-
- gtk_button_set_relief (GTK_BUTTON (combo_button), GTK_RELIEF_NONE);
-}
-
-GtkWidget *
-e_combo_button_new (void)
-{
- EComboButton *new;
-
- new = gtk_type_new (e_combo_button_get_type ());
- e_combo_button_construct (new);
-
- return GTK_WIDGET (new);
-}
-
-
-void
-e_combo_button_set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf)
-{
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
-
- set_icon (combo_button, pixbuf);
-}
-
-void
-e_combo_button_set_label (EComboButton *combo_button,
- const char *label)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
- g_return_if_fail (label != NULL);
-
- priv = combo_button->priv;
-
- if (label == NULL)
- label = "";
-
- gtk_label_parse_uline (GTK_LABEL (priv->label), label);
-}
-
-void
-e_combo_button_set_menu (EComboButton *combo_button,
- GtkMenu *menu)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- priv = combo_button->priv;
-
- if (priv->menu != NULL)
- gtk_menu_detach (priv->menu);
-
- priv->menu = menu;
- if (menu == NULL)
- return;
-
- gtk_menu_attach_to_widget (menu, GTK_WIDGET (combo_button), menu_detacher);
-
- g_signal_connect((menu), "deactivate",
- G_CALLBACK (menu_deactivate_callback),
- combo_button);
-}
-
-
-E_MAKE_TYPE (e_combo_button, "EComboButton", EComboButton, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-combo-button.h b/widgets/misc/e-combo-button.h
deleted file mode 100644
index fa4dcc65a2..0000000000
--- a/widgets/misc/e-combo-button.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-combo-button.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef _E_COMBO_BUTTON_H_
-#define _E_COMBO_BUTTON_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkmenu.h>
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_COMBO_BUTTON (e_combo_button_get_type ())
-#define E_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMBO_BUTTON, EComboButton))
-#define E_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMBO_BUTTON, EComboButtonClass))
-#define E_IS_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMBO_BUTTON))
-#define E_IS_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMBO_BUTTON))
-
-
-typedef struct _EComboButton EComboButton;
-typedef struct _EComboButtonPrivate EComboButtonPrivate;
-typedef struct _EComboButtonClass EComboButtonClass;
-
-struct _EComboButton {
- GtkButton parent;
-
- EComboButtonPrivate *priv;
-};
-
-struct _EComboButtonClass {
- GtkButtonClass parent_class;
-
- /* Signals. */
- void (* activate_default) (EComboButton *combo_button);
-};
-
-
-GtkType e_combo_button_get_type (void);
-void e_combo_button_construct (EComboButton *combo_button);
-GtkWidget *e_combo_button_new (void);
-
-void e_combo_button_set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf);
-void e_combo_button_set_label (EComboButton *combo_button,
- const char *label);
-void e_combo_button_set_menu (EComboButton *combo_button,
- GtkMenu *menu);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_COMBO_BUTTON_H_ */
diff --git a/widgets/misc/e-config-page.c b/widgets/misc/e-config-page.c
deleted file mode 100644
index ad440ca938..0000000000
--- a/widgets/misc/e-config-page.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-config-page.c
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-config-page.h"
-
-#include <gal/util/e-util.h>
-
-
-enum {
- APPLY,
- CHANGED,
- LAST_SIGNAL
-};
-
-#define PARENT_TYPE gtk_event_box_get_type ()
-static GtkEventBoxClass *parent_class = NULL;
-static unsigned int signals[LAST_SIGNAL] = { 0 };
-
-struct _EConfigPagePrivate {
- gboolean changed;
-};
-
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- EConfigPage *page;
- EConfigPagePrivate *priv;
-
- page = E_CONFIG_PAGE (object);
- priv = page->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-static void
-class_init (EConfigPageClass *class)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = impl_finalize;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-
- signals[APPLY] = gtk_signal_new ("apply",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EConfigPageClass, apply),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- signals[CHANGED] = gtk_signal_new ("changed",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EConfigPageClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-}
-
-static void
-init (EConfigPage *config_page)
-{
- EConfigPagePrivate *priv;
-
- priv = g_new (EConfigPagePrivate, 1);
- priv->changed = FALSE;
-
- config_page->priv = priv;
-}
-
-
-GtkWidget *
-e_config_page_new (void)
-{
- GtkWidget *new;
-
- new = gtk_type_new (e_config_page_get_type ());
-
- return new;
-}
-
-
-void
-e_config_page_apply (EConfigPage *config_page)
-{
- EConfigPagePrivate *priv;
-
- g_return_if_fail (E_IS_CONFIG_PAGE (config_page));
-
- priv = config_page->priv;
-
- gtk_signal_emit (GTK_OBJECT (config_page), signals[APPLY]);
-
- priv->changed = FALSE;
-}
-
-gboolean
-e_config_page_is_applied (EConfigPage *config_page)
-{
- g_return_val_if_fail (E_IS_CONFIG_PAGE (config_page), FALSE);
-
- return ! config_page->priv->changed;
-}
-
-void
-e_config_page_changed (EConfigPage *config_page)
-{
- EConfigPagePrivate *priv;
-
- g_return_if_fail (E_IS_CONFIG_PAGE (config_page));
-
- priv = config_page->priv;
-
- if (priv->changed)
- return;
-
- priv->changed = TRUE;
- gtk_signal_emit (GTK_OBJECT (config_page), signals[CHANGED]);
-}
-
-
-E_MAKE_TYPE (e_config_page, "EConfigPage", EConfigPage, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-config-page.h b/widgets/misc/e-config-page.h
deleted file mode 100644
index 4862f8b1b5..0000000000
--- a/widgets/misc/e-config-page.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-config-page.h
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef _E_CONFIG_PAGE_H_
-#define _E_CONFIG_PAGE_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_CONFIG_PAGE (e_config_page_get_type ())
-#define E_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONFIG_PAGE, EConfigPage))
-#define E_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONFIG_PAGE, EConfigPageClass))
-#define E_IS_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONFIG_PAGE))
-#define E_IS_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONFIG_PAGE))
-
-
-typedef struct _EConfigPage EConfigPage;
-typedef struct _EConfigPagePrivate EConfigPagePrivate;
-typedef struct _EConfigPageClass EConfigPageClass;
-
-struct _EConfigPage {
- GtkEventBox parent;
-
- EConfigPagePrivate *priv;
-};
-
-struct _EConfigPageClass {
- GtkEventBoxClass parent_class;
-
- /* Signals. */
- void (* apply) (EConfigPage *config_page);
- void (* changed) (EConfigPage *config_page);
-};
-
-
-GtkType e_config_page_get_type (void);
-GtkWidget *e_config_page_new (void);
-
-void e_config_page_apply (EConfigPage *config_page);
-gboolean e_config_page_is_applied (EConfigPage *config_page);
-
-/* Protected. */
-void e_config_page_changed (EConfigPage *config_page);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CONFIG_PAGE_H_ */
diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c
deleted file mode 100644
index 3b44ab809e..0000000000
--- a/widgets/misc/e-cursors.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cursors.c - cursor handling for gnumeric
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-cursors.h"
-
-#include "e-colors.h"
-#include "pixmaps/cursor_cross.xpm"
-#include "pixmaps/cursor_zoom_in.xpm"
-#include "pixmaps/cursor_zoom_out.xpm"
-#include "pixmaps/cursor_hand_open.xpm"
-#include "pixmaps/cursor_hand_closed.xpm"
-#include <stdio.h>
-
-#define GDK_INTERNAL_CURSOR -1
-
-typedef struct {
- GdkCursor *cursor;
- int hot_x, hot_y;
- char **xpm;
-} CursorDef;
-
-static CursorDef cursors [] = {
- { NULL, 17, 17, cursor_cross_xpm },
- { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
- { NULL, 24, 24, cursor_zoom_in_xpm },
- { NULL, 24, 24, cursor_zoom_out_xpm },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL },
- { NULL, 10, 10, cursor_hand_open_xpm },
- { NULL, 10, 10, cursor_hand_closed_xpm },
- { NULL, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL },
- { NULL, 0, 0, NULL }
-};
-
-
-static void
-create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
-{
- int height, width, colors;
- char pixmap_buffer [(32 * 32)/8];
- char mask_buffer [(32 * 32)/8];
- int x, y, pix, yofs;
- int transparent_color, black_color;
-
- sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
-
- g_assert (height == 32);
- g_assert (width == 32);
- g_assert (colors <= 3);
-
- transparent_color = ' ';
- black_color = '.';
-
- yofs = colors + 1;
- for (y = 0; y < 32; y++){
- for (x = 0; x < 32;){
- char value = 0, maskv = 0;
-
- for (pix = 0; pix < 8; pix++, x++){
- if (xpm [y + yofs][x] != transparent_color){
- maskv |= 1 << pix;
-
- /*
- * Invert the colours here because it seems
- * to workaround a bug the Matrox G100 Xserver?
- * We reverse the foreground & background in the next
- * routine to compensate.
- */
- if (xpm [y + yofs][x] == black_color){
- value |= 1 << pix;
- }
- }
- }
- pixmap_buffer [(y * 4 + x/8)-1] = value;
- mask_buffer [(y * 4 + x/8)-1] = maskv;
- }
- }
- *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
- *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
-}
-
-void
-e_cursors_init (void)
-{
- int i;
-
- e_color_init ();
-
- for (i = 0; cursors [i].hot_x; i++){
- GdkBitmap *bitmap, *mask;
-
- if (cursors [i].hot_x < 0)
- cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y);
- else {
- create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm);
-
- /* The foreground and background colours are reversed.
- * See comment above for explanation.
- */
- cursors [i].cursor =
- gdk_cursor_new_from_pixmap (
- bitmap, mask,
- &e_black, &e_white,
- cursors [i].hot_x,
- cursors [i].hot_y);
- }
- }
-
- g_assert (i == E_CURSOR_NUM_CURSORS);
-}
-
-void
-e_cursors_shutdown (void)
-{
- int i;
-
- for (i = 0; cursors [i].hot_x; i++)
- gdk_cursor_destroy (cursors [i].cursor);
-}
-
-
-/* Returns a cursor given its type */
-GdkCursor *
-e_cursor_get (ECursorType type)
-{
- g_return_val_if_fail (type >= 0 && type < E_CURSOR_NUM_CURSORS, NULL);
-
- return cursors [type].cursor;
-}
diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h
deleted file mode 100644
index 8e751b659d..0000000000
--- a/widgets/misc/e-cursors.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cursors.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef GNOME_APP_LIB_CURSORS_H
-#define GNOME_APP_LIB_CURSORS_H
-
-#include <gdk/gdk.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
- E_CURSOR_FAT_CROSS,
- E_CURSOR_THIN_CROSS,
- E_CURSOR_ARROW,
- E_CURSOR_MOVE,
- E_CURSOR_ZOOM_IN,
- E_CURSOR_ZOOM_OUT,
- E_CURSOR_SIZE_X,
- E_CURSOR_SIZE_Y,
- E_CURSOR_SIZE_TL,
- E_CURSOR_SIZE_TR,
- E_CURSOR_PRESS,
- E_CURSOR_HAND_OPEN,
- E_CURSOR_HAND_CLOSED,
- E_CURSOR_XTERM,
- E_CURSOR_NUM_CURSORS
-} ECursorType;
-
-void e_cursors_init (void);
-void e_cursors_shutdown (void);
-
-#define e_cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, e_cursor_get (c)); \
-} G_STMT_END
-
-#define e_cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *e_cursor_get (ECursorType type);
-
-G_END_DECLS
-
-#endif /* GNOME_APP_LIB_CURSORS_H */
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
deleted file mode 100644
index 72dcb15772..0000000000
--- a/widgets/misc/e-dateedit.c
+++ /dev/null
@@ -1,1935 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * Based on the GnomeDateEdit, part of the Gnome Library.
- * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EDateEdit - a widget based on GnomeDateEdit to provide a date & optional
- * time field with popups for entering a date.
- */
-
-#include <config.h>
-
-#include "e-dateedit.h"
-#include "e-util-marshal.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkarrow.h>
-#include <gtk/gtkbbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkcombo.h>
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtklist.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-util/e-time-utils.h"
-#include "e-calendar.h"
-
-
-
-struct _EDateEditPrivate {
- GtkWidget *date_entry;
- GtkWidget *date_button;
-
- GtkWidget *space;
-
- GtkWidget *time_combo;
-
- GtkWidget *cal_popup;
- GtkWidget *calendar;
- GtkWidget *now_button;
- GtkWidget *today_button;
- GtkWidget *none_button; /* This will only be visible if a
- 'None' date/time is permitted. */
-
- gboolean show_date;
- gboolean show_time;
- gboolean use_24_hour_format;
-
- /* This is TRUE if we want to make the time field insensitive rather
- than hide it when set_show_time() is called. */
- gboolean make_time_insensitive;
-
- /* This is the range of hours we show in the time popup. */
- gint lower_hour;
- gint upper_hour;
-
- /* This indicates whether the last date committed was invalid.
- (A date is committed by hitting Return, moving the keyboard focus,
- or selecting a date in the popup). Note that this only indicates
- that the date couldn't be parsed. A date set to 'None' is valid
- here, though e_date_edit_date_is_valid() will return FALSE if an
- empty date isn't actually permitted. */
- gboolean date_is_valid;
-
- /* This is the last valid date which was set. If the date was set to
- 'None' or empty, date_set_to_none will be TRUE and the other fields
- are undefined, so don't use them. */
- gboolean date_set_to_none;
- gint year;
- gint month;
- gint day;
-
- /* This indicates whether the last time committed was invalid.
- (A time is committed by hitting Return, moving the keyboard focus,
- or selecting a time in the popup). Note that this only indicates
- that the time couldn't be parsed. An empty/None time is valid
- here, though e_date_edit_time_is_valid() will return FALSE if an
- empty time isn't actually permitted. */
- gboolean time_is_valid;
-
- /* This is the last valid time which was set. If the time was set to
- 'None' or empty, time_set_to_none will be TRUE and the other fields
- are undefined, so don't use them. */
- gboolean time_set_to_none;
- gint hour;
- gint minute;
-
- EDateEditGetTimeCallback time_callback;
- gpointer time_callback_data;
- GtkDestroyNotify time_callback_destroy;
-};
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-
-static gint date_edit_signals [LAST_SIGNAL] = { 0 };
-
-
-static void e_date_edit_class_init (EDateEditClass *class);
-static void e_date_edit_init (EDateEdit *dedit);
-static void create_children (EDateEdit *dedit);
-static void e_date_edit_dispose (GObject *object);
-static void e_date_edit_grab_focus (GtkWidget *widget);
-static void e_date_edit_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-
-static gint on_date_entry_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit);
-static void on_date_button_clicked (GtkWidget *widget,
- EDateEdit *dedit);
-static void e_date_edit_show_date_popup (EDateEdit *dedit);
-static void position_date_popup (EDateEdit *dedit);
-static void on_date_popup_none_button_clicked (GtkWidget *button,
- EDateEdit *dedit);
-static void on_date_popup_today_button_clicked (GtkWidget *button,
- EDateEdit *dedit);
-static void on_date_popup_now_button_clicked (GtkWidget *button,
- EDateEdit *dedit);
-static gint on_date_popup_delete_event (GtkWidget *widget,
- EDateEdit *dedit);
-static gint on_date_popup_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit);
-static gint on_date_popup_button_press (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data);
-static void on_date_popup_date_selected (ECalendarItem *calitem,
- EDateEdit *dedit);
-static void hide_date_popup (EDateEdit *dedit);
-static void rebuild_time_popup (EDateEdit *dedit);
-static gboolean field_set_to_none (const char *text);
-static gboolean e_date_edit_parse_date (EDateEdit *dedit,
- const char *date_text,
- struct tm *date_tm);
-static gboolean e_date_edit_parse_time (EDateEdit *dedit,
- const gchar *time_text,
- struct tm *time_tm);
-static void on_date_edit_time_selected (GtkList *list,
- EDateEdit *dedit);
-static gint on_time_entry_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit);
-static gint on_date_entry_focus_out (GtkEntry *entry,
- GdkEventFocus *event,
- EDateEdit *dedit);
-static gint on_time_entry_focus_out (GtkEntry *entry,
- GdkEventFocus *event,
- EDateEdit *dedit);
-static void e_date_edit_update_date_entry (EDateEdit *dedit);
-static void e_date_edit_update_time_entry (EDateEdit *dedit);
-static void e_date_edit_update_time_combo_state (EDateEdit *dedit);
-static void e_date_edit_check_date_changed (EDateEdit *dedit);
-static void e_date_edit_check_time_changed (EDateEdit *dedit);
-static gboolean e_date_edit_set_date_internal (EDateEdit *dedit,
- gboolean valid,
- gboolean none,
- gint year,
- gint month,
- gint day);
-static gboolean e_date_edit_set_time_internal (EDateEdit *dedit,
- gboolean valid,
- gboolean none,
- gint hour,
- gint minute);
-
-
-static GtkHBoxClass *parent_class;
-
-/**
- * e_date_edit_get_type:
- *
- * Returns the GtkType for the EDateEdit widget
- */
-GType
-e_date_edit_get_type (void)
-{
- static GType date_edit_type = 0;
-
- if (!date_edit_type){
- static const GTypeInfo date_edit_info = {
- sizeof (EDateEditClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_date_edit_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EDateEdit),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_date_edit_init,
- };
-
- date_edit_type = g_type_register_static (GTK_TYPE_HBOX, "EDateEdit", &date_edit_info, 0);
- }
-
- return date_edit_type;
-}
-
-
-static void
-e_date_edit_class_init (EDateEditClass *class)
-{
- GObjectClass *object_class = (GObjectClass *) class;
- GtkWidgetClass *widget_class = (GtkWidgetClass *) class;
- GtkContainerClass *container_class = (GtkContainerClass *) class;
-
- parent_class = g_type_class_ref (GTK_TYPE_HBOX);
-
- date_edit_signals [CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EDateEditClass, changed),
- NULL, NULL,
- e_util_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- object_class->dispose = e_date_edit_dispose;
-
- widget_class->grab_focus = e_date_edit_grab_focus;
-
- container_class->forall = e_date_edit_forall;
-
- class->changed = NULL;
-}
-
-
-static void
-e_date_edit_init (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
-
- GTK_WIDGET_SET_FLAGS (dedit, GTK_CAN_FOCUS);
-
- dedit->priv = priv = g_new0 (EDateEditPrivate, 1);
-
- priv->show_date = TRUE;
- priv->show_time = TRUE;
- priv->use_24_hour_format = TRUE;
-
- priv->make_time_insensitive = FALSE;
-
- priv->lower_hour = 0;
- priv->upper_hour = 24;
-
- priv->date_is_valid = TRUE;
- priv->date_set_to_none = TRUE;
- priv->time_is_valid = TRUE;
- priv->time_set_to_none = TRUE;
- priv->time_callback = NULL;
- priv->time_callback_data = NULL;
- priv->time_callback_destroy = NULL;
-
- create_children (dedit);
-
- /* Set it to the current time. */
- e_date_edit_set_time (dedit, 0);
-}
-
-
-/**
- * e_date_edit_new:
- *
- * Description: Creates a new #EDateEdit widget which can be used
- * to provide an easy to use way for entering dates and times.
- *
- * Returns: a new #EDateEdit widget.
- */
-GtkWidget *
-e_date_edit_new (void)
-{
- EDateEdit *dedit;
-
- dedit = g_object_new (E_TYPE_DATE_EDIT, NULL);
-
- return GTK_WIDGET (dedit);
-}
-
-
-static void
-create_children (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- ECalendar *calendar;
- GtkWidget *frame, *arrow;
- GtkWidget *vbox, *bbox;
-
- priv = dedit->priv;
-
- priv->date_entry = gtk_entry_new ();
- gtk_widget_set_size_request (priv->date_entry, 90, 0);
- gtk_box_pack_start (GTK_BOX (dedit), priv->date_entry, FALSE, TRUE, 0);
-
- g_signal_connect (priv->date_entry, "key_press_event",
- G_CALLBACK (on_date_entry_key_press),
- dedit);
- g_signal_connect_after (priv->date_entry,
- "focus_out_event",
- G_CALLBACK (on_date_entry_focus_out),
- dedit);
-
- priv->date_button = gtk_button_new ();
- g_signal_connect (priv->date_button, "clicked",
- G_CALLBACK (on_date_button_clicked), dedit);
- gtk_box_pack_start (GTK_BOX (dedit), priv->date_button,
- FALSE, FALSE, 0);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_container_add (GTK_CONTAINER (priv->date_button), arrow);
- gtk_widget_show (arrow);
-
- if (priv->show_date) {
- gtk_widget_show (priv->date_entry);
- gtk_widget_show (priv->date_button);
- }
-
- /* This is just to create a space between the date & time parts. */
- priv->space = gtk_drawing_area_new ();
- gtk_box_pack_start (GTK_BOX (dedit), priv->space, FALSE, FALSE, 2);
-
-
- priv->time_combo = gtk_combo_new ();
- gtk_widget_set_size_request (GTK_COMBO (priv->time_combo)->entry, 90, 0);
- gtk_box_pack_start (GTK_BOX (dedit), priv->time_combo, FALSE, TRUE, 0);
- rebuild_time_popup (dedit);
-
- g_signal_connect (GTK_COMBO (priv->time_combo)->entry,
- "key_press_event",
- G_CALLBACK (on_time_entry_key_press),
- dedit);
- g_signal_connect_after (GTK_COMBO (priv->time_combo)->entry,
- "focus_out_event",
- G_CALLBACK (on_time_entry_focus_out),
- dedit);
- g_signal_connect_after (GTK_COMBO (priv->time_combo)->list,
- "selection_changed",
- G_CALLBACK (on_date_edit_time_selected),
- dedit);
-
- if (priv->show_time || priv->make_time_insensitive)
- gtk_widget_show (priv->time_combo);
-
- if (!priv->show_time && priv->make_time_insensitive)
- gtk_widget_set_sensitive (priv->time_combo, FALSE);
-
- if (priv->show_date
- && (priv->show_time || priv->make_time_insensitive))
- gtk_widget_show (priv->space);
-
- priv->cal_popup = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_set_events (priv->cal_popup,
- gtk_widget_get_events (priv->cal_popup)
- | GDK_KEY_PRESS_MASK);
- g_signal_connect (priv->cal_popup, "delete_event",
- G_CALLBACK (on_date_popup_delete_event),
- dedit);
- g_signal_connect (priv->cal_popup, "key_press_event",
- G_CALLBACK (on_date_popup_key_press),
- dedit);
- g_signal_connect (priv->cal_popup, "button_press_event",
- G_CALLBACK (on_date_popup_button_press),
- dedit);
- gtk_window_set_policy (GTK_WINDOW (priv->cal_popup),
- FALSE, FALSE, TRUE);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
- gtk_container_add (GTK_CONTAINER (priv->cal_popup), frame);
- gtk_widget_show (frame);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- priv->calendar = e_calendar_new ();
- calendar = E_CALENDAR (priv->calendar);
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (calendar->calitem),
- "maximum_days_selected", 1,
- "move_selection_when_moving", FALSE,
- NULL);
-
- g_signal_connect (calendar->calitem,
- "selection_changed",
- G_CALLBACK (on_date_popup_date_selected), dedit);
-
- gtk_box_pack_start (GTK_BOX (vbox), priv->calendar, FALSE, FALSE, 0);
- gtk_widget_show (priv->calendar);
-
- bbox = gtk_hbutton_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (bbox), 4);
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 2);
- gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (bbox), 2, 0);
- gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
- gtk_widget_show (bbox);
-
- priv->now_button = gtk_button_new_with_label (_("Now"));
- gtk_container_add (GTK_CONTAINER (bbox), priv->now_button);
- gtk_widget_show (priv->now_button);
- g_signal_connect (priv->now_button, "clicked",
- G_CALLBACK (on_date_popup_now_button_clicked), dedit);
-
- priv->today_button = gtk_button_new_with_label (_("Today"));
- gtk_container_add (GTK_CONTAINER (bbox), priv->today_button);
- gtk_widget_show (priv->today_button);
- g_signal_connect (priv->today_button, "clicked",
- G_CALLBACK (on_date_popup_today_button_clicked), dedit);
-
- /* Note that we don't show this here, since by default a 'None' date
- is not permitted. */
- priv->none_button = gtk_button_new_with_label (_("None"));
- gtk_container_add (GTK_CONTAINER (bbox), priv->none_button);
- g_signal_connect (priv->none_button, "clicked",
- G_CALLBACK (on_date_popup_none_button_clicked), dedit);
-}
-
-
-static void
-e_date_edit_dispose (GObject *object)
-{
- EDateEdit *dedit;
-
- g_return_if_fail (E_IS_DATE_EDIT (object));
-
- dedit = E_DATE_EDIT (object);
-
- if (dedit->priv) {
- e_date_edit_set_get_time_callback (dedit, NULL, NULL, NULL);
-
- gtk_widget_destroy (dedit->priv->cal_popup);
- dedit->priv->cal_popup = NULL;
-
- g_free (dedit->priv);
- dedit->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-
-/* Grab_focus handler for the EDateEdit. If the date field is being shown, we
- grab the focus to that, otherwise we grab it to the time field. */
-static void
-e_date_edit_grab_focus (GtkWidget *widget)
-{
- EDateEdit *dedit;
-
- g_return_if_fail (E_IS_DATE_EDIT (widget));
-
- dedit = E_DATE_EDIT (widget);
-
- if (dedit->priv->show_date)
- gtk_widget_grab_focus (dedit->priv->date_entry);
- else
- gtk_widget_grab_focus (GTK_COMBO (dedit->priv->time_combo)->entry);
-}
-
-
-/**
- * e_date_edit_set_editable:
- * @dedit: an #EDateEdit widget.
- * @editable: whether or not the widget should accept edits.
- *
- * Allows the programmer to disallow editing (and the popping up of
- * the calendar widget), while still allowing the user to select the
- * date from the GtkEntry.
- */
-void
-e_date_edit_set_editable (EDateEdit *dedit, gboolean editable)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- gtk_entry_set_editable (GTK_ENTRY (priv->date_entry), editable);
- gtk_widget_set_sensitive (priv->date_button, editable);
-}
-
-static void
-e_date_edit_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- g_return_if_fail (E_IS_DATE_EDIT (container));
- g_return_if_fail (callback != NULL);
-
- /* Let GtkBox handle the internal widgets if needed. */
- if (include_internals) {
- if (GTK_CONTAINER_CLASS (parent_class)->forall)
- (* GTK_CONTAINER_CLASS (parent_class)->forall)
- (container, include_internals,
- callback, callback_data);
- }
-}
-
-
-/**
- * e_date_edit_get_time:
- * @dedit: an #EDateEdit widget.
- * @the_time: returns the last valid time entered.
- * @Returns: the last valid time entered, or -1 if the time is not set.
- *
- * Returns the last valid time entered. If empty times are valid, by calling
- * e_date_edit_set_allow_no_date_set(), then it may return -1.
- *
- * Note that the last time entered may actually have been invalid. You can
- * check this with e_date_edit_time_is_valid().
- */
-time_t
-e_date_edit_get_time (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- struct tm tmp_tm = { 0 };
-
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), -1);
-
- priv = dedit->priv;
-
- /* Try to parse any new value now. */
- e_date_edit_check_date_changed (dedit);
- e_date_edit_check_time_changed (dedit);
-
- if (priv->date_set_to_none)
- return -1;
-
- tmp_tm.tm_year = priv->year;
- tmp_tm.tm_mon = priv->month;
- tmp_tm.tm_mday = priv->day;
-
- if (!priv->show_time || priv->time_set_to_none) {
- tmp_tm.tm_hour = 0;
- tmp_tm.tm_min = 0;
- } else {
- tmp_tm.tm_hour = priv->hour;
- tmp_tm.tm_min = priv->minute;
- }
- tmp_tm.tm_sec = 0;
- tmp_tm.tm_isdst = -1;
-
- return mktime (&tmp_tm);
-}
-
-
-/**
- * e_date_edit_set_time:
- * @dedit: the EDateEdit widget
- * @the_time: The time and date that should be set on the widget
- *
- * Description: Changes the displayed date and time in the EDateEdit
- * widget to be the one represented by @the_time. If @the_time is 0
- * then current time is used. If it is -1, then the date is set to None.
- *
- * Note that the time is converted to local time using the Unix timezone,
- * so if you are using your own timezones then you should use
- * e_date_edit_set_date() and e_date_edit_set_time_of_day() instead.
- */
-void
-e_date_edit_set_time (EDateEdit *dedit,
- time_t the_time)
-{
- EDateEditPrivate *priv;
- struct tm tmp_tm;
- gboolean date_changed = FALSE, time_changed = FALSE;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (the_time == -1) {
- date_changed = e_date_edit_set_date_internal (dedit, TRUE,
- TRUE, 0, 0, 0);
- time_changed = e_date_edit_set_time_internal (dedit, TRUE,
- TRUE, 0, 0);
- } else {
- if (the_time == 0) {
- if (priv->time_callback) {
- tmp_tm = (*priv->time_callback) (dedit, priv->time_callback_data);
- } else {
- the_time = time (NULL);
- tmp_tm = *localtime (&the_time);
- }
- } else {
- tmp_tm = *localtime (&the_time);
- }
-
- date_changed = e_date_edit_set_date_internal (dedit, TRUE,
- FALSE,
- tmp_tm.tm_year,
- tmp_tm.tm_mon,
- tmp_tm.tm_mday);
- time_changed = e_date_edit_set_time_internal (dedit, TRUE,
- FALSE,
- tmp_tm.tm_hour,
- tmp_tm.tm_min);
- }
-
- e_date_edit_update_date_entry (dedit);
- e_date_edit_update_time_entry (dedit);
- e_date_edit_update_time_combo_state (dedit);
-
- /* Emit the signals if the date and/or time has actually changed. */
- if (date_changed || time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-
-/**
- * e_date_edit_get_date:
- * @dedit: an #EDateEdit widget.
- * @year: returns the year set.
- * @month: returns the month set (1 - 12).
- * @day: returns the day set (1 - 31).
- * @Returns: TRUE if a time was set, or FALSE if the field is empty or 'None'.
- *
- * Returns the last valid date entered into the date field.
- */
-gboolean
-e_date_edit_get_date (EDateEdit *dedit,
- gint *year,
- gint *month,
- gint *day)
-{
- EDateEditPrivate *priv;
-
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- priv = dedit->priv;
-
- /* Try to parse any new value now. */
- e_date_edit_check_date_changed (dedit);
-
- *year = priv->year + 1900;
- *month = priv->month + 1;
- *day = priv->day;
-
- if (priv->date_set_to_none
- && e_date_edit_get_allow_no_date_set (dedit))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * e_date_edit_set_date:
- * @dedit: an #EDateEdit widget.
- * @year: the year to set.
- * @month: the month to set (1 - 12).
- * @day: the day to set (1 - 31).
- *
- * Sets the date in the date field.
- */
-void
-e_date_edit_set_date (EDateEdit *dedit,
- gint year,
- gint month,
- gint day)
-{
- EDateEditPrivate *priv;
- gboolean date_changed = FALSE;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- date_changed = e_date_edit_set_date_internal (dedit, TRUE, FALSE,
- year - 1900, month - 1,
- day);
-
- e_date_edit_update_date_entry (dedit);
- e_date_edit_update_time_combo_state (dedit);
-
- /* Emit the signals if the date has actually changed. */
- if (date_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-
-/**
- * e_date_edit_get_time_of_day:
- * @dedit: an #EDateEdit widget.
- * @hour: returns the hour set, or 0 if the time isn't set.
- * @minute: returns the minute set, or 0 if the time isn't set.
- * @Returns: TRUE if a time was set, or FALSE if the field is empty or 'None'.
- *
- * Returns the last valid time entered into the time field.
- */
-gboolean
-e_date_edit_get_time_of_day (EDateEdit *dedit,
- gint *hour,
- gint *minute)
-{
- EDateEditPrivate *priv;
-
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- priv = dedit->priv;
-
- /* Try to parse any new value now. */
- e_date_edit_check_time_changed (dedit);
-
- if (priv->time_set_to_none) {
- *hour = 0;
- *minute = 0;
- return FALSE;
- } else {
- *hour = priv->hour;
- *minute = priv->minute;
- return TRUE;
- }
-}
-
-
-/**
- * e_date_edit_set_time_of_day:
- * @dedit: an #EDateEdit widget.
- * @hour: the hour to set, or -1 to set the time to None (i.e. empty).
- * @minute: the minute to set.
- *
- * Description: Sets the time in the time field.
- */
-void
-e_date_edit_set_time_of_day (EDateEdit *dedit,
- gint hour,
- gint minute)
-{
- EDateEditPrivate *priv;
- gboolean time_changed = FALSE;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (hour == -1) {
- gboolean allow_no_date_set = e_date_edit_get_allow_no_date_set (dedit);
- g_return_if_fail (allow_no_date_set);
- if (!priv->time_set_to_none) {
- priv->time_set_to_none = TRUE;
- time_changed = TRUE;
- }
- } else if (priv->time_set_to_none
- || priv->hour != hour
- || priv->minute != minute) {
- priv->time_set_to_none = FALSE;
- priv->hour = hour;
- priv->minute = minute;
- time_changed = TRUE;
- }
-
- e_date_edit_update_time_entry (dedit);
-
- if (time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-void
-e_date_edit_set_date_and_time_of_day (EDateEdit *dedit,
- gint year,
- gint month,
- gint day,
- gint hour,
- gint minute)
-{
- EDateEditPrivate *priv;
- gboolean date_changed, time_changed;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- date_changed = e_date_edit_set_date_internal (dedit, TRUE, FALSE,
- year - 1900, month - 1, day);
- time_changed = e_date_edit_set_time_internal (dedit, TRUE, FALSE,
- hour, minute);
-
- e_date_edit_update_date_entry (dedit);
- e_date_edit_update_time_entry (dedit);
- e_date_edit_update_time_combo_state (dedit);
-
- if (date_changed || time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-/**
- * e_date_edit_get_show_date:
- * @dedit: an #EDateEdit widget.
- * @Returns: Whether the date field is shown.
- *
- * Description: Returns TRUE if the date field is currently shown.
- */
-gboolean
-e_date_edit_get_show_date (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), TRUE);
-
- return dedit->priv->show_date;
-}
-
-
-/**
- * e_date_edit_set_show_date:
- * @dedit: an #EDateEdit widget.
- * @show_date: TRUE if the date field should be shown.
- *
- * Description: Specifies whether the date field should be shown. The date
- * field would be hidden if only a time needed to be entered.
- */
-void
-e_date_edit_set_show_date (EDateEdit *dedit,
- gboolean show_date)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (priv->show_date == show_date)
- return;
-
- priv->show_date = show_date;
-
- if (show_date) {
- gtk_widget_show (priv->date_entry);
- gtk_widget_show (priv->date_button);
- } else {
- gtk_widget_hide (priv->date_entry);
- gtk_widget_hide (priv->date_button);
- }
-
- e_date_edit_update_time_combo_state (dedit);
-
- if (priv->show_date
- && (priv->show_time || priv->make_time_insensitive))
- gtk_widget_show (priv->space);
- else
- gtk_widget_hide (priv->space);
-}
-
-
-/**
- * e_date_edit_get_show_time:
- * @dedit: an #EDateEdit widget
- * @Returns: Whether the time field is shown.
- *
- * Description: Returns TRUE if the time field is currently shown.
- */
-gboolean
-e_date_edit_get_show_time (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), TRUE);
-
- return dedit->priv->show_time;
-}
-
-
-/**
- * e_date_edit_set_show_time:
- * @dedit: an #EDateEdit widget
- * @show_time: TRUE if the time field should be shown.
- *
- * Description: Specifies whether the time field should be shown. The time
- * field would be hidden if only a date needed to be entered.
- */
-void
-e_date_edit_set_show_time (EDateEdit *dedit,
- gboolean show_time)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (priv->show_time == show_time)
- return;
-
- priv->show_time = show_time;
-
- e_date_edit_update_time_combo_state (dedit);
-}
-
-
-/**
- * e_date_edit_get_make_time_insensitive:
- * @dedit: an #EDateEdit widget
- * @Returns: Whether the time field is be made insensitive instead of hiding
- * it.
- *
- * Description: Returns TRUE if the time field is made insensitive instead of
- * hiding it.
- */
-gboolean
-e_date_edit_get_make_time_insensitive (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), TRUE);
-
- return dedit->priv->make_time_insensitive;
-}
-
-
-/**
- * e_date_edit_set_make_time_insensitive:
- * @dedit: an #EDateEdit widget
- * @make_insensitive: TRUE if the time field should be made insensitive instead
- * of hiding it.
- *
- * Description: Specifies whether the time field should be made insensitive
- * rather than hiding it. Note that this doesn't make it insensitive - you
- * need to call e_date_edit_set_show_time() with FALSE as show_time to do that.
- *
- * This is useful if you want to disable the time field, but don't want it to
- * disappear as that may affect the layout of the widgets.
- */
-void
-e_date_edit_set_make_time_insensitive (EDateEdit *dedit,
- gboolean make_insensitive)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (priv->make_time_insensitive == make_insensitive)
- return;
-
- priv->make_time_insensitive = make_insensitive;
-
- e_date_edit_update_time_combo_state (dedit);
-}
-
-
-/**
- * e_date_edit_get_week_start_day:
- * @dedit: an #EDateEdit widget
- * @Returns: the week start day, from 0 (Sunday) to 6 (Saturday).
- *
- * Description: Returns the week start day currently used in the calendar
- * popup.
- */
-gint
-e_date_edit_get_week_start_day (EDateEdit *dedit)
-{
- gint week_start_day;
-
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), 1);
-
- g_object_get (E_CALENDAR (dedit->priv->calendar)->calitem,
- "week_start_day", &week_start_day,
- NULL);
-
- return week_start_day;
-}
-
-
-/**
- * e_date_edit_set_week_start_day:
- * @dedit: an #EDateEdit widget
- * @week_start_day: the week start day, from 0 (Sunday) to 6 (Saturday).
- *
- * Description: Sets the week start day to use in the calendar popup.
- */
-void
-e_date_edit_set_week_start_day (EDateEdit *dedit,
- gint week_start_day)
-{
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
- "week_start_day", week_start_day,
- NULL);
-}
-
-
-/* Whether we show week numbers in the date popup. */
-gboolean
-e_date_edit_get_show_week_numbers (EDateEdit *dedit)
-{
- gboolean show_week_numbers;
-
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- g_object_get (E_CALENDAR (dedit->priv->calendar)->calitem,
- "show_week_numbers", &show_week_numbers,
- NULL);
-
- return show_week_numbers;
-}
-
-
-void
-e_date_edit_set_show_week_numbers (EDateEdit *dedit,
- gboolean show_week_numbers)
-{
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
- "show_week_numbers", show_week_numbers,
- NULL);
-}
-
-
-/* Whether we use 24 hour format in the time field & popup. */
-gboolean
-e_date_edit_get_use_24_hour_format (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), TRUE);
-
- return dedit->priv->use_24_hour_format;
-}
-
-
-void
-e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
- gboolean use_24_hour_format)
-{
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- if (dedit->priv->use_24_hour_format == use_24_hour_format)
- return;
-
- dedit->priv->use_24_hour_format = use_24_hour_format;
-
- rebuild_time_popup (dedit);
-
- e_date_edit_update_time_entry (dedit);
-}
-
-
-/* Whether we allow the date to be set to 'None'. e_date_edit_get_time() will
- return (time_t) -1 in this case. */
-gboolean
-e_date_edit_get_allow_no_date_set (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- return GTK_WIDGET_VISIBLE (dedit->priv->none_button);
-}
-
-
-void
-e_date_edit_set_allow_no_date_set (EDateEdit *dedit,
- gboolean allow_no_date_set)
-{
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- if (allow_no_date_set) {
- gtk_widget_show (dedit->priv->none_button);
- } else {
- gtk_widget_hide (dedit->priv->none_button);
-
- /* If the date is showing, we make sure it isn't 'None' (we
- don't really mind if the time is empty), else if just the
- time is showing we make sure it isn't 'None'. */
- if (dedit->priv->show_date) {
- if (dedit->priv->date_set_to_none)
- e_date_edit_set_time (dedit, 0);
- } else {
- if (dedit->priv->time_set_to_none)
- e_date_edit_set_time (dedit, 0);
- }
- }
-}
-
-
-/* The range of time to show in the time combo popup. */
-void
-e_date_edit_get_time_popup_range (EDateEdit *dedit,
- gint *lower_hour,
- gint *upper_hour)
-{
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- *lower_hour = dedit->priv->lower_hour;
- *upper_hour = dedit->priv->upper_hour;
-}
-
-
-void
-e_date_edit_set_time_popup_range (EDateEdit *dedit,
- gint lower_hour,
- gint upper_hour)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (priv->lower_hour == lower_hour
- && priv->upper_hour == upper_hour)
- return;
-
- priv->lower_hour = lower_hour;
- priv->upper_hour = upper_hour;
-
- rebuild_time_popup (dedit);
-
- /* Setting the combo list items seems to mess up the time entry, so
- we set it again. We have to reset it to its last valid time. */
- priv->time_is_valid = TRUE;
- e_date_edit_update_time_entry (dedit);
-}
-
-
-/* The arrow button beside the date field has been clicked, so we show the
- popup with the ECalendar in. */
-static void
-on_date_button_clicked (GtkWidget *widget,
- EDateEdit *dedit)
-{
- e_date_edit_show_date_popup (dedit);
-}
-
-
-static void
-e_date_edit_show_date_popup (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- ECalendar *calendar;
- struct tm mtm;
- const gchar *date_text;
- GDate selected_day;
- gboolean clear_selection = FALSE;
-
- priv = dedit->priv;
- calendar = E_CALENDAR (priv->calendar);
-
- date_text = gtk_entry_get_text (GTK_ENTRY (priv->date_entry));
- if (field_set_to_none (date_text)
- || !e_date_edit_parse_date (dedit, date_text, &mtm))
- clear_selection = TRUE;
-
- if (clear_selection) {
- e_calendar_item_set_selection (calendar->calitem, NULL, NULL);
- } else {
- g_date_clear (&selected_day, 1);
- g_date_set_dmy (&selected_day, mtm.tm_mday, mtm.tm_mon + 1,
- mtm.tm_year + 1900);
- e_calendar_item_set_selection (calendar->calitem,
- &selected_day, NULL);
- }
-
- /* FIXME: Hack. Change ECalendarItem so it doesn't queue signal
- emissions. */
- calendar->calitem->selection_changed = FALSE;
-
- position_date_popup (dedit);
- gtk_widget_show (priv->cal_popup);
- gtk_widget_grab_focus (priv->cal_popup);
- gtk_grab_add (priv->cal_popup);
- gdk_pointer_grab (priv->cal_popup->window, TRUE,
- (GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_POINTER_MOTION_MASK),
- NULL, NULL, GDK_CURRENT_TIME);
-}
-
-
-/* This positions the date popup below and to the left of the arrow button,
- just before it is shown. */
-static void
-position_date_popup (EDateEdit *dedit)
-{
- gint x, y;
- gint bwidth, bheight;
- GtkRequisition req;
- gint screen_width, screen_height;
-
- gtk_widget_size_request (dedit->priv->cal_popup, &req);
-
- gdk_window_get_origin (dedit->priv->date_button->window, &x, &y);
- gdk_window_get_size (dedit->priv->date_button->window,
- &bwidth, &bheight);
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- x += bwidth - req.width;
- y += bheight;
-
- x = CLAMP (x, 0, MAX (0, screen_width - req.width));
- y = CLAMP (y, 0, MAX (0, screen_height - req.height));
-
- gtk_widget_set_uposition (dedit->priv->cal_popup, x, y);
-}
-
-
-/* A date has been selected in the date popup, so we set the date field
- and hide the popup. */
-static void
-on_date_popup_date_selected (ECalendarItem *calitem,
- EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- GDate start_date, end_date;
-
- priv = dedit->priv;
-
- hide_date_popup (dedit);
-
- if (!e_calendar_item_get_selection (calitem, &start_date, &end_date))
- return;
-
- e_date_edit_set_date (dedit, g_date_year (&start_date),
- g_date_month (&start_date),
- g_date_day (&start_date));
-}
-
-
-static void
-on_date_popup_now_button_clicked (GtkWidget *button,
- EDateEdit *dedit)
-{
- hide_date_popup (dedit);
- e_date_edit_set_time (dedit, 0);
-}
-
-
-static void
-on_date_popup_today_button_clicked (GtkWidget *button,
- EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- struct tm tmp_tm;
- time_t t;
-
- priv = dedit->priv;
-
- hide_date_popup (dedit);
-
- if (priv->time_callback) {
- tmp_tm = (*priv->time_callback) (dedit, priv->time_callback_data);
- } else {
- t = time (NULL);
- tmp_tm = *localtime (&t);
- }
-
- e_date_edit_set_date (dedit, tmp_tm.tm_year + 1900,
- tmp_tm.tm_mon + 1, tmp_tm.tm_mday);
-}
-
-
-static void
-on_date_popup_none_button_clicked (GtkWidget *button,
- EDateEdit *dedit)
-{
- hide_date_popup (dedit);
- e_date_edit_set_time (dedit, -1);
-}
-
-
-/* A key has been pressed while the date popup is showing. If it is the Escape
- key we hide the popup. */
-static gint
-on_date_popup_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit)
-{
- if (event->keyval != GDK_Escape)
- return FALSE;
-
- g_signal_stop_emission_by_name (widget, "key_press_event");
- hide_date_popup (dedit);
-
- return TRUE;
-}
-
-
-/* A mouse button has been pressed while the date popup is showing.
- Any button press events used to select days etc. in the popup will have
- have been handled elsewhere, so here we just hide the popup.
- (This function is yanked from gtkcombo.c) */
-static gint
-on_date_popup_button_press (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- EDateEdit *dedit;
- GtkWidget *child;
-
- dedit = data;
-
- child = gtk_get_event_widget ((GdkEvent *) event);
-
- /* We don't ask for button press events on the grab widget, so
- * if an event is reported directly to the grab widget, it must
- * be on a window outside the application (and thus we remove
- * the popup window). Otherwise, we check if the widget is a child
- * of the grab widget, and only remove the popup window if it
- * is not.
- */
- if (child != widget) {
- while (child) {
- if (child == widget)
- return FALSE;
- child = child->parent;
- }
- }
-
- hide_date_popup (dedit);
-
- return TRUE;
-}
-
-
-/* A delete event has been received for the date popup, so we hide it and
- return TRUE so it doesn't get destroyed. */
-static gint
-on_date_popup_delete_event (GtkWidget *widget,
- EDateEdit *dedit)
-{
- hide_date_popup (dedit);
- return TRUE;
-}
-
-
-/* Hides the date popup, removing any grabs. */
-static void
-hide_date_popup (EDateEdit *dedit)
-{
- gtk_widget_hide (dedit->priv->cal_popup);
- gtk_grab_remove (dedit->priv->cal_popup);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-}
-
-
-/* Clears the time popup and rebuilds it using the lower_hour, upper_hour
- and use_24_hour_format settings. */
-static void
-rebuild_time_popup (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- GtkList *list;
- GtkWidget *listitem;
- char buffer[40], *format;
- struct tm tmp_tm;
- gint hour, min;
-
- priv = dedit->priv;
-
- list = GTK_LIST (GTK_COMBO (priv->time_combo)->list);
-
- gtk_list_clear_items (list, 0, -1);
-
- /* Fill the struct tm with some sane values. */
- tmp_tm.tm_year = 2000;
- tmp_tm.tm_mon = 0;
- tmp_tm.tm_mday = 1;
- tmp_tm.tm_sec = 0;
- tmp_tm.tm_isdst = 0;
-
- for (hour = priv->lower_hour; hour <= priv->upper_hour; hour++) {
-
- /* We don't want to display midnight at the end, since that is
- really in the next day. */
- if (hour == 24)
- break;
-
- /* We want to finish on upper_hour, with min == 0. */
- for (min = 0;
- min == 0 || (min < 60 && hour != priv->upper_hour);
- min += 30) {
- tmp_tm.tm_hour = hour;
- tmp_tm.tm_min = min;
-
- if (priv->use_24_hour_format)
- /* This is a strftime() format. %H = hour (0-23), %M = minute. */
- format = _("%H:%M");
- else
- /* This is a strftime() format. %I = hour (1-12), %M = minute, %p = am/pm string. */
- format = _("%I:%M %p");
-
- strftime (buffer, sizeof (buffer), format, &tmp_tm);
-
- listitem = gtk_list_item_new_with_label (buffer);
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (list), listitem);
- }
- }
-}
-
-
-static gboolean
-e_date_edit_parse_date (EDateEdit *dedit,
- const gchar *date_text,
- struct tm *date_tm)
-{
- if (e_time_parse_date (date_text, date_tm) != E_TIME_PARSE_OK)
- return FALSE;
-
- return TRUE;
-}
-
-
-static gboolean
-e_date_edit_parse_time (EDateEdit *dedit,
- const gchar *time_text,
- struct tm *time_tm)
-{
- if (field_set_to_none (time_text)) {
- time_tm->tm_hour = 0;
- time_tm->tm_min = 0;
- return TRUE;
- }
-
- if (e_time_parse_time (time_text, time_tm) != E_TIME_PARSE_OK)
- return FALSE;
-
- return TRUE;
-}
-
-
-/* Returns TRUE if the string is empty or is "None" in the current locale.
- It ignores whitespace. */
-static gboolean
-field_set_to_none (const char *text)
-{
- const char *pos;
- const char *none_string;
-
- pos = text;
- while (isspace (*pos))
- pos++;
-
- none_string = _("None");
-
- if (*pos == '\0' || !strncmp (pos, none_string, strlen (none_string)))
- return TRUE;
- return FALSE;
-}
-
-
-static void
-on_date_edit_time_selected (GtkList *list,
- EDateEdit *dedit)
-{
- GtkWidget *toplevel;
-
- /* We only want to emit signals when an item is selected explicitly,
- not when it is selected by the silly combo update thing. */
- if (!list->selection)
- return;
-
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (list));
- if (!GTK_WIDGET_MAPPED (toplevel))
- return;
-
- e_date_edit_check_time_changed (dedit);
-}
-
-
-static gint
-on_date_entry_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit)
-{
- if (event->state & GDK_MOD1_MASK
- && (event->keyval == GDK_Up || event->keyval == GDK_Down
- || event->keyval == GDK_Return)) {
- g_signal_stop_emission_by_name (widget,
- "key_press_event");
- e_date_edit_show_date_popup (dedit);
- return TRUE;
- }
-
- /* If the user hits the return key emit a "date_changed" signal if
- needed. But let the signal carry on. */
- if (event->keyval == GDK_Return) {
- e_date_edit_check_date_changed (dedit);
- return FALSE;
- }
-
- return FALSE;
-}
-
-
-static gint
-on_time_entry_key_press (GtkWidget *widget,
- GdkEventKey *event,
- EDateEdit *dedit)
-{
- /* I'd like to use Alt+Up/Down for popping up the list, like Win32,
- but the combo steals any Up/Down keys, so we use Alt+Return. */
-#if 0
- if (event->state & GDK_MOD1_MASK
- && (event->keyval == GDK_Up || event->keyval == GDK_Down)) {
-#else
- if (event->state & GDK_MOD1_MASK && event->keyval == GDK_Return) {
-#endif
- g_signal_stop_emission_by_name (widget,
- "key_press_event");
- g_signal_emit_by_name (GTK_COMBO (dedit->priv->time_combo)->entry, "activate", 0);
- return TRUE;
- }
-
- /* Stop the return key from emitting the activate signal, and check
- if we need to emit a "time_changed" signal. */
- if (event->keyval == GDK_Return) {
- g_signal_stop_emission_by_name (widget,
- "key_press_event");
- e_date_edit_check_time_changed (dedit);
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static gint
-on_date_entry_focus_out (GtkEntry *entry,
- GdkEventFocus *event,
- EDateEdit *dedit)
-{
- e_date_edit_check_date_changed (dedit);
- return FALSE;
-}
-
-
-static gint
-on_time_entry_focus_out (GtkEntry *entry,
- GdkEventFocus *event,
- EDateEdit *dedit)
-{
- e_date_edit_check_time_changed (dedit);
- return FALSE;
-}
-
-
-/* This sets the text in the date entry according to the current settings. */
-static void
-e_date_edit_update_date_entry (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- char buffer[40];
- struct tm tmp_tm = { 0 };
-
- priv = dedit->priv;
-
- if (priv->date_set_to_none || !priv->date_is_valid) {
- gtk_entry_set_text (GTK_ENTRY (priv->date_entry), _("None"));
- } else {
- tmp_tm.tm_year = priv->year;
- tmp_tm.tm_mon = priv->month;
- tmp_tm.tm_mday = priv->day;
- tmp_tm.tm_isdst = -1;
-
- /* This is a strftime() format for a short date. %m = month,
- %d = day of month, %Y = year (all digits). */
- strftime (buffer, sizeof (buffer), _("%m/%d/%Y"), &tmp_tm);
- gtk_entry_set_text (GTK_ENTRY (priv->date_entry), buffer);
- }
-}
-
-
-/* This sets the text in the time entry according to the current settings. */
-static void
-e_date_edit_update_time_entry (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- char buffer[40], *format;
- struct tm tmp_tm = { 0 };
-
- priv = dedit->priv;
-
- if (priv->time_set_to_none || !priv->time_is_valid) {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry), "");
- } else {
- /* Set these to reasonable values just in case. */
- tmp_tm.tm_year = 2000;
- tmp_tm.tm_mon = 0;
- tmp_tm.tm_mday = 1;
-
- tmp_tm.tm_hour = priv->hour;
- tmp_tm.tm_min = priv->minute;
-
- tmp_tm.tm_sec = 0;
- tmp_tm.tm_isdst = -1;
-
- if (priv->use_24_hour_format)
- /* This is a strftime() format. %H = hour (0-23), %M = minute. */
- format = _("%H:%M");
- else
- /* This is a strftime() format. %I = hour (1-12), %M = minute, %p = am/pm string. */
- format = _("%I:%M %p");
-
- strftime (buffer, sizeof (buffer), format, &tmp_tm);
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry),
- buffer);
- }
-}
-
-
-static void
-e_date_edit_update_time_combo_state (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- gboolean show = TRUE, show_now_button = TRUE;
- gboolean clear_entry = FALSE, sensitive = TRUE;
- const gchar *text;
-
- priv = dedit->priv;
-
- /* If the date entry is currently shown, and it is set to None,
- clear the time entry and disable the time combo. */
- if (priv->show_date && priv->date_set_to_none) {
- clear_entry = TRUE;
- sensitive = FALSE;
- }
-
- if (!priv->show_time) {
- if (priv->make_time_insensitive) {
- clear_entry = TRUE;
- sensitive = FALSE;
- } else {
- show = FALSE;
- }
-
- show_now_button = FALSE;
- }
-
- if (clear_entry) {
- /* Only clear it if it isn't empty already. */
- text = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry));
- if (text[0])
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry), "");
- }
-
- gtk_widget_set_sensitive (priv->time_combo, sensitive);
-
- if (show)
- gtk_widget_show (priv->time_combo);
- else
- gtk_widget_hide (priv->time_combo);
-
- if (show_now_button)
- gtk_widget_show (priv->now_button);
- else
- gtk_widget_hide (priv->now_button);
-
- if (priv->show_date
- && (priv->show_time || priv->make_time_insensitive))
- gtk_widget_show (priv->space);
- else
- gtk_widget_hide (priv->space);
-}
-
-
-/* Parses the date, and if it is different from the current settings it
- updates the settings and emits a "date_changed" signal. */
-static void
-e_date_edit_check_date_changed (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- const gchar *date_text;
- struct tm tmp_tm;
- gboolean none = FALSE, valid = TRUE, date_changed = FALSE;
-
- priv = dedit->priv;
-
- tmp_tm.tm_year = 0;
- tmp_tm.tm_mon = 0;
- tmp_tm.tm_mday = 0;
-
- date_text = gtk_entry_get_text (GTK_ENTRY (priv->date_entry));
- if (field_set_to_none (date_text)) {
- none = TRUE;
- } else if (!e_date_edit_parse_date (dedit, date_text, &tmp_tm)) {
- valid = FALSE;
- tmp_tm.tm_year = 0;
- tmp_tm.tm_mon = 0;
- tmp_tm.tm_mday = 0;
- }
-
-
- date_changed = e_date_edit_set_date_internal (dedit, valid, none,
- tmp_tm.tm_year,
- tmp_tm.tm_mon,
- tmp_tm.tm_mday);
-
- if (date_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-
-/* Parses the time, and if it is different from the current settings it
- updates the settings and emits a "time_changed" signal. */
-static void
-e_date_edit_check_time_changed (EDateEdit *dedit)
-{
- EDateEditPrivate *priv;
- const gchar *time_text;
- struct tm tmp_tm;
- gboolean none = FALSE, valid = TRUE, time_changed;
-
- priv = dedit->priv;
-
- tmp_tm.tm_hour = 0;
- tmp_tm.tm_min = 0;
-
- time_text = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry));
- if (field_set_to_none (time_text))
- none = TRUE;
- else if (!e_date_edit_parse_time (dedit, time_text, &tmp_tm))
- valid = FALSE;
-
- time_changed = e_date_edit_set_time_internal (dedit, valid, none,
- tmp_tm.tm_hour,
- tmp_tm.tm_min);
-
- if (time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
-}
-
-
-/**
- * e_date_edit_date_is_valid:
- * @dedit: an #EDateEdit widget.
- * @Returns: TRUE if the last date entered was valid.
- *
- * Returns TRUE if the last date entered was valid.
- *
- * Note that if this returns FALSE, you can still use e_date_edit_get_time()
- * or e_date_edit_get_date() to get the last time or date entered which was
- * valid.
- */
-gboolean
-e_date_edit_date_is_valid (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- if (!dedit->priv->date_is_valid)
- return FALSE;
-
- /* If the date is empty/None and that isn't permitted, return FALSE. */
- if (dedit->priv->date_set_to_none
- && !e_date_edit_get_allow_no_date_set (dedit))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * e_date_edit_time_is_valid:
- * @dedit: an #EDateEdit widget.
- * @Returns: TRUE if the last time entered was valid.
- *
- * Returns TRUE if the last time entered was valid.
- *
- * Note that if this returns FALSE, you can still use e_date_edit_get_time()
- * or e_date_edit_get_time_of_day() to get the last time or time of the day
- * entered which was valid.
- */
-gboolean
-e_date_edit_time_is_valid (EDateEdit *dedit)
-{
- g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
-
- if (!dedit->priv->time_is_valid)
- return FALSE;
-
- /* If the time is empty and that isn't permitted, return FALSE.
- Note that we don't mind an empty time if the date field is shown
- - in that case we just assume 0:00. */
- if (dedit->priv->time_set_to_none && !dedit->priv->show_date
- && !e_date_edit_get_allow_no_date_set (dedit))
- return FALSE;
-
- return TRUE;
-}
-
-
-static gboolean
-e_date_edit_set_date_internal (EDateEdit *dedit,
- gboolean valid,
- gboolean none,
- gint year,
- gint month,
- gint day)
-{
- EDateEditPrivate *priv;
- gboolean date_changed = FALSE;
-
- priv = dedit->priv;
-
- if (!valid) {
- /* Date is invalid. */
- if (priv->date_is_valid) {
- priv->date_is_valid = FALSE;
- date_changed = TRUE;
- }
- } else if (none) {
- /* Date has been set to 'None'. */
- if (!priv->date_is_valid
- || !priv->date_set_to_none) {
- priv->date_is_valid = TRUE;
- priv->date_set_to_none = TRUE;
- date_changed = TRUE;
- }
- } else {
- /* Date has been set to a specific date. */
- if (!priv->date_is_valid
- || priv->date_set_to_none
- || priv->year != year
- || priv->month != month
- || priv->day != day) {
- priv->date_is_valid = TRUE;
- priv->date_set_to_none = FALSE;
- priv->year = year;
- priv->month = month;
- priv->day = day;
- date_changed = TRUE;
- }
- }
-
- return date_changed;
-}
-
-
-static gboolean
-e_date_edit_set_time_internal (EDateEdit *dedit,
- gboolean valid,
- gboolean none,
- gint hour,
- gint minute)
-{
- EDateEditPrivate *priv;
- gboolean time_changed = FALSE;
-
- priv = dedit->priv;
-
- if (!valid) {
- /* Time is invalid. */
- if (priv->time_is_valid) {
- priv->time_is_valid = FALSE;
- time_changed = TRUE;
- }
- } else if (none) {
- /* Time has been set to empty/'None'. */
- if (!priv->time_is_valid
- || !priv->time_set_to_none) {
- priv->time_is_valid = TRUE;
- priv->time_set_to_none = TRUE;
- time_changed = TRUE;
- }
- } else {
- /* Time has been set to a specific time. */
- if (!priv->time_is_valid
- || priv->time_set_to_none
- || priv->hour != hour
- || priv->minute != minute) {
- priv->time_is_valid = TRUE;
- priv->time_set_to_none = FALSE;
- priv->hour = hour;
- priv->minute = minute;
- time_changed = TRUE;
- }
- }
-
- return time_changed;
-}
-
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void
-e_date_edit_set_get_time_callback (EDateEdit *dedit,
- EDateEditGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- EDateEditPrivate *priv;
-
- g_return_if_fail (E_IS_DATE_EDIT (dedit));
-
- priv = dedit->priv;
-
- if (priv->time_callback_data && priv->time_callback_destroy)
- (*priv->time_callback_destroy) (priv->time_callback_data);
-
- priv->time_callback = cb;
- priv->time_callback_data = data;
- priv->time_callback_destroy = destroy;
-
-}
-
diff --git a/widgets/misc/e-dateedit.h b/widgets/misc/e-dateedit.h
deleted file mode 100644
index 1fa14b95c8..0000000000
--- a/widgets/misc/e-dateedit.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * Based on the GnomeDateEdit, part of the Gnome Library.
- * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EDateEdit - a widget based on GnomeDateEdit to provide a date & optional
- * time field with popups for entering a date.
- *
- * It emits a "changed" signal when the date and/or time has changed.
- * You can check if the last date or time entered was invalid by
- * calling e_date_edit_date_is_valid() and e_date_edit_time_is_valid().
- *
- * Note that when the user types in a date or time, it will only emit the
- * signals when the user presses the return key or switches the keyboard
- * focus to another widget, or you call one of the _get_time/date functions.
- */
-
-#ifndef __E_DATE_EDIT_H_
-#define __E_DATE_EDIT_H_
-
-#include <time.h>
-#include <glib.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkwidget.h>
-
-#define E_TYPE_DATE_EDIT (e_date_edit_get_type ())
-#define E_DATE_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DATE_EDIT, EDateEdit))
-#define E_DATE_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DATE_EDIT, EDateEditClass))
-#define E_IS_DATE_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DATE_EDIT))
-#define E_IS_DATE_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DATE_EDIT))
-
-typedef struct _EDateEdit EDateEdit;
-typedef struct _EDateEditPrivate EDateEditPrivate;
-typedef struct _EDateEditClass EDateEditClass;
-
-/* The type of the callback function optionally used to get the current time.
- */
-typedef struct tm (*EDateEditGetTimeCallback) (EDateEdit *dedit,
- gpointer data);
-
-struct _EDateEdit {
- GtkHBox hbox;
-
- /*< private >*/
- EDateEditPrivate *priv;
-};
-
-struct _EDateEditClass {
- GtkHBoxClass parent_class;
-
- void (* changed) (EDateEdit *dedit);
-};
-
-GType e_date_edit_get_type (void);
-GtkWidget* e_date_edit_new (void);
-
-/* Analogous to gtk_entry_set_editable. disable editing, while still
- allowing selection. */
-void e_date_edit_set_editable (EDateEdit *dedit, gboolean editable);
-
-/* Returns TRUE if the last date and time set were valid. The date and time
- are only set when the user hits Return or switches keyboard focus, or
- selects a date or time from the popup. */
-gboolean e_date_edit_date_is_valid (EDateEdit *dedit);
-gboolean e_date_edit_time_is_valid (EDateEdit *dedit);
-
-/* Returns the last valid date & time set, or -1 if the date & time was set to
- 'None' and this is permitted via e_date_edit_set_allow_no_date_set. */
-time_t e_date_edit_get_time (EDateEdit *dedit);
-void e_date_edit_set_time (EDateEdit *dedit,
- time_t the_time);
-
-/* This returns the last valid date set, without the time. It returns TRUE
- if a date is set, or FALSE if the date is set to 'None' and this is
- permitted via e_date_edit_set_allow_no_date_set. (Month is 1 - 12). */
-gboolean e_date_edit_get_date (EDateEdit *dedit,
- gint *year,
- gint *month,
- gint *day);
-void e_date_edit_set_date (EDateEdit *dedit,
- gint year,
- gint month,
- gint day);
-
-/* This returns the last valid time set, without the date. It returns TRUE
- if a time is set, or FALSE if the time is set to 'None' and this is
- permitted via e_date_edit_set_allow_no_date_set. */
-gboolean e_date_edit_get_time_of_day (EDateEdit *dedit,
- gint *hour,
- gint *minute);
-/* Set the time. Pass -1 as hour to set to empty. */
-void e_date_edit_set_time_of_day (EDateEdit *dedit,
- gint hour,
- gint minute);
-
-void e_date_edit_set_date_and_time_of_day (EDateEdit *dedit,
- gint year,
- gint month,
- gint day,
- gint hour,
- gint minute);
-
-/* Whether we show the date field. */
-gboolean e_date_edit_get_show_date (EDateEdit *dedit);
-void e_date_edit_set_show_date (EDateEdit *dedit,
- gboolean show_date);
-
-/* Whether we show the time field. */
-gboolean e_date_edit_get_show_time (EDateEdit *dedit);
-void e_date_edit_set_show_time (EDateEdit *dedit,
- gboolean show_time);
-
-/* The week start day, used in the date popup. 0 (Mon) to 6 (Sun). */
-gint e_date_edit_get_week_start_day (EDateEdit *dedit);
-void e_date_edit_set_week_start_day (EDateEdit *dedit,
- gint week_start_day);
-
-/* Whether we show week numbers in the date popup. */
-gboolean e_date_edit_get_show_week_numbers (EDateEdit *dedit);
-void e_date_edit_set_show_week_numbers (EDateEdit *dedit,
- gboolean show_week_numbers);
-
-/* Whether we use 24 hour format in the time field & popup. */
-gboolean e_date_edit_get_use_24_hour_format (EDateEdit *dedit);
-void e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
- gboolean use_24_hour_format);
-
-/* Whether we allow the date to be set to 'None'. e_date_edit_get_time() will
- return (time_t) -1 in this case. */
-gboolean e_date_edit_get_allow_no_date_set (EDateEdit *dedit);
-void e_date_edit_set_allow_no_date_set (EDateEdit *dedit,
- gboolean allow_no_date_set);
-
-/* The range of time to show in the time combo popup. */
-void e_date_edit_get_time_popup_range (EDateEdit *dedit,
- gint *lower_hour,
- gint *upper_hour);
-void e_date_edit_set_time_popup_range (EDateEdit *dedit,
- gint lower_hour,
- gint upper_hour);
-
-/* Whether the time field is made insensitive rather than hiding it. */
-gboolean e_date_edit_get_make_time_insensitive(EDateEdit *dedit);
-void e_date_edit_set_make_time_insensitive(EDateEdit *dedit,
- gboolean make_insensitive);
-
-
-/* Sets a callback to use to get the current time. This is useful if the
- application needs to use its own timezone data rather than rely on the
- Unix timezone. */
-void e_date_edit_set_get_time_callback (EDateEdit *dedit,
- EDateEditGetTimeCallback cb,
- gpointer data,
- GtkDestroyNotify destroy);
-
-#endif
diff --git a/widgets/misc/e-dropdown-button.c b/widgets/misc/e-dropdown-button.c
deleted file mode 100644
index 6ccbda5783..0000000000
--- a/widgets/misc/e-dropdown-button.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-dropdown-menu.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-dropdown-button.h"
-
-
-#include <stdio.h>
-#include <gtk/gtkarrow.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkwidget.h>
-#include <libgnomeui/gnome-popup-menu.h>
-#include <gal/util/e-util.h>
-
-
-struct _EDropdownButtonPrivate {
- GtkAccelGroup *accel_group;
- GtkWidget *menu;
-};
-
-#define PARENT_TYPE gtk_toggle_button_get_type ()
-static GtkToggleButtonClass *parent_class = NULL;
-
-
-/* Callback to position the pop-up menu. */
-
-static void
-menu_position_cb (GtkMenu *menu,
- int *x,
- int *y,
- gboolean *push_in,
- void *data)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
- GtkRequisition menu_requisition;
- int max_x, max_y;
-
- dropdown_button = E_DROPDOWN_BUTTON (data);
- priv = dropdown_button->priv;
-
- /* Calculate our preferred position. */
- gdk_window_get_origin (GTK_WIDGET (dropdown_button)->window, x, y);
- *y += GTK_WIDGET (dropdown_button)->allocation.height;
-
- /* Now make sure we are on the screen. */
- gtk_widget_size_request (GTK_WIDGET (priv->menu), &menu_requisition);
- max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
- max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
-
- *x = CLAMP (*x, 0, max_x);
- *y = CLAMP (*y, 0, max_y);
-}
-
-/* Callback for the "deactivate" signal on the pop-up menu. This is used so
- that we unset the state of the toggle button when the pop-up menu
- disappears. */
-
-static int
-menu_deactivate_cb (GtkMenuShell *menu_shell,
- void *data)
-{
- EDropdownButton *dropdown_button;
-
- puts (__FUNCTION__);
-
- dropdown_button = E_DROPDOWN_BUTTON (data);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dropdown_button), FALSE);
- return TRUE;
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_destroy (GtkObject *object)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
-
- dropdown_button = E_DROPDOWN_BUTTON (object);
- priv = dropdown_button->priv;
-
- gtk_accel_group_unref (priv->accel_group);
- gtk_widget_destroy (priv->menu);
-
- g_free (priv);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static void
-impl_toggled (GtkToggleButton *toggle_button)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
-
- if (parent_class->toggled)
- parent_class->toggled (toggle_button);
-
- dropdown_button = E_DROPDOWN_BUTTON (toggle_button);
- priv = dropdown_button->priv;
-
- if (toggle_button->active) {
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_cb, dropdown_button,
- 1, GDK_CURRENT_TIME);
- } else {
- gtk_menu_popdown (GTK_MENU (priv->menu));
- }
-}
-
-
-static void
-class_init (EDropdownButtonClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkToggleButtonClass *toggle_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
- toggle_class = GTK_TOGGLE_BUTTON_CLASS (klass);
-
- object_class->destroy = impl_destroy;
- toggle_class->toggled = impl_toggled;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-}
-
-
-static void
-init (EDropdownButton *dropdown_button)
-{
- EDropdownButtonPrivate *priv;
-
- priv = g_new (EDropdownButtonPrivate, 1);
- priv->accel_group = gtk_accel_group_new ();
- priv->menu = NULL;
-
- dropdown_button->priv = priv;
-}
-
-
-/**
- * e_dropdown_button_construct:
- * @dropdown_button: A pointer to an %EDropdownButton object
- * @label_text: Text to display in the button
- * @menu: The menu to pop up when the button is pressed
- *
- * Construct the @dropdown_button with the specified @label_text and the
- * associated @menu.
- **/
-void
-e_dropdown_button_construct (EDropdownButton *dropdown_button,
- const char *label_text,
- GtkMenu *menu)
-{
- EDropdownButtonPrivate *priv;
- GtkWidget *hbox;
- GtkWidget *arrow;
- GtkWidget *label;
- unsigned int accel_key;
-
- g_return_if_fail (dropdown_button != NULL);
- g_return_if_fail (E_IS_DROPDOWN_BUTTON (dropdown_button));
- g_return_if_fail (label_text != NULL);
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- priv = dropdown_button->priv;
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (dropdown_button), hbox);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label), label_text);
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
- gtk_widget_add_accelerator (GTK_WIDGET (dropdown_button), "clicked",
- priv->accel_group, accel_key, GDK_MOD1_MASK, 0);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 2);
- gtk_widget_show (arrow);
-
- priv->menu = GTK_WIDGET (menu);
-
- gtk_signal_connect_while_alive (GTK_OBJECT (priv->menu), "deactivate",
- G_CALLBACK (menu_deactivate_cb),
- dropdown_button, GTK_OBJECT (dropdown_button));
-}
-
-/**
- * e_dropdown_button_new:
- * @label_text: Text to display in the button
- * @menu: The menu to pop up when the button is pressed
- *
- * Create a new dropdown button. When the button is clicked, the specified
- * @menu will be popped up.
- *
- * Return value: A pointer to the newly created %EDropdownButton.
- **/
-GtkWidget *
-e_dropdown_button_new (const char *label_text,
- GtkMenu *menu)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (label_text != NULL, NULL);
- g_return_val_if_fail (menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
- widget = gtk_type_new (e_dropdown_button_get_type ());
-
- e_dropdown_button_construct (E_DROPDOWN_BUTTON (widget), label_text, menu);
- return widget;
-}
-
-
-E_MAKE_TYPE (e_dropdown_button, "EDropdownButton", EDropdownButton, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-dropdown-button.h b/widgets/misc/e-dropdown-button.h
deleted file mode 100644
index f0e6257b0f..0000000000
--- a/widgets/misc/e-dropdown-button.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-dropdown-menu.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef _E_DROPDOWN_BUTTON_H_
-#define _E_DROPDOWN_BUTTON_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkmenu.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_DROPDOWN_BUTTON (e_dropdown_button_get_type ())
-#define E_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DROPDOWN_BUTTON, EDropdownButton))
-#define E_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DROPDOWN_BUTTON, EDropdownButtonClass))
-#define E_IS_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON))
-#define E_IS_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON))
-
-
-typedef struct _EDropdownButton EDropdownButton;
-typedef struct _EDropdownButtonPrivate EDropdownButtonPrivate;
-typedef struct _EDropdownButtonClass EDropdownButtonClass;
-
-struct _EDropdownButton {
- GtkToggleButton parent;
-
- EDropdownButtonPrivate *priv;
-};
-
-struct _EDropdownButtonClass {
- GtkToggleButtonClass parent_class;
-};
-
-
-GtkType e_dropdown_button_get_type (void);
-void e_dropdown_button_construct (EDropdownButton *dropdown_button,
- const char *label_text,
- GtkMenu *menu);
-GtkWidget *e_dropdown_button_new (const char *label_text,
- GtkMenu *menu);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_DROPDOWN_BUTTON_H_ */
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
deleted file mode 100644
index 28ac335273..0000000000
--- a/widgets/misc/e-filter-bar.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-search-bar.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-
-#include "e-dropdown-button.h"
-#include "e-filter-bar.h"
-#include "filter/rule-editor.h"
-
-#define d(x)
-
-enum {
- LAST_SIGNAL
-};
-
-/*static gint esb_signals [LAST_SIGNAL] = { 0, };*/
-
-static ESearchBarClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_QUERY,
-};
-
-
-/* Callbacks. */
-
-static void rule_changed (FilterRule *rule, gpointer user_data);
-
-
-/* rule editor thingy */
-static void
-rule_editor_destroyed (GtkWidget *w, EFilterBar *efb)
-{
- efb->save_dialogue = NULL;
- e_search_bar_set_menu_sensitive (E_SEARCH_BAR (efb), E_FILTERBAR_SAVE_ID, TRUE);
- gtk_widget_set_sensitive (E_SEARCH_BAR (efb)->entry, TRUE);
-}
-
-/* FIXME: need to update the popup menu to match any edited rules, sigh */
-static void
-full_rule_editor_clicked (GtkWidget *dialog, int button, void *data)
-{
- EFilterBar *efb = data;
-
- switch (button) {
- case 0:
- rule_context_save (efb->context, efb->userrules);
- case 1:
- default:
- gnome_dialog_close (GNOME_DIALOG (dialog));
- case -1:
- break;
- }
-}
-
-static void
-rule_editor_clicked (GtkWidget *dialog, int button, void *data)
-{
- EFilterBar *efb = data;
- FilterRule *rule;
-
- switch (button) {
- case 0:
- rule = g_object_get_data (G_OBJECT (dialog), "rule");
- if (rule) {
- if (!filter_rule_validate (rule))
- return;
-
- rule_context_add_rule (efb->context, rule);
- /* FIXME: check return */
- rule_context_save (efb->context, efb->userrules);
- }
- case 1:
- gnome_dialog_close (GNOME_DIALOG (dialog));
- case -1:
- break;
- }
-}
-
-static void
-rule_advanced_clicked (GtkWidget *dialog, int button, void *data)
-{
- EFilterBar *efb = data;
- FilterRule *rule;
-
- switch (button) {
- case 0: /* 'ok' */
- case 1:
- rule = g_object_get_data (G_OBJECT (dialog), "rule");
- if (rule) {
- efb->current_query = rule;
- g_object_ref (rule);
- g_signal_emit_by_name (efb, "query_changed");
- }
- if (button == 1)
- rule_editor_clicked (dialog, 0, data);
- case 2:
- gnome_dialog_close (GNOME_DIALOG (dialog));
- case -1:
- break;
- }
-}
-
-static void
-do_advanced (ESearchBar *esb)
-{
- EFilterBar *efb = (EFilterBar *)esb;
-
- d(printf("Advanced search!\n"));
-
- if (!efb->save_dialogue && !efb->setquery) {
- GtkWidget *w, *gd;
- FilterRule *rule;
-
- if (efb->current_query)
- rule = filter_rule_clone (efb->current_query);
- else
- rule = filter_rule_new ();
-
- w = filter_rule_get_widget (rule, efb->context);
- filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
- gd = gnome_dialog_new (_("Advanced Search"),
- GNOME_STOCK_BUTTON_OK,
- _("Save"),
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- efb->save_dialogue = gd;
- gnome_dialog_set_default (GNOME_DIALOG (gd), 0);
-
- gtk_window_set_policy (GTK_WINDOW (gd), FALSE, TRUE, FALSE);
- gtk_window_set_default_size (GTK_WINDOW (gd), 600, 300);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (gd)->vbox), w, TRUE, TRUE, 0);
- gtk_widget_show (gd);
- g_object_ref (rule);
- g_object_set_data_full (G_OBJECT (gd), "rule", rule, (GDestroyNotify) g_object_unref);
-
- g_signal_connect (gd, "clicked", G_CALLBACK (rule_advanced_clicked), efb);
- g_signal_connect (gd, "destroy", G_CALLBACK (rule_editor_destroyed), efb);
-
- e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
- gtk_widget_set_sensitive (esb->entry, FALSE);
-
- gtk_widget_show (gd);
- }
-}
-
-static void
-menubar_activated (ESearchBar *esb, int id, void *data)
-{
- EFilterBar *efb = (EFilterBar *)esb;
-
- switch (id) {
- case E_FILTERBAR_EDIT_ID:
- if (!efb->save_dialogue) {
- GnomeDialog *gd;
-
- gd = (GnomeDialog *) rule_editor_new (efb->context, FILTER_SOURCE_INCOMING);
- efb->save_dialogue = (GtkWidget *) gd;
- gtk_window_set_title (GTK_WINDOW (gd), _("Search Editor"));
- g_signal_connect (gd, "clicked", G_CALLBACK (full_rule_editor_clicked), efb);
- g_signal_connect (gd, "destroy", G_CALLBACK (rule_editor_destroyed), efb);
- gtk_widget_show (GTK_WIDGET (gd));
- }
- break;
- case E_FILTERBAR_SAVE_ID:
- if (efb->current_query && !efb->save_dialogue) {
- GtkWidget *w;
- GtkWidget *gd;
- FilterRule *rule;
- char *name, *text;
-
- rule = filter_rule_clone (efb->current_query);
- text = e_search_bar_get_text(esb);
- name = g_strdup_printf("%s %s", rule->name, text&&text[0]?text:"''");
- g_free(text);
- filter_rule_set_name(rule, name);
- g_free(name);
-
- w = filter_rule_get_widget (rule, efb->context);
- filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
- gd = gnome_dialog_new (_("Save Search"), GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
- efb->save_dialogue = gd;
- gnome_dialog_set_default (GNOME_DIALOG (gd), 0);
- gtk_window_set_default_size (GTK_WINDOW (gd), 600, 300);
- gtk_window_set_policy (GTK_WINDOW (gd), FALSE, TRUE, FALSE);
-
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (gd)->vbox), w, TRUE, TRUE, 0);
- gtk_widget_show (gd);
- g_object_ref (rule);
- g_object_set_data_full (G_OBJECT (gd), "rule", rule, (GDestroyNotify) g_object_unref);
- g_signal_connect (gd, "clicked", G_CALLBACK (rule_editor_clicked), efb);
- g_signal_connect (gd, "destroy", G_CALLBACK (rule_editor_destroyed), efb);
-
- e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
- gtk_widget_set_sensitive (esb->entry, FALSE);
-
- gtk_widget_show (gd);
- }
-
- d(printf("Save menu\n"));
- break;
- case E_FILTERBAR_ADVANCED_ID:
- e_search_bar_set_item_id (esb, E_FILTERBAR_ADVANCED_ID);
- break;
- default:
- if (id >= efb->menu_base && id < efb->menu_base + efb->menu_rules->len) {
- GString *out = g_string_new ("");
- d(printf("Selected rule: %s\n", ((FilterRule *)efb->menu_rules->pdata[id - efb->menu_base])->name));
- filter_rule_build_code (efb->menu_rules->pdata[id - efb->menu_base], out);
- d(printf("query: '%s'\n", out->str));
- g_string_free (out, TRUE);
-
- efb->current_query = (FilterRule *)efb->menu_rules->pdata[id - efb->menu_base];
- efb->setquery = TRUE;
-
- e_search_bar_set_item_id (esb, E_FILTERBAR_ADVANCED_ID);
-
- gtk_widget_set_sensitive (esb->entry, FALSE);
- } else {
- gtk_widget_set_sensitive (esb->entry, TRUE);
- return;
- }
- }
-
- g_signal_stop_emission_by_name((esb), "menu_activated");
-}
-
-static void
-option_changed (ESearchBar *esb, void *data)
-{
- EFilterBar *efb = (EFilterBar *)esb;
- int id = e_search_bar_get_item_id (esb);
- char *query;
-
- d(printf("option changed, id = %d\n", id));
-
- switch (id) {
- case E_FILTERBAR_ADVANCED_ID:
- do_advanced(esb);
- break;
- default:
- if (id >= efb->option_base && id < efb->option_base + efb->option_rules->len) {
- efb->current_query = (FilterRule *)efb->option_rules->pdata[id - efb->option_base];
- if (efb->config) {
- g_object_get (G_OBJECT (esb), "text", &query, NULL);
- efb->config (efb, efb->current_query, id, query, efb->config_data);
- g_free (query);
- }
- gtk_widget_set_sensitive (esb->entry, TRUE);
- } else {
- gtk_widget_set_sensitive (esb->entry, id == E_SEARCHBAR_CLEAR_ID);
- efb->current_query = NULL;
- }
- }
- efb->setquery = FALSE;
-}
-
-static void
-dup_item_no_subitems (ESearchBarItem *dest,
- const ESearchBarItem *src)
-{
- g_assert (src->subitems == NULL);
-
- dest->id = src->id;
- dest->text = g_strdup (src->text);
- dest->subitems = NULL;
-}
-
-static GArray *
-build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrArray *rules)
-{
- FilterRule *rule = NULL;
- EFilterBar *efb = (EFilterBar *)esb;
- int id = 0, i;
- GArray *menu = g_array_new (FALSE, FALSE, sizeof (ESearchBarItem));
- ESearchBarItem item;
- char *source;
- GSList *gtksux = NULL;
- int num;
-
- /* So gtk calls a signal again if you connect to it WHILE inside a changed event.
- So this snot is to work around that shit fucked up situation */
- for (i=0;i<rules->len;i++)
- gtksux = g_slist_prepend(gtksux, rules->pdata[i]);
-
- g_ptr_array_set_size(rules, 0);
-
- /* find a unique starting point for the id's of our items */
- for (i = 0; items[i].id != -1; i++) {
- ESearchBarItem dup_item;
-
- if (items[i].id >= id)
- id = items[i].id + 1;
-
- dup_item_no_subitems (&dup_item, items + i);
- g_array_append_vals (menu, &dup_item, 1);
- }
-
- *start = id;
-
- if (type == 0) {
- source = FILTER_SOURCE_INCOMING;
-
- /* Add a separator if there is at least one custom rule. */
- if (rule_context_next_rule (efb->context, rule, source) != NULL) {
- item.id = 0;
- item.text = NULL;
- item.subitems = NULL;
- g_array_append_vals (menu, &item, 1);
- }
- } else {
- source = FILTER_SOURCE_DEMAND;
- }
-
- num = 1;
- while ((rule = rule_context_next_rule (efb->context, rule, source))) {
- item.id = id++;
-
- if (type == 0 && num <= 10) {
- item.text = g_strdup_printf ("_%d. %s", num % 10, rule->name);
- num ++;
- } else {
- item.text = g_strdup (rule->name);
- }
-
- item.subitems = NULL;
- g_array_append_vals (menu, &item, 1);
-
- if (g_slist_find(gtksux, rule) == NULL) {
- g_object_ref (rule);
- g_signal_connect (rule, "changed", G_CALLBACK (rule_changed), efb);
- } else {
- gtksux = g_slist_remove(gtksux, rule);
- }
- g_ptr_array_add (rules, rule);
- }
-
- /* anything elft in gtksux has gone away, and we need to unref/disconnect from it */
- while (gtksux) {
- GSList *next;
-
- next = gtksux->next;
- rule = gtksux->data;
-
- g_signal_handlers_disconnect_by_func (rule, G_CALLBACK (rule_changed), efb);
- g_object_unref (rule);
-
- g_slist_free_1(gtksux);
- gtksux = next;
- }
-
- /* always add on the advanced menu */
- if (type == 1) {
- ESearchBarItem items[2] = { E_FILTERBAR_SEPARATOR, E_FILTERBAR_ADVANCED };
- ESearchBarItem dup_items[2];
-
- dup_item_no_subitems (&dup_items[0], &items[0]);
- dup_item_no_subitems (&dup_items[1], &items[1]);
- g_array_append_vals (menu, &dup_items, 2);
- }
-
- item.id = -1;
- item.text = NULL;
- item.subitems = NULL;
- g_array_append_vals (menu, &item, 1);
-
- return menu;
-}
-
-static void
-free_built_items (GArray *menu)
-{
- int i;
-
- for (i = 0; i < menu->len; i ++) {
- ESearchBarItem *item;
-
- item = & g_array_index (menu, ESearchBarItem, i);
- g_free (item->text);
-
- g_assert (item->subitems == NULL);
- }
-
- g_array_free (menu, TRUE);
-}
-
-static void
-generate_menu (ESearchBar *esb, ESearchBarItem *items)
-{
- EFilterBar *efb = (EFilterBar *)esb;
- GArray *menu;
-
- menu = build_items (esb, items, 0, &efb->menu_base, efb->menu_rules);
- ((ESearchBarClass *)parent_class)->set_menu (esb, (ESearchBarItem *)menu->data);
- free_built_items (menu);
-}
-
-static ESearchBarSubitem *
-copy_subitems (ESearchBarSubitem *subitems)
-{
- ESearchBarSubitem *items;
- int i, num;
-
- for (num = 0; subitems[num].id != -1; num++)
- ;
-
- items = g_new (ESearchBarSubitem, num + 1);
- for (i = 0; i < num + 1; i++) {
- items[i].text = g_strdup (subitems[i].text);
- items[i].id = subitems[i].id;
- items[i].translate = subitems[i].translate;
- }
-
- return items;
-}
-
-static void
-free_items (ESearchBarItem *items)
-{
- int i, j;
-
- for (i = 0; items[i].id != -1; i++) {
- g_free (items[i].text);
- if (items[i].subitems) {
- for (j = 0; items[i].subitems[j].id != -1; j++)
- g_free (items[i].subitems[j].text);
-
- g_free (items[i].subitems);
- }
- }
-
- g_free (items);
-}
-
-/* Virtual methods */
-static void
-set_menu (ESearchBar *esb, ESearchBarItem *items)
-{
- EFilterBar *efb = E_FILTER_BAR (esb);
- ESearchBarItem *default_items;
- int i, num;
-
- if (efb->default_items)
- free_items (efb->default_items);
-
- for (num = 0; items[num].id != -1; num++)
- ;
-
- default_items = g_new (ESearchBarItem, num + 1);
- for (i = 0; i < num + 1; i++) {
- default_items[i].text = g_strdup (items[i].text);
- default_items[i].id = items[i].id;
- if (items[i].subitems)
- default_items[i].subitems = copy_subitems (items[i].subitems);
- else
- default_items[i].subitems = NULL;
- }
-
- efb->default_items = default_items;
-
- generate_menu (esb, default_items);
-}
-
-static void
-set_option (ESearchBar *esb, ESearchBarItem *items)
-{
- GArray *menu;
- EFilterBar *efb = (EFilterBar *)esb;
-
- menu = build_items (esb, items, 1, &efb->option_base, efb->option_rules);
- ((ESearchBarClass *)parent_class)->set_option (esb, (ESearchBarItem *)menu->data);
- free_built_items (menu);
-
- e_search_bar_set_item_id (esb, efb->option_base);
-}
-
-static void
-context_changed (RuleContext *context, gpointer user_data)
-{
- EFilterBar *efb = E_FILTER_BAR (user_data);
- ESearchBar *esb = E_SEARCH_BAR (user_data);
-
- generate_menu (esb, efb->default_items);
-}
-
-static void
-context_rule_removed (RuleContext *context, FilterRule *rule, gpointer user_data)
-{
- /*gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, efb);*/
-}
-
-static void
-rule_changed (FilterRule *rule, gpointer user_data)
-{
- EFilterBar *efb = E_FILTER_BAR (user_data);
- ESearchBar *esb = E_SEARCH_BAR (user_data);
-
- /* just generate whole menu again */
- generate_menu (esb, efb->default_items);
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EFilterBar *efb = E_FILTER_BAR(object);
-
- switch (arg_id) {
- case ARG_QUERY:
- if (efb->current_query) {
- GString *out = g_string_new ("");
-
- filter_rule_build_code (efb->current_query, out);
- GTK_VALUE_STRING (*arg) = out->str;
- g_string_free (out, FALSE);
- } else {
- GTK_VALUE_STRING (*arg) = NULL;
- }
- break;
- }
-}
-
-static void clear_rules(EFilterBar *efb, GPtrArray *rules)
-{
- int i;
- FilterRule *rule;
-
- /* clear out any data on old rules */
- for (i=0;i<rules->len;i++) {
- rule = rules->pdata[i];
- g_signal_handlers_disconnect_by_func (rule, G_CALLBACK (rule_changed), efb);
- g_object_unref(rule);
- }
- g_ptr_array_set_size (rules, 0);
-}
-
-static void
-dispose (GObject *object)
-{
- EFilterBar *bar;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_FILTER_BAR (object));
-
- bar = E_FILTER_BAR (object);
-
- if (bar->menu_rules != NULL) {
- clear_rules(bar, bar->menu_rules);
- clear_rules(bar, bar->option_rules);
-
- g_ptr_array_free (bar->menu_rules, TRUE);
- g_ptr_array_free (bar->option_rules, TRUE);
-
- g_free (bar->systemrules);
- g_free (bar->userrules);
-
- bar->menu_rules = NULL;
- bar->option_rules = NULL;
- bar->systemrules = NULL;
- bar->userrules = NULL;
- }
-
- if (bar->context != NULL) {
- g_signal_handlers_disconnect_by_func (bar->context, G_CALLBACK (context_changed), bar);
- g_signal_handlers_disconnect_by_func (bar->context, G_CALLBACK (context_rule_removed), bar);
-
- g_object_unref (bar->context);
- bar->context = NULL;
- }
-
- if (bar->default_items) {
- free_items (bar->default_items);
- bar->default_items = NULL;
- }
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-
-static void
-class_init (EFilterBarClass *klass)
-{
- GObjectClass *object_class;
- GtkObjectClass *gtk_object_class;
- ESearchBarClass *esb_class = (ESearchBarClass *)klass;
-
- object_class = G_OBJECT_CLASS (klass);
- gtk_object_class = GTK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref(e_search_bar_get_type ());
-
- object_class->dispose = dispose;
-
- gtk_object_class->get_arg = impl_get_arg;
-
- esb_class->set_menu = set_menu;
- esb_class->set_option = set_option;
-
- gtk_object_add_arg_type ("EFilterBar::query", GTK_TYPE_STRING, GTK_ARG_READABLE, ARG_QUERY);
-
-#if 0
- esb_signals [QUERY_CHANGED] =
- gtk_signal_new ("query_changed",
- GTK_RUN_LAST,
- object_class->type,
- G_STRUCT_OFFSET (EFilterBarClass, query_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- esb_signals [MENU_ACTIVATED] =
- gtk_signal_new ("menu_activated",
- GTK_RUN_LAST,
- object_class->type,
- G_STRUCT_OFFSET (EFilterBarClass, menu_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, esb_signals, LAST_SIGNAL);
-#endif
-}
-
-static void
-init (EFilterBar *efb)
-{
- g_signal_connect (efb, "menu_activated", G_CALLBACK (menubar_activated), NULL);
- g_signal_connect (efb, "query_changed", G_CALLBACK (option_changed), NULL);
- g_signal_connect (efb, "search_activated", G_CALLBACK (option_changed), NULL);
-
- efb->menu_rules = g_ptr_array_new ();
- efb->option_rules = g_ptr_array_new ();
-}
-
-
-/* Object construction. */
-
-EFilterBar *
-e_filter_bar_new (RuleContext *context,
- const char *systemrules,
- const char *userrules,
- EFilterBarConfigRule config,
- void *data)
-{
- EFilterBar *bar;
- ESearchBarItem item = { NULL, -1, NULL };
-
- bar = gtk_type_new (e_filter_bar_get_type ());
-
- bar->context = context;
- g_object_ref (context);
-
- bar->config = config;
- bar->config_data = data;
-
- bar->systemrules = g_strdup (systemrules);
- bar->userrules = g_strdup (userrules);
-
- e_search_bar_construct ((ESearchBar *)bar, &item, &item);
-
- g_signal_connect (context, "changed", G_CALLBACK (context_changed), bar);
- g_signal_connect (context, "rule_removed", G_CALLBACK (context_rule_removed), bar);
-
- return bar;
-}
-
-GtkType
-e_filter_bar_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info = {
- "EFilterBar",
- sizeof (EFilterBar),
- sizeof (EFilterBarClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_search_bar_get_type (), &info);
- }
-
- return type;
-}
diff --git a/widgets/misc/e-filter-bar.h b/widgets/misc/e-filter-bar.h
deleted file mode 100644
index e53cf87099..0000000000
--- a/widgets/misc/e-filter-bar.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-filter-bar.h
- * Copyright (C) 2001 Ximian Inc.
- * Author: Michael Zucchi <notzed@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_FILTER_BAR_H__
-#define __E_FILTER_BAR_H__
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-#include "e-search-bar.h"
-
-#include "filter/rule-context.h"
-#include "filter/filter-rule.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EFilterBar - A filter rule driven search bar.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * ---------------------------------------------------------------------------------
- * query string R String representing query.
- */
-
-#define E_FILTER_BAR_TYPE (e_filter_bar_get_type ())
-#define E_FILTER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_FILTER_BAR_TYPE, EFilterBar))
-#define E_FILTER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_FILTER_BAR_TYPE, EFilterBarClass))
-#define E_IS_FILTER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_FILTER_BAR_TYPE))
-#define E_IS_FILTER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_FILTER_BAR_TYPE))
-
-typedef struct _EFilterBar EFilterBar;
-typedef struct _EFilterBarClass EFilterBarClass;
-
-typedef void (*EFilterBarConfigRule)(EFilterBar *, FilterRule *rule, int id, const char *query, void *data);
-
-struct _EFilterBar {
- ESearchBar parent;
-
- int menu_base, option_base;
- GPtrArray *menu_rules, *option_rules;
-
- ESearchBarItem *default_items;
-
- GtkWidget *save_dialogue; /* current save dialogue (so we dont pop up multiple ones) */
-
- FilterRule *current_query; /* as it says */
- int setquery; /* true when we're setting a query directly to advanced, so dont popup the dialogue */
-
- RuleContext *context;
- char *systemrules;
- char *userrules;
-
- EFilterBarConfigRule config;
- void *config_data;
-};
-
-struct _EFilterBarClass
-{
- ESearchBarClass parent_class;
-};
-
-/* "preset" items */
-enum {
- /* preset menu options */
- E_FILTERBAR_SAVE_ID = -3,
- E_FILTERBAR_EDIT_ID = -4,
-
- /* preset option options */
- E_FILTERBAR_ADVANCED_ID = -5,
-};
-
-#define E_FILTERBAR_SAVE { N_("_Save Search..."), E_FILTERBAR_SAVE_ID, NULL }
-#define E_FILTERBAR_EDIT { N_("_Edit Saved Searches..."), E_FILTERBAR_EDIT_ID, NULL }
-#define E_FILTERBAR_ADVANCED { N_("_Advanced..."), E_FILTERBAR_ADVANCED_ID, NULL }
-#define E_FILTERBAR_SEPARATOR { NULL, 0, NULL }
-
-#ifdef JUST_FOR_TRANSLATORS
-const char * strings[] = {
- N_("_Save Search..."),
- N_("_Edit Saved Searches..."),
- N_("_Advanced...")
-};
-#endif
-
-
-GtkType e_filter_bar_get_type (void);
-EFilterBar *e_filter_bar_new (RuleContext *context,
- const char *systemrules,
- const char *userrules,
- EFilterBarConfigRule config,
- void *data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_FILTER_BAR_H__ */
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
deleted file mode 100644
index e91dfb5f9d..0000000000
--- a/widgets/misc/e-gui-utils.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-gui-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-gui-utils.h"
-
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomecanvas/gnome-canvas-pixbuf.h>
-
-/* should probably just deprecate/remove this and have callers change
- to using gtk_message_dialog_new */
-/* This should probably be moved into evolution/e-util */
-void
-e_notice (GtkWindow *parent, GtkMessageType type, const char *format, ...)
-{
- GtkWidget *dialog;
- va_list args;
- char *str;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, type,
- GTK_BUTTONS_CLOSE,
- "%s",
- str);
- va_end (args);
- g_free (str);
-
- g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
- gtk_widget_show (dialog);
-}
-
-static void
-kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- g_object_unref (menu);
-}
-
-void
-e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- g_signal_connect (menu, "hide",
- G_CALLBACK (kill_popup_menu), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEvent *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
-
- if (event->type == GDK_KEY_PRESS)
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, event->key.time);
- else if ((event->type == GDK_BUTTON_PRESS) ||
- (event->type == GDK_BUTTON_RELEASE) ||
- (event->type == GDK_2BUTTON_PRESS) ||
- (event->type == GDK_3BUTTON_PRESS)){
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button.button, event->button.time);
- } else
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, GDK_CURRENT_TIME);
-}
-
-typedef struct {
- GtkCallback callback;
- gpointer closure;
-} CallbackClosure;
-
-static void
-e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
-{
- if (GTK_IS_CONTAINER(widget)) {
- e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
- } else {
- (*callback_closure->callback) (widget, callback_closure->closure);
- }
-}
-
-void
-e_container_foreach_leaf(GtkContainer *container,
- GtkCallback callback,
- gpointer closure)
-{
- CallbackClosure callback_closure;
- callback_closure.callback = callback;
- callback_closure.closure = closure;
- gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
-}
-
-static void
-e_container_change_tab_order_destroy_notify(gpointer data)
-{
- GList *list = data;
- g_list_foreach(list, (GFunc) g_object_unref, NULL);
- g_list_free(list);
-}
-
-
-static gint
-e_container_change_tab_order_callback(GtkContainer *container,
- GtkDirectionType direction,
- GList *children)
-{
- GtkWidget *focus_child;
- GtkWidget *child;
-
- if (direction != GTK_DIR_TAB_FORWARD &&
- direction != GTK_DIR_TAB_BACKWARD)
- return FALSE;
-
- focus_child = container->focus_child;
-
- if (focus_child == NULL)
- return FALSE;
-
- if (direction == GTK_DIR_TAB_BACKWARD) {
- children = g_list_last(children);
- }
-
- while (children) {
- child = children->data;
- if (direction == GTK_DIR_TAB_FORWARD)
- children = children->next;
- else
- children = children->prev;
-
- if (!child)
- continue;
-
- if (focus_child) {
- if (focus_child == child) {
- focus_child = NULL;
-
- if (GTK_WIDGET_DRAWABLE (child) &&
- GTK_IS_CONTAINER (child) &&
- !GTK_WIDGET_HAS_FOCUS (child))
- if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) {
- g_signal_stop_emission_by_name (container, "focus");
- return TRUE;
- }
- }
- }
- else if (GTK_WIDGET_DRAWABLE (child)) {
- if (GTK_IS_CONTAINER (child)) {
- if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) {
- g_signal_stop_emission_by_name (container, "focus");
- return TRUE;
- }
- }
- else if (GTK_WIDGET_CAN_FOCUS (child)) {
- gtk_widget_grab_focus (child);
- g_signal_stop_emission_by_name (container, "focus");
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-gint
-e_container_change_tab_order(GtkContainer *container, GList *widgets)
-{
- GList *list;
- list = g_list_copy(widgets);
- g_list_foreach(list, (GFunc) g_object_ref, NULL);
- return gtk_signal_connect_full(GTK_OBJECT(container), "focus",
- GTK_SIGNAL_FUNC(e_container_change_tab_order_callback),
- NULL, list,
- e_container_change_tab_order_destroy_notify,
- FALSE, FALSE);
-}
-
-struct widgetandint {
- GtkWidget *widget;
- int count;
-};
-
-static void
-nth_entry_callback(GtkWidget *widget, struct widgetandint *data)
-{
- if (GTK_IS_ENTRY(widget)) {
- if (data->count > 1) {
- data->count --;
- data->widget = widget;
- } else if (data->count == 1) {
- data->count --;
- data->widget = NULL;
- gtk_widget_grab_focus(widget);
- }
- }
-}
-
-void
-e_container_focus_nth_entry(GtkContainer *container, int n)
-{
- struct widgetandint data;
- data.widget = NULL;
- data.count = n;
- e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data);
- if (data.widget)
- gtk_widget_grab_focus(data.widget);
-}
-
-gboolean
-e_glade_xml_connect_widget (GladeXML *gui, char *name, char *signal, GCallback cb, gpointer closure)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
-
- if (widget) {
- g_signal_connect (widget, signal,
- cb, closure);
- return TRUE;
- }
-
- return FALSE;
-}
-
-gboolean
-e_glade_xml_set_sensitive (GladeXML *gui, char *name, gboolean sensitive)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
-
- if (widget) {
- gtk_widget_set_sensitive (widget, sensitive);
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h
deleted file mode 100644
index b401748e20..0000000000
--- a/widgets/misc/e-gui-utils.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-gui-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef GAL_GUI_UTILS_H
-#define GAL_GUI_UTILS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-
-#include <gtk/gtkmessagedialog.h>
-#include <glade/glade-xml.h>
-
-G_BEGIN_DECLS
-
-void e_popup_menu (GtkMenu *menu,
- GdkEvent *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window,
- GtkMessageType type,
- const char *format,
- ...);
-void e_container_foreach_leaf (GtkContainer *container,
- GtkCallback callback,
- gpointer closure);
-void e_container_focus_nth_entry (GtkContainer *container,
- int n);
-gint e_container_change_tab_order (GtkContainer *container,
- GList *widgets);
-/* Returns TRUE on success. */
-gboolean e_glade_xml_connect_widget (GladeXML *gui,
- char *name,
- char *signal,
- GtkSignalFunc cb,
- gpointer closure);
-gboolean e_glade_xml_set_sensitive (GladeXML *gui,
- char *name,
- gboolean sensitive);
-
-G_END_DECLS
-
-#endif /* GAL_GUI_UTILS_H */
diff --git a/widgets/misc/e-hsv-utils.c b/widgets/misc/e-hsv-utils.c
deleted file mode 100644
index a5007b9b83..0000000000
--- a/widgets/misc/e-hsv-utils.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-hsv-utils.c - utilites for manipulating colours in HSV space
- * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * Authors:
- * Seth Nickell <seth@eazel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-hsv-utils.h"
-
-/* tweak_hsv is a really tweaky function. it modifies its first argument, which
- should be the colour you want tweaked. delta_h, delta_s and delta_v specify
- how much you want their respective channels modified (and in what direction).
- if it can't do the specified modification, it does it in the oppositon direction */
-void
-e_hsv_tweak (GdkColor *colour, gdouble delta_h, gdouble delta_s, gdouble delta_v)
-{
- gdouble h, s, v, r, g, b;
-
- r = colour->red / 65535.0f;
- g = colour->green / 65535.0f;
- b = colour->blue / 65535.0f;
-
- e_rgb_to_hsv (r, g, b, &h, &s, &v);
-
- if (h + delta_h < 0) {
- h -= delta_h;
- } else {
- h += delta_h;
- }
-
- if (s + delta_s < 0) {
- s -= delta_s;
- } else {
- s += delta_s;
- }
-
- if (v + delta_v < 0) {
- v -= delta_v;
- } else {
- v += delta_v;
- }
-
- e_hsv_to_rgb (h, s, v, &r, &g, &b);
-
- colour->red = r * 65535.0f;
- colour->green = g * 65535.0f;
- colour->blue = b * 65535.0f;
-}
-
-/* Copy n' Paste code from the GTK+ colour selector (gtkcolorsel.c) */
-/* Originally lifted, I suspect, from "Foley, van Dam" */
-void
-e_hsv_to_rgb (gdouble h, gdouble s, gdouble v,
- gdouble *r, gdouble *g, gdouble *b)
-{
- gint i;
- gdouble f, w, q, t;
-
- if (s == 0.0)
- s = 0.000001;
-
- if (h == -1.0)
- {
- *r = v;
- *g = v;
- *b = v;
- }
- else
- {
- if (h == 360.0)
- h = 0.0;
- h = h / 60.0;
- i = (gint) h;
- f = h - i;
- w = v * (1.0 - s);
- q = v * (1.0 - (s * f));
- t = v * (1.0 - (s * (1.0 - f)));
-
- switch (i)
- {
- case 0:
- *r = v;
- *g = t;
- *b = w;
- break;
- case 1:
- *r = q;
- *g = v;
- *b = w;
- break;
- case 2:
- *r = w;
- *g = v;
- *b = t;
- break;
- case 3:
- *r = w;
- *g = q;
- *b = v;
- break;
- case 4:
- *r = t;
- *g = w;
- *b = v;
- break;
- case 5:
- *r = v;
- *g = w;
- *b = q;
- break;
- }
- }
-}
-
-void
-e_rgb_to_hsv (gdouble r, gdouble g, gdouble b,
- gdouble *h, gdouble *s, gdouble *v)
-{
- double max, min, delta;
-
- max = r;
- if (g > max)
- max = g;
- if (b > max)
- max = b;
-
- min = r;
- if (g < min)
- min = g;
- if (b < min)
- min = b;
-
- *v = max;
-
- if (max != 0.0)
- *s = (max - min) / max;
- else
- *s = 0.0;
-
- if (*s == 0.0)
- *h = -1.0;
- else
- {
- delta = max - min;
-
- if (r == max)
- *h = (g - b) / delta;
- else if (g == max)
- *h = 2.0 + (b - r) / delta;
- else if (b == max)
- *h = 4.0 + (r - g) / delta;
-
- *h = *h * 60.0;
-
- if (*h < 0.0)
- *h = *h + 360;
- }
-}
-
-
diff --git a/widgets/misc/e-hsv-utils.h b/widgets/misc/e-hsv-utils.h
deleted file mode 100644
index bbde282697..0000000000
--- a/widgets/misc/e-hsv-utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-hsv-utils.h - utilites for manipulating colours in HSV space
- * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * Authors:
- * Seth Nickell <seth@eazel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_HSV_UTILS_H_
-#define _E_HSV_UTILS_H_
-
-#include <gdk/gdk.h>
-
-G_BEGIN_DECLS
-
-void e_hsv_to_rgb (gdouble h,
- gdouble s,
- gdouble v,
- gdouble *r,
- gdouble *g,
- gdouble *b);
-
-void e_rgb_to_hsv (gdouble r,
- gdouble g,
- gdouble b,
- gdouble *h,
- gdouble *s,
- gdouble *v);
-
-void e_hsv_tweak (GdkColor *colour,
- gdouble delta_h,
- gdouble delta_s,
- gdouble delta_v);
-
-G_END_DECLS
-
-#endif /* _E_HSV_UTILS_H_ */
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
deleted file mode 100644
index 3cd13cd656..0000000000
--- a/widgets/misc/e-map.c
+++ /dev/null
@@ -1,1782 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Map widget.
- *
- * Copyright (C) 2000-2001 Ximian, Inc.
- *
- * Authors: Hans Petter Jansson <hpj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <math.h>
-#include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libart_lgpl/art_filterlevel.h>
-
-#include "e-map.h"
-
-/* Scroll step increment */
-
-#define SCROLL_STEP_SIZE 32
-
-
-/* */
-
-#define E_MAP_GET_WIDTH(map) gdk_pixbuf_get_width(((EMapPrivate *) E_MAP(map)->priv)->map_render_pixbuf)
-#define E_MAP_GET_HEIGHT(map) gdk_pixbuf_get_height(((EMapPrivate *) E_MAP(map)->priv)->map_render_pixbuf)
-
-
-/* Zoom state - keeps track of animation hacks */
-
-typedef enum
-{
- E_MAP_ZOOMED_IN,
- E_MAP_ZOOMED_OUT,
- E_MAP_ZOOMING_IN,
- E_MAP_ZOOMING_OUT
-}
-EMapZoomState;
-
-
-/* Private part of the EMap structure */
-
-typedef struct
-{
- /* Pointer to map image */
- GdkPixbuf *map_pixbuf, *map_render_pixbuf;
-
- /* Settings */
- gboolean frozen, smooth_zoom;
-
- /* Adjustments for scrolling */
- GtkAdjustment *hadj;
- GtkAdjustment *vadj;
-
- /* Current scrolling offsets */
- int xofs, yofs;
-
- /* Realtime zoom data */
- EMapZoomState zoom_state;
- double zoom_target_long, zoom_target_lat;
-
- /* Dots */
- GPtrArray *points;
-}
-EMapPrivate;
-
-
-/* Internal prototypes */
-
-static void e_map_class_init (EMapClass *class);
-static void e_map_init (EMap *view);
-static void e_map_finalize (GObject *object);
-static void e_map_destroy (GtkObject *object);
-static void e_map_unmap (GtkWidget *widget);
-static void e_map_realize (GtkWidget *widget);
-static void e_map_unrealize (GtkWidget *widget);
-static void e_map_size_request (GtkWidget *widget, GtkRequisition *requisition);
-static void e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static gint e_map_button_press (GtkWidget *widget, GdkEventButton *event);
-static gint e_map_button_release (GtkWidget *widget, GdkEventButton *event);
-static gint e_map_motion (GtkWidget *widget, GdkEventMotion *event);
-static gint e_map_expose (GtkWidget *widget, GdkEventExpose *event);
-static gint e_map_key_press (GtkWidget *widget, GdkEventKey *event);
-static void e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustment *vadj);
-
-static void update_render_pixbuf (EMap *map, ArtFilterLevel interp, gboolean render_overlays);
-static void set_scroll_area (EMap *view);
-static void request_paint_area (EMap *view, GdkRectangle *area);
-static void center_at (EMap *map, int x, int y, gboolean scroll);
-static void smooth_center_at (EMap *map, int x, int y);
-static void scroll_to (EMap *view, int x, int y);
-static void zoom_do (EMap *map);
-static gint load_map_background (EMap *view, gchar *name);
-static void adjustment_changed_cb (GtkAdjustment *adj, gpointer data);
-static void update_and_paint (EMap *map);
-static void update_render_point (EMap *map, EMapPoint *point);
-static void repaint_point (EMap *map, EMapPoint *point);
-
-static GtkWidgetClass *parent_class;
-
-
-/* ----------------- *
- * Widget management *
- * ----------------- */
-
-
-/**
- * e_map_get_type:
- * @void:
- *
- * Registers the #EMap class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #EMap class.
- **/
-
-GtkType
-e_map_get_type (void)
-{
- static GtkType e_map_type = 0;
-
- if (!e_map_type)
- {
- static const GtkTypeInfo e_map_info =
- {
- "EMap",
- sizeof (EMap),
- sizeof (EMapClass),
- (GtkClassInitFunc) e_map_class_init,
- (GtkObjectInitFunc) e_map_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- e_map_type = gtk_type_unique (GTK_TYPE_WIDGET, &e_map_info);
- }
-
- return e_map_type;
-}
-
-/* Class initialization function for the map view */
-
-static void
-e_map_class_init (EMapClass *class)
-{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = g_type_class_ref(GTK_TYPE_WIDGET);
-
- gobject_class->finalize = e_map_finalize;
-
- object_class->destroy = e_map_destroy;
-
- class->set_scroll_adjustments = e_map_set_scroll_adjustments;
- widget_class->set_scroll_adjustments_signal = gtk_signal_new ("set_scroll_adjustments",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EMapClass, set_scroll_adjustments),
- gtk_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-
- widget_class->unmap = e_map_unmap;
- widget_class->realize = e_map_realize;
- widget_class->unrealize = e_map_unrealize;
- widget_class->size_request = e_map_size_request;
- widget_class->size_allocate = e_map_size_allocate;
- widget_class->button_press_event = e_map_button_press;
- widget_class->button_release_event = e_map_button_release;
- widget_class->motion_notify_event = e_map_motion;
- widget_class->expose_event = e_map_expose;
- widget_class->key_press_event = e_map_key_press;
-}
-
-
-/* Object initialization function for the map view */
-
-static void
-e_map_init (EMap *view)
-{
- EMapPrivate *priv;
-
- priv = g_new0 (EMapPrivate, 1);
- view->priv = priv;
-
- load_map_background (view, MAP_DIR"/world_map-960.png");
- priv->frozen = FALSE;
- priv->smooth_zoom = TRUE;
- priv->zoom_state = E_MAP_ZOOMED_OUT;
- priv->points = g_ptr_array_new ();
-
- GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (view, GTK_NO_WINDOW);
-}
-
-
-/* Destroy handler for the map view */
-
-static void
-e_map_destroy (GtkObject *object)
-{
- EMap *view;
- EMapPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_E_MAP (object));
-
- view = E_MAP (object);
- priv = view->priv;
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->hadj), view);
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->vadj), view);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* Finalize handler for the map view */
-
-static void
-e_map_finalize (GObject *object)
-{
- EMap *view;
- EMapPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_E_MAP (object));
-
- view = E_MAP (object);
- priv = view->priv;
-
- g_object_unref((priv->hadj));
- priv->hadj = NULL;
-
- g_object_unref((priv->vadj));
- priv->vadj = NULL;
-
- if (priv->map_pixbuf)
- {
- g_object_unref (priv->map_pixbuf);
- priv->map_pixbuf = NULL;
- }
-
- if (priv->map_render_pixbuf)
- {
- g_object_unref (priv->map_render_pixbuf);
- priv->map_render_pixbuf = NULL;
- }
-
- g_free (priv);
- view->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (*G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-/* Unmap handler for the map view */
-
-static void
-e_map_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->unmap)
- (*GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
-}
-
-
-/* Realize handler for the map view */
-
-static void
-e_map_realize (GtkWidget *widget)
-{
- GdkWindowAttr attr;
- int attr_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attr.window_type = GDK_WINDOW_CHILD;
- attr.x = widget->allocation.x;
- attr.y = widget->allocation.y;
- attr.width = widget->allocation.width;
- attr.height = widget->allocation.height;
- attr.wclass = GDK_INPUT_OUTPUT;
- attr.visual = gdk_rgb_get_visual ();
- attr.colormap = gdk_rgb_get_cmap ();
- attr.event_mask = gtk_widget_get_events (widget) |
- GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK |
- GDK_POINTER_MOTION_MASK;
-
- attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr, attr_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
- update_render_pixbuf (E_MAP (widget), GDK_INTERP_BILINEAR, TRUE);
-}
-
-
-/* Unrealize handler for the map view */
-
-static void
-e_map_unrealize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-
-/* Size_request handler for the map view */
-
-static void
-e_map_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- EMap *view;
- EMapPrivate *priv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
- g_return_if_fail (requisition != NULL);
-
- view = E_MAP (widget);
- priv = view->priv;
-
- /* TODO: Put real sizes here. */
-
- requisition->width = gdk_pixbuf_get_width (priv->map_pixbuf);
- requisition->height = gdk_pixbuf_get_height (priv->map_pixbuf);
-}
-
-
-/* Size_allocate handler for the map view */
-
-static void
-e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- EMap *view;
- EMapPrivate *priv;
- int xofs, yofs;
- GdkRectangle area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
- g_return_if_fail (allocation != NULL);
-
- view = E_MAP (widget);
- priv = view->priv;
-
- xofs = priv->xofs;
- yofs = priv->yofs;
-
- /* Resize the window */
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
-
- area.x = 0;
- area.y = 0;
- area.width = allocation->width;
- area.height = allocation->height;
- request_paint_area (E_MAP (widget), &area);
- }
-
- update_render_pixbuf (view, GDK_INTERP_BILINEAR, TRUE);
-}
-
-
-/* Button press handler for the map view */
-
-static gint
-e_map_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
- if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget);
- return TRUE;
-}
-
-
-/* Button release handler for the map view */
-
-static gint
-e_map_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
- if (event->button != 1) return FALSE;
-
- gdk_pointer_ungrab (event->time);
- return TRUE;
-}
-
-
-/* Motion handler for the map view */
-
-static gint
-e_map_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (widget);
- priv = view->priv;
-
- return FALSE;
-
-/*
- * if (event->is_hint)
- * gdk_window_get_pointer(widget->window, &x, &y, &mods);
- * else
- * {
- * x = event->x;
- * y = event->y;
- * }
- *
- * return TRUE;
- */
-}
-
-
-/* Expose handler for the map view */
-
-static gint
-e_map_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- EMap *view;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (IS_E_MAP (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- view = E_MAP (widget);
-
- request_paint_area (view, &event->area);
- return TRUE;
-}
-
-
-/* Set_scroll_adjustments handler for the map view */
-
-static void
-e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustment *vadj)
-{
- EMap *view;
- EMapPrivate *priv;
- gboolean need_adjust;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MAP (widget));
-
- view = E_MAP (widget);
- priv = view->priv;
-
- if (hadj) g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
- else hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
-
- if (vadj) g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
- else vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
-
- if (priv->hadj && priv->hadj != hadj)
- {
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->hadj), view);
- g_object_unref((priv->hadj));
- }
-
- if (priv->vadj && priv->vadj != vadj)
- {
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->vadj), view);
- g_object_unref((priv->vadj));
- }
-
- need_adjust = FALSE;
-
- if (priv->hadj != hadj)
- {
- priv->hadj = hadj;
- g_object_ref((priv->hadj));
- gtk_object_sink (GTK_OBJECT (priv->hadj));
-
- g_signal_connect((priv->hadj), "value_changed", G_CALLBACK (adjustment_changed_cb), view);
-
- need_adjust = TRUE;
- }
-
- if (priv->vadj != vadj)
- {
- priv->vadj = vadj;
- g_object_ref((priv->vadj));
- gtk_object_sink (GTK_OBJECT (priv->vadj));
-
- g_signal_connect((priv->vadj), "value_changed", G_CALLBACK (adjustment_changed_cb), view);
-
- need_adjust = TRUE;
- }
-
- if (need_adjust) adjustment_changed_cb (NULL, view);
-}
-
-
-/* Key press handler for the map view */
-
-static gint
-e_map_key_press (GtkWidget *widget, GdkEventKey *event)
-{
- EMap *view;
- EMapPrivate *priv;
- gboolean do_scroll;
- int xofs, yofs;
-
- view = E_MAP (widget);
- priv = view->priv;
-
- do_scroll = FALSE;
- xofs = yofs = 0;
-
- switch (event->keyval)
- {
- case GDK_Up:
- do_scroll = TRUE;
- xofs = 0;
- yofs = -SCROLL_STEP_SIZE;
- break;
-
- case GDK_Down:
- do_scroll = TRUE;
- xofs = 0;
- yofs = SCROLL_STEP_SIZE;
- break;
-
- case GDK_Left:
- do_scroll = TRUE;
- xofs = -SCROLL_STEP_SIZE;
- yofs = 0;
- break;
-
- case GDK_Right:
- do_scroll = TRUE;
- xofs = SCROLL_STEP_SIZE;
- yofs = 0;
- break;
-
- default:
- return FALSE;
- }
-
- if (do_scroll)
- {
- int x, y;
-
- x = CLAMP (priv->xofs + xofs, 0, priv->hadj->upper - priv->hadj->page_size);
- y = CLAMP (priv->yofs + yofs, 0, priv->vadj->upper - priv->vadj->page_size);
-
- scroll_to (view, x, y);
-
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->hadj), view);
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->vadj), view);
-
- priv->hadj->value = x;
- priv->vadj->value = y;
-
- gtk_signal_emit_by_name (GTK_OBJECT (priv->hadj), "value_changed");
- gtk_signal_emit_by_name (GTK_OBJECT (priv->vadj), "value_changed");
-
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->hadj), view);
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->vadj), view);
- }
-
- return TRUE;
-}
-
-
-/* ---------------- *
- * Widget interface *
- * ---------------- */
-
-
-/**
- * e_map_new:
- * @void:
- *
- * Creates a new empty map widget.
- *
- * Return value: A newly-created map widget.
- **/
-
-EMap *
-e_map_new ()
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (gtk_type_new (TYPE_E_MAP));
- return (E_MAP (widget));
-}
-
-
-/* --- Coordinate translation --- */
-
-
-/* These functions translate coordinates between longitude/latitude and
- * the image x/y offsets, using the equidistant cylindrical projection.
- *
- * Longitude E <-180, 180]
- * Latitude E <-90, 90] */
-
-void
-e_map_window_to_world (EMap *map, double win_x, double win_y, double *world_longitude, double *world_latitude)
-{
- EMapPrivate *priv;
- int width, height;
-
- g_return_if_fail (map);
-
- priv = map->priv;
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
- *world_longitude = (win_x + priv->xofs - (double) width / 2.0) /
- ((double) width / 2.0) * 180.0;
- *world_latitude = ((double) height / 2.0 - win_y - priv->yofs) /
- ((double) height / 2.0) * 90.0;
-}
-
-
-void
-e_map_world_to_window (EMap *map, double world_longitude, double world_latitude, double *win_x, double *win_y)
-{
- EMapPrivate *priv;
- int width, height;
-
- g_return_if_fail (map);
-
- priv = map->priv;
- g_return_if_fail (priv->map_render_pixbuf);
- g_return_if_fail (world_longitude >= -180.0 && world_longitude <= 180.0);
- g_return_if_fail (world_latitude >= -90.0 && world_latitude <= 90.0);
-
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
- *win_x = (width / 2.0 + (width / 2.0) * world_longitude / 180.0) - priv->xofs;
- *win_y = (height / 2.0 - (height / 2.0) * world_latitude / 90.0) - priv->yofs;
-
-#ifdef DEBUG
- printf ("Map size: (%d, %d)\nCoords: (%.1f, %.1f) -> (%.1f, %.1f)\n---\n", width, height, world_longitude, world_latitude, *win_x, *win_y);
-#endif
-}
-
-
-/* --- Zoom --- */
-
-
-double
-e_map_get_magnification (EMap *map)
-{
- EMapPrivate *priv;
-
- priv = map->priv;
- if (priv->zoom_state == E_MAP_ZOOMED_IN) return 2.0;
- else return 1.0;
-}
-
-
-void
-e_map_zoom_to_location (EMap *map, double longitude, double latitude)
-{
- EMapPrivate *priv;
- int width, height;
-
- g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-
- priv = map->priv;
-
- if (priv->zoom_state == E_MAP_ZOOMED_IN) e_map_zoom_out (map);
- else if (priv->zoom_state != E_MAP_ZOOMED_OUT) return;
-
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
- priv->zoom_state = E_MAP_ZOOMING_IN;
- priv->zoom_target_long = longitude;
- priv->zoom_target_lat = latitude;
-
- zoom_do (map);
-}
-
-
-void
-e_map_zoom_out (EMap *map)
-{
- EMapPrivate *priv;
- int width, height;
-
- g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-
- priv = map->priv;
-
- if (priv->zoom_state != E_MAP_ZOOMED_IN) return;
-
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
- priv->zoom_state = E_MAP_ZOOMING_OUT;
- zoom_do (map);
- priv->zoom_state = E_MAP_ZOOMED_OUT;
-}
-
-
-void
-e_map_set_smooth_zoom (EMap *map, gboolean state)
-{
- ((EMapPrivate *) map->priv)->smooth_zoom = state;
-}
-
-
-gboolean
-e_map_get_smooth_zoom (EMap *map)
-{
- return (((EMapPrivate *) map->priv)->smooth_zoom);
-}
-
-
-void
-e_map_freeze (EMap *map)
-{
- ((EMapPrivate *) map->priv)->frozen = TRUE;
-}
-
-
-void
-e_map_thaw (EMap *map)
-{
- ((EMapPrivate *) map->priv)->frozen = FALSE;
- update_and_paint (map);
-}
-
-
-/* --- Point manipulation --- */
-
-
-EMapPoint *
-e_map_add_point (EMap *map, gchar *name, double longitude, double latitude, guint32 color_rgba)
-{
- EMapPrivate *priv;
- EMapPoint *point;
-
- priv = map->priv;
- point = g_new0 (EMapPoint, 1);
-
- point->name = name; /* Can be NULL */
- point->longitude = longitude;
- point->latitude = latitude;
- point->rgba = color_rgba;
-
- g_ptr_array_add (priv->points, (gpointer) point);
-
- if (!priv->frozen)
- {
- update_render_point (map, point);
- repaint_point (map, point);
- }
-
- return point;
-}
-
-
-void
-e_map_remove_point (EMap *map, EMapPoint *point)
-{
- EMapPrivate *priv;
-
- priv = map->priv;
- g_ptr_array_remove (priv->points, point);
-
- if (!((EMapPrivate *) map->priv)->frozen)
- {
- /* FIXME: Re-scaling the whole pixbuf is more than a little
- * overkill when just one point is removed */
-
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
- repaint_point (map, point);
- }
-
- g_free (point);
-}
-
-
-void
-e_map_point_get_location (EMapPoint *point, double *longitude, double *latitude)
-{
- *longitude = point->longitude;
- *latitude = point->latitude;
-}
-
-
-gchar *
-e_map_point_get_name (EMapPoint *point)
-{
- return point->name;
-}
-
-
-guint32
-e_map_point_get_color_rgba (EMapPoint *point)
-{
- return point->rgba;
-}
-
-
-void
-e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba)
-{
- point->rgba = color_rgba;
-
- if (!((EMapPrivate *) map->priv)->frozen)
- {
- /* TODO: Redraw area around point only */
-
- update_render_point (map, point);
- repaint_point (map, point);
- }
-}
-
-
-void
-e_map_point_set_data (EMapPoint *point, gpointer data)
-{
- point->user_data = data;
-}
-
-
-gpointer
-e_map_point_get_data (EMapPoint *point)
-{
- return point->user_data;
-}
-
-
-gboolean
-e_map_point_is_in_view (EMap *map, EMapPoint *point)
-{
- EMapPrivate *priv;
- double x, y;
-
- priv = map->priv;
- if (!priv->map_render_pixbuf) return FALSE;
-
- e_map_world_to_window (map, point->longitude, point->latitude, &x, &y);
-
- if (x >= 0 && x < GTK_WIDGET (map)->allocation.width &&
- y >= 0 && y < GTK_WIDGET (map)->allocation.height)
- return TRUE;
-
- return FALSE;
-}
-
-
-EMapPoint *
-e_map_get_closest_point (EMap *map, double longitude, double latitude, gboolean in_view)
-{
- EMapPrivate *priv;
- EMapPoint *point_chosen = NULL, *point;
- double min_dist = 0.0, dist;
- double dx, dy;
- int i;
-
- priv = map->priv;
-
- for (i = 0; i < priv->points->len; i++)
- {
- point = g_ptr_array_index (priv->points, i);
- if (in_view && !e_map_point_is_in_view (map, point)) continue;
-
- dx = point->longitude - longitude;
- dy = point->latitude - latitude;
- dist = dx * dx + dy * dy;
-
- if (!point_chosen || dist < min_dist)
- {
- min_dist = dist;
- point_chosen = point;
- }
- }
-
- return point_chosen;
-}
-
-
-/* ------------------ *
- * Internal functions *
- * ------------------ */
-
-
-static void
-repaint_visible (EMap *map)
-{
- GdkRectangle area;
-
- area.x = 0;
- area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
-
- request_paint_area (map, &area);
-}
-
-
-static void
-update_and_paint (EMap *map)
-{
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
- repaint_visible (map);
-}
-
-
-static gint
-load_map_background (EMap *view, gchar *name)
-{
- EMapPrivate *priv;
- GdkPixbuf *pb0;
-
- priv = view->priv;
-
- pb0 = gdk_pixbuf_new_from_file (name, NULL);
- if (!pb0)
- return FALSE;
-
- if (priv->map_pixbuf) g_object_unref (priv->map_pixbuf);
- priv->map_pixbuf = pb0;
- update_render_pixbuf (view, GDK_INTERP_BILINEAR, TRUE);
-
- return TRUE;
-}
-
-
-static void
-update_render_pixbuf (EMap *map, ArtFilterLevel interp, gboolean render_overlays)
-{
- EMapPrivate *priv;
- EMapPoint *point;
- int width, height, orig_width, orig_height;
- double zoom;
- int i;
-
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (map))) return;
-
- /* Set up value shortcuts */
-
- priv = map->priv;
- width = GTK_WIDGET (map)->allocation.width;
- height = GTK_WIDGET (map)->allocation.height;
- orig_width = gdk_pixbuf_get_width (priv->map_pixbuf);
- orig_height = gdk_pixbuf_get_height (priv->map_pixbuf);
-
- /* Compute scaled width and height based on the extreme dimension */
-
- if ((double) width / orig_width > (double) height / orig_height)
- {
- zoom = (double) width / (double) orig_width;
- }
- else
- {
- zoom = (double) height / (double) orig_height;
- }
-
- if (priv->zoom_state == E_MAP_ZOOMED_IN) zoom *= 2.0;
- height = (orig_height * zoom) + 0.5;
- width = (orig_width * zoom) + 0.5;
-
- /* Reallocate the pixbuf */
-
- if (priv->map_render_pixbuf) g_object_unref (priv->map_render_pixbuf);
- priv->map_render_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, /* No alpha */
- 8, width, height);
-
- /* Scale the original map into the rendering pixbuf */
-
- if (width > 1 && height > 1)
- {
- gdk_pixbuf_scale (priv->map_pixbuf, priv->map_render_pixbuf, 0, 0, /* Dest (x, y) */
- width, height, 0, 0, /* Offset (x, y) */
- zoom, zoom, /* Scale (x, y) */
- interp);
- }
-
- if (render_overlays)
- {
- /* Add points */
-
- for (i = 0; i < priv->points->len; i++)
- {
- point = g_ptr_array_index (priv->points, i);
- update_render_point (map, point);
- }
- }
-
- /* Compute image offsets with respect to window */
-
- set_scroll_area (map);
-}
-
-
-/* Queues a repaint of the specified area in window coordinates */
-
-static void
-request_paint_area (EMap *view, GdkRectangle *area)
-{
- EMapPrivate *priv;
- int width, height;
-
- if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (view)) ||
- !GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
-
- priv = view->priv;
- if (!priv->map_render_pixbuf) return;
-
- width = MIN (area->width, E_MAP_GET_WIDTH (view));
- height = MIN (area->height, E_MAP_GET_HEIGHT (view));
-
- /* This satisfies paranoia. To be removed */
-
- if (priv->xofs + width > gdk_pixbuf_get_width (priv->map_render_pixbuf))
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf) - priv->xofs;
-
- if (priv->yofs + height > gdk_pixbuf_get_height (priv->map_render_pixbuf))
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf) - priv->yofs;
-
- /* We rely on the fast case always being the case, since we load and
- * preprocess the source pixbuf ourselves */
-
- if (gdk_pixbuf_get_colorspace (priv->map_render_pixbuf) == GDK_COLORSPACE_RGB && !gdk_pixbuf_get_has_alpha (priv->map_render_pixbuf) &&
- gdk_pixbuf_get_bits_per_sample (priv->map_render_pixbuf) == 8)
- {
- guchar *pixels;
- int rowstride;
-
- rowstride = gdk_pixbuf_get_rowstride (priv->map_render_pixbuf);
- pixels = gdk_pixbuf_get_pixels (priv->map_render_pixbuf) + (area->y + priv->yofs) * rowstride + 3 * (area->x + priv->xofs);
- gdk_draw_rgb_image_dithalign (GTK_WIDGET (view)->window, GTK_WIDGET (view)->style->black_gc, area->x, area->y, width, height, GDK_RGB_DITHER_NORMAL, pixels, rowstride, 0, 0);
- return;
- }
-
-#ifdef DEBUG
- g_print ("Doing hard redraw.\n");
-#endif
-}
-
-static void
-put_pixel_with_clipping (GdkPixbuf *pixbuf, gint x, gint y, guint rgba)
-{
- gint width, height;
- gint rowstride, n_channels;
- guchar *pixels, *pixel;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- if (x < 0 || x >= width || y < 0 || y >= height)
- return;
-
- pixel = pixels + (y * rowstride) + (x * n_channels);
-
- *pixel = (rgba >> 24);
- *(pixel + 1) = (rgba >> 16) & 0x000000ff;
- *(pixel + 2) = (rgba >> 8) & 0x000000ff;
-
- if (n_channels > 3)
- {
- *(pixel + 3) = rgba & 0x000000ff;
- }
-}
-
-
-/* Redraw point in client pixbuf */
-
-static void
-update_render_point (EMap *map, EMapPoint *point)
-{
- EMapPrivate *priv;
- GdkPixbuf *pb;
- int width, height;
- double px, py;
-
- priv = map->priv;
- pb = priv->map_render_pixbuf;
- if (!pb) return;
-
- width = gdk_pixbuf_get_width (pb);
- height = gdk_pixbuf_get_height (pb);
-
- e_map_world_to_window (map, point->longitude, point->latitude, &px, &py);
- px += priv->xofs;
- py += priv->yofs;
-
- put_pixel_with_clipping (pb, px, py, point->rgba);
- put_pixel_with_clipping (pb, px - 1, py, point->rgba);
- put_pixel_with_clipping (pb, px + 1, py, point->rgba);
- put_pixel_with_clipping (pb, px, py - 1, point->rgba);
- put_pixel_with_clipping (pb, px, py + 1, point->rgba);
-
- put_pixel_with_clipping (pb, px - 2, py, 0x000000ff);
- put_pixel_with_clipping (pb, px + 2, py, 0x000000ff);
- put_pixel_with_clipping (pb, px, py - 2, 0x000000ff);
- put_pixel_with_clipping (pb, px, py + 2, 0x000000ff);
- put_pixel_with_clipping (pb, px - 1, py - 1, 0x000000ff);
- put_pixel_with_clipping (pb, px - 1, py + 1, 0x000000ff);
- put_pixel_with_clipping (pb, px + 1, py - 1, 0x000000ff);
- put_pixel_with_clipping (pb, px + 1, py + 1, 0x000000ff);
-}
-
-
-/* Repaint point on X server */
-
-static void
-repaint_point (EMap *map, EMapPoint *point)
-{
- EMapPrivate *priv;
- GdkRectangle area;
- double px, py;
-
- if (!e_map_point_is_in_view (map, point)) return;
- priv = map->priv;
-
- e_map_world_to_window (map, point->longitude, point->latitude, &px, &py);
-
- area.x = (int) px - 2;
- area.y = (int) py - 2;
- area.width = 5;
- area.height = 5;
- request_paint_area (map, &area);
-}
-
-
-static void
-center_at (EMap *map, int x, int y, gboolean scroll)
-{
- EMapPrivate *priv;
- int pb_width, pb_height,
- view_width, view_height;
-
- priv = map->priv;
-
- pb_width = E_MAP_GET_WIDTH (map);
- pb_height = E_MAP_GET_HEIGHT (map);
-
- view_width = GTK_WIDGET (map)->allocation.width;
- view_height = GTK_WIDGET (map)->allocation.height;
-
- x = CLAMP (x - (view_width / 2), 0, pb_width - view_width);
- y = CLAMP (y - (view_height / 2), 0, pb_height - view_height);
-
- if (scroll) scroll_to (map, x, y);
- else
- {
- priv->xofs = x;
- priv->yofs = y;
- }
-}
-
-
-static void
-smooth_center_at (EMap *map, int x, int y)
-{
- EMapPrivate *priv;
- int pb_width, pb_height,
- view_width, view_height;
- int dx, dy;
-
- priv = map->priv;
-
- pb_width = E_MAP_GET_WIDTH (map);
- pb_height = E_MAP_GET_HEIGHT (map);
-
- view_width = GTK_WIDGET (map)->allocation.width;
- view_height = GTK_WIDGET (map)->allocation.height;
-
- x = CLAMP (x - (view_width / 2), 0, pb_width - view_width);
- y = CLAMP (y - (view_height / 2), 0, pb_height - view_height);
-
- for (;;)
- {
- if (priv->xofs == x && priv->yofs == y) break;
-
- dx = (x < priv->xofs) ? -1 : (x > priv->xofs) ? 1 : 0;
- dy = (y < priv->yofs) ? -1 : (y > priv->yofs) ? 1 : 0;
-
- scroll_to (map, priv->xofs + dx, priv->yofs + dy);
- }
-}
-
-
-/* Scrolls the view to the specified offsets. Does not perform range checking! */
-
-static void
-scroll_to (EMap *view, int x, int y)
-{
- EMapPrivate *priv;
- int xofs, yofs;
- GdkWindow *window;
- GdkGC *gc;
- int width, height;
- int src_x, src_y;
- int dest_x, dest_y;
- GdkEvent *event;
-
- priv = view->priv;
-
- /* Compute offsets and check bounds */
-
- xofs = x - priv->xofs;
- yofs = y - priv->yofs;
-
- if (xofs == 0 && yofs == 0) return;
-
- priv->xofs = x;
- priv->yofs = y;
-
- if (!GTK_WIDGET_DRAWABLE (view)) return;
-
- width = GTK_WIDGET (view)->allocation.width;
- height = GTK_WIDGET (view)->allocation.height;
-
- if (abs (xofs) >= width || abs (yofs) >= height)
- {
- GdkRectangle area;
-
- area.x = 0;
- area.y = 0;
- area.width = width;
- area.height = height;
-
- request_paint_area (view, &area);
- return;
- }
-
- window = GTK_WIDGET (view)->window;
-
- /* Copy the window area */
-
- src_x = xofs < 0 ? 0 : xofs;
- src_y = yofs < 0 ? 0 : yofs;
- dest_x = xofs < 0 ? -xofs : 0;
- dest_y = yofs < 0 ? -yofs : 0;
-
- gc = gdk_gc_new (window);
- gdk_gc_set_exposures (gc, TRUE);
-
- gdk_window_copy_area (window, gc, dest_x, dest_y, window, src_x, src_y, width - abs (xofs), height - abs (yofs));
-
- gdk_gc_destroy (gc);
-
- /* Add the scrolled-in region */
-
- if (xofs)
- {
- GdkRectangle r;
-
- r.x = xofs < 0 ? 0 : width - xofs;
- r.y = 0;
- r.width = abs (xofs);
- r.height = height;
-
- request_paint_area (view, &r);
- }
-
- if (yofs)
- {
- GdkRectangle r;
-
- r.x = 0;
- r.y = yofs < 0 ? 0 : height - yofs;
- r.width = width;
- r.height = abs (yofs);
-
- request_paint_area (view, &r);
- }
-
- /* Process graphics exposures */
-
- while ((event = gdk_event_get_graphics_expose (window)) != NULL)
- {
- gtk_widget_event (GTK_WIDGET (view), event);
-
- if (event->expose.count == 0)
- {
- gdk_event_free (event);
- break;
- }
-
- gdk_event_free (event);
- }
-}
-
-
-static int divide_seq[] =
-{
- /* Dividends for divisor of 2 */
-
- -2,
-
- 1,
-
- /* Dividends for divisor of 4 */
-
- -4,
-
- 1, 3,
-
- /* Dividends for divisor of 8 */
-
- -8,
-
- 1, 5, 3, 7,
-
- /* Dividends for divisor of 16 */
-
- -16,
-
- 1, 9, 5, 13, 3, 11, 7, 15,
-
- /* Dividends for divisor of 32 */
-
- -32,
-
- 1, 17, 9, 25, 5, 21, 13, 29, 3, 19,
- 11, 27, 7, 23, 15, 31,
-
- /* Dividends for divisor of 64 */
-
- -64,
-
- 1, 33, 17, 49, 9, 41, 25, 57, 5, 37,
- 21, 53, 13, 45, 29, 61, 3, 35, 19, 51,
- 11, 43, 27, 59, 7, 39, 23, 55, 15, 47,
- 31, 63,
-
- /* Dividends for divisor of 128 */
-
- -128,
-
- 1, 65, 33, 97, 17, 81, 49, 113, 9, 73,
- 41, 105, 25, 89, 57, 121, 5, 69, 37, 101,
- 21, 85, 53, 117, 13, 77, 45, 109, 29, 93,
- 61, 125, 3, 67, 35, 99, 19, 83, 51, 115,
- 11, 75, 43, 107, 27, 91, 59, 123, 7, 71,
- 39, 103, 23, 87, 55, 119, 15, 79, 47, 111,
- 31, 95, 63, 127,
-
- /* Dividends for divisor of 256 */
-
- -256,
-
- 1, 129, 65, 193, 33, 161, 97, 225, 17, 145,
- 81, 209, 49, 177, 113, 241, 9, 137, 73, 201,
- 41, 169, 105, 233, 25, 153, 89, 217, 57, 185,
- 121, 249, 5, 133, 69, 197, 37, 165, 101, 229,
- 21, 149, 85, 213, 53, 181, 117, 245, 13, 141,
- 77, 205, 45, 173, 109, 237, 29, 157, 93, 221,
- 61, 189, 125, 253, 3, 131, 67, 195, 35, 163,
- 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
- 11, 139, 75, 203, 43, 171, 107, 235, 27, 155,
- 91, 219, 59, 187, 123, 251, 7, 135, 71, 199,
- 39, 167, 103, 231, 23, 151, 87, 215, 55, 183,
- 119, 247, 15, 143, 79, 207, 47, 175, 111, 239,
- 31, 159, 95, 223, 63, 191, 127, 255,
-
- 0
-};
-
-
-typedef enum
-{
- AXIS_X,
- AXIS_Y
-}
-AxisType;
-
-
-static void
-blowup_window_area (GdkWindow *window, gint area_x, gint area_y, gint target_x, gint target_y, gint total_width, gint total_height, gfloat zoom_factor)
-{
- GdkGC *gc;
- AxisType strong_axis;
- gfloat axis_factor, axis_counter;
- gint zoom_chunk;
- gint divisor_width = 0, divisor_height = 0;
- gint divide_width_index, divide_height_index;
- gint area_width, area_height;
- gint i, j;
- int line;
-
-
- /* Set up the GC we'll be using */
-
- gc = gdk_gc_new (window);
- gdk_gc_set_exposures (gc, FALSE);
-
- /* Get area constraints */
-
- gdk_window_get_size (window, &area_width, &area_height);
-
- /* Initialize area division array indexes */
-
- divide_width_index = divide_height_index = 0;
-
- /* Initialize axis counter */
-
- axis_counter = 0.0;
-
- /* Find the strong axis (which is the basis for iteration) and the ratio
- * at which the other axis will be scaled.
- *
- * Also determine how many lines to expand in one fell swoop, and store
- * this figure in zoom_chunk. */
-
- if (area_width > area_height)
- {
- strong_axis = AXIS_X;
- axis_factor = (double) area_height / (double) area_width;
- zoom_chunk = MAX (1, area_width / 250);
- i = (area_width * (zoom_factor - 1.0)) / zoom_chunk;
- }
- else
- {
- strong_axis = AXIS_Y;
- axis_factor = (double) area_width / (double) area_height;
- zoom_chunk = MAX (1, area_height / 250);
- i = (area_height * (zoom_factor - 1.0)) / zoom_chunk;
- }
-
- /* Go, go, devil bunnies! Gogo devil bunnies! */
-
- for (; i > 0; i--)
- {
- /* Reset division sequence table indexes as necessary */
-
- if (!divide_seq[divide_width_index]) divide_width_index = 0;
- if (!divide_seq[divide_height_index]) divide_height_index = 0;
-
- /* Set new divisor if found in table */
-
- if (divide_seq[divide_width_index] < 0)
- divisor_width = abs (divide_seq[divide_width_index++]);
- if (divide_seq[divide_height_index] < 0)
- divisor_height = abs (divide_seq[divide_height_index++]);
-
- /* Widen */
-
- if (strong_axis == AXIS_X || axis_counter >= 1.0)
- {
- line = ((divide_seq[divide_width_index] * area_width) / divisor_width) + 0.5;
-
- if ((line < target_x && target_x > area_width / 2) || (line > target_x && target_x > (area_width / 2) + zoom_chunk))
- {
- /* Push left */
-
- for (j = 0; j < zoom_chunk - 1; j++)
- gdk_window_copy_area (window, gc, line + j + 1, 0, window, line, 0, 1, area_height);
-
- gdk_window_copy_area (window, gc, 0, 0, window, zoom_chunk, 0, line, area_height);
- if (line > target_x) target_x -= zoom_chunk;
- }
- else
- {
- /* Push right */
-
- for (j = 0; j < zoom_chunk - 1; j++)
- gdk_window_copy_area (window, gc, line + j - (zoom_chunk - 1), 0, window, line - zoom_chunk, 0, 1, area_height);
-
- gdk_window_copy_area (window, gc, line, 0, window, line - zoom_chunk, 0, area_width - line, area_height);
- if (line < target_x) target_x += zoom_chunk;
- }
- }
-
- if (strong_axis == AXIS_Y || axis_counter >= 1.0)
- {
- /* Heighten */
-
- line = ((divide_seq[divide_height_index] * area_height) / divisor_height) + 0.5;
-
- if ((line < target_y && target_y > area_height / 2) || (line > target_y && target_y > (area_height / 2) + zoom_chunk))
- {
- /* Push up */
-
- for (j = 0; j < zoom_chunk - 1; j++)
- gdk_window_copy_area (window, gc, 0, line + j + 1, window, 0, line, area_width, 1);
-
- gdk_window_copy_area (window, gc, 0, 0, window, 0, zoom_chunk, area_width, line);
- if (line > target_y) target_y -= zoom_chunk;
- }
- else
- {
- /* Push down */
-
- for (j = 0; j < zoom_chunk - 1; j++)
- gdk_window_copy_area (window, gc, 0, line + j - (zoom_chunk - 1), window, 0, line - zoom_chunk, area_width, 1);
-
- gdk_window_copy_area (window, gc, 0, line, window, 0, line - zoom_chunk, area_width, area_height - line);
- if (line < target_y) target_y += zoom_chunk;
- }
- }
-
- divide_width_index++;
- divide_height_index++;
- if (axis_counter >= 1.0) axis_counter -= 1.0;
- axis_counter += axis_factor;
- }
-
- /* Free our GC */
-
- gdk_gc_destroy (gc);
-}
-
-
-static void
-zoom_in_smooth (EMap *map)
-{
- GdkRectangle area;
- EMapPrivate *priv;
- GdkWindow *window;
- int width, height;
- int win_width, win_height;
- int target_width, target_height;
- double x, y;
-
- g_return_if_fail (map);
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-
- area.x = 0;
- area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
-
- priv = map->priv;
- window = GTK_WIDGET (map)->window;
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
- win_width = GTK_WIDGET (map)->allocation.width;
- win_height = GTK_WIDGET (map)->allocation.height;
- target_width = win_width / 4;
- target_height = win_height / 4;
-
- /* Center the target point as much as possible */
-
- e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
- smooth_center_at (map, x + priv->xofs, y + priv->yofs);
-
- /* Render and paint a temporary map without overlays, so they don't get in
- * the way (look ugly) while zooming */
-
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, FALSE);
- request_paint_area (map, &area);
-
- /* Find out where in the area we're going to zoom to */
-
- e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
-
- /* Pre-render the zoomed-in map, so we can put it there quickly when the
- * blowup sequence ends */
-
- priv->zoom_state = E_MAP_ZOOMED_IN;
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
-
- /* Do the blowup */
-
- blowup_window_area (window, priv->xofs, priv->yofs, x, y, width, height, 1.68);
-
- /* Set new scroll offsets and paint the zoomed map */
-
- e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
- priv->xofs = CLAMP (priv->xofs + x - area.width / 2.0, 0, E_MAP_GET_WIDTH (map) - area.width);
- priv->yofs = CLAMP (priv->yofs + y - area.height / 2.0, 0, E_MAP_GET_HEIGHT (map) - area.height);
-
- request_paint_area (map, &area);
-}
-
-
-static void
-zoom_in (EMap *map)
-{
- GdkRectangle area;
- EMapPrivate *priv;
- double x, y;
-
- priv = map->priv;
-
- area.x = 0;
- area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
-
- priv->zoom_state = E_MAP_ZOOMED_IN;
-
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
-
- e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
- priv->xofs = CLAMP (priv->xofs + x - area.width / 2.0, 0, E_MAP_GET_WIDTH (map) - area.width);
- priv->yofs = CLAMP (priv->yofs + y - area.height / 2.0, 0, E_MAP_GET_HEIGHT (map) - area.height);
-
- request_paint_area (map, &area);
-}
-
-
-static void
-zoom_out (EMap *map)
-{
- GdkRectangle area;
- EMapPrivate *priv;
- double longitude, latitude;
- double x, y;
-
- priv = map->priv;
-
- area.x = 0;
- area.y = 0;
- area.width = GTK_WIDGET (map)->allocation.width;
- area.height = GTK_WIDGET (map)->allocation.height;
-
- /* Must be done before update_render_pixbuf() */
-
- e_map_window_to_world (map, area.width / 2, area.height / 2,
- &longitude, &latitude);
-
- priv->zoom_state = E_MAP_ZOOMED_OUT;
- update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
-
- e_map_world_to_window (map, longitude, latitude, &x, &y);
- center_at (map, x + priv->xofs, y + priv->yofs, FALSE);
-/* request_paint_area (map, &area); */
- repaint_visible (map);
-}
-
-
-static void
-zoom_do (EMap *map)
-{
- EMapPrivate *priv;
-
- priv = map->priv;
-
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->hadj), map);
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->vadj), map);
-
- if (priv->zoom_state == E_MAP_ZOOMING_IN)
- {
- if (e_map_get_smooth_zoom (map)) zoom_in_smooth (map);
- else zoom_in (map);
- }
- else if (priv->zoom_state == E_MAP_ZOOMING_OUT)
- {
-/* if (e_map_get_smooth_zoom(map)) zoom_out_smooth(map); */
- zoom_out (map);
- }
-
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->hadj), map);
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->vadj), map);
-
- set_scroll_area(map);
-}
-
-
-/* Callback used when an adjustment is changed */
-
-static void
-adjustment_changed_cb (GtkAdjustment *adj, gpointer data)
-{
- EMap *view;
- EMapPrivate *priv;
-
- view = E_MAP (data);
- priv = view->priv;
-
- scroll_to (view, priv->hadj->value, priv->vadj->value);
-}
-
-
-static void
-set_scroll_area (EMap *view)
-{
- EMapPrivate *priv;
-
- priv = view->priv;
-
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
- if (!priv->hadj || !priv->vadj) return;
-
- /* Set scroll increments */
-
- priv->hadj->page_size = GTK_WIDGET (view)->allocation.width;
- priv->hadj->page_increment = GTK_WIDGET (view)->allocation.width / 2;
- priv->hadj->step_increment = SCROLL_STEP_SIZE;
-
- priv->vadj->page_size = GTK_WIDGET (view)->allocation.height;
- priv->vadj->page_increment = GTK_WIDGET (view)->allocation.height / 2;
- priv->vadj->step_increment = SCROLL_STEP_SIZE;
-
- /* Set scroll bounds and new offsets */
-
- priv->hadj->lower = 0;
- if (priv->map_render_pixbuf)
- priv->hadj->upper = gdk_pixbuf_get_width (priv->map_render_pixbuf);
-
- priv->vadj->lower = 0;
- if (priv->map_render_pixbuf)
- priv->vadj->upper = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-
- gtk_signal_emit_by_name (GTK_OBJECT (priv->hadj), "changed");
- gtk_signal_emit_by_name (GTK_OBJECT (priv->vadj), "changed");
-
- priv->xofs = CLAMP (priv->xofs, 0, priv->hadj->upper - priv->hadj->page_size);
- priv->yofs = CLAMP (priv->yofs, 0, priv->vadj->upper - priv->vadj->page_size);
-
- if (priv->hadj->value != priv->xofs)
- {
- priv->hadj->value = priv->xofs;
-
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->hadj), view);
- gtk_signal_emit_by_name (GTK_OBJECT (priv->hadj), "value_changed");
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->hadj), view);
- }
-
- if (priv->vadj->value != priv->yofs)
- {
- priv->vadj->value = priv->yofs;
-
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->vadj), view);
- gtk_signal_emit_by_name (GTK_OBJECT (priv->vadj), "value_changed");
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->vadj), view);
- }
-}
diff --git a/widgets/misc/e-map.h b/widgets/misc/e-map.h
deleted file mode 100644
index 9e0098a5a2..0000000000
--- a/widgets/misc/e-map.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Map widget.
- *
- * Copyright (C) 2000-2001 Ximian, Inc.
- *
- * Authors: Hans Petter Jansson <hpj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef E_MAP_H
-#define E_MAP_H
-
-#include <gtk/gtkwidget.h>
-
-#define TYPE_E_MAP (e_map_get_type ())
-#define E_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_E_MAP, EMap))
-#define E_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_E_MAP, EMapClass))
-#define IS_E_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_E_MAP))
-#define IS_E_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_E_MAP))
-
-typedef struct _EMap EMap;
-typedef struct _EMapClass EMapClass;
-typedef struct _EMapPoint EMapPoint;
-
-struct _EMap
-{
- GtkWidget widget;
-
- /* Private data */
- gpointer priv;
-};
-
-struct _EMapClass
-{
- GtkWidgetClass parent_class;
-
- /* Notification signals */
- void (*zoom_fit) (EMap * view);
-
- /* GTK+ scrolling interface */
- void (*set_scroll_adjustments) (GtkWidget * widget,
- GtkAdjustment * hadj,
- GtkAdjustment * vadj);
-};
-
-/* The definition of Dot */
-
-struct _EMapPoint
-{
- gchar *name; /* Can be NULL */
- double longitude, latitude;
- guint32 rgba;
- gpointer user_data;
-};
-
-
-/* --- Widget --- */
-
-GtkType e_map_get_type (void);
-
-EMap *e_map_new (void);
-
-/* Stop doing redraws when map data changes (e.g. by modifying points) */
-void e_map_freeze (EMap *map);
-
-/* Do an immediate repaint, and start doing realtime repaints again */
-void e_map_thaw (EMap *map);
-
-/* --- Coordinate translation --- */
-
-/* Translates window-relative coords to lat/long */
-void e_map_window_to_world (EMap *map,
- double win_x, double win_y,
- double *world_longitude, double *world_latitude);
-
-/* Translates lat/long to window-relative coordinates. Note that the
- * returned coordinates can be negative or greater than the current size
- * of the allocation area */
-void e_map_world_to_window (EMap *map,
- double world_longitude, double world_latitude,
- double *win_x, double *win_y);
-
-/* --- Zoom --- */
-
-double e_map_get_magnification (EMap *map);
-
-/* Pass TRUE if we want the smooth zoom hack */
-void e_map_set_smooth_zoom (EMap *map, gboolean state);
-
-/* TRUE if smooth zoom hack will be employed */
-gboolean e_map_get_smooth_zoom (EMap *map);
-
-/* NB: Function definition will change shortly */
-void e_map_zoom_to_location (EMap *map, double longitude, double latitude);
-
-/* Zoom to mag factor 1.0 */
-void e_map_zoom_out (EMap *map);
-
-/* --- Points --- */
-
-EMapPoint *e_map_add_point (EMap *map, gchar *name,
- double longitude, double latitude,
- guint32 color_rgba);
-
-void e_map_remove_point (EMap *map, EMapPoint *point);
-
-void e_map_point_get_location (EMapPoint *point,
- double *longitude, double *latitude);
-
-gchar *e_map_point_get_name (EMapPoint *point);
-
-guint32 e_map_point_get_color_rgba (EMapPoint *point);
-
-void e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba);
-
-void e_map_point_set_data (EMapPoint *point, gpointer data);
-
-gpointer e_map_point_get_data (EMapPoint *point);
-
-gboolean e_map_point_is_in_view (EMap *map, EMapPoint *point);
-
-EMapPoint *e_map_get_closest_point (EMap *map, double longitude, double latitude,
- gboolean in_view);
-
-#endif
diff --git a/widgets/misc/e-messagebox.c b/widgets/misc/e-messagebox.c
deleted file mode 100644
index 4a6da0e3cf..0000000000
--- a/widgets/misc/e-messagebox.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Original Author: Jay Painter
- * Modified: Jeffrey Stedfast
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-#include <stdarg.h>
-#include <string.h> /* for strcmp */
-
-#include <glib.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-triggers.h>
-#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-pixmap.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include "e-messagebox.h"
-
-#define E_MESSAGE_BOX_WIDTH 425
-#define E_MESSAGE_BOX_HEIGHT 125
-
-struct _EMessageBoxPrivate {
- GtkWidget *label;
- GtkWidget *checkbox;
-};
-
-static void e_message_box_class_init (EMessageBoxClass *klass);
-static void e_message_box_init (EMessageBox *messagebox);
-static void e_message_box_finalize (GObject *object);
-static void e_message_box_destroy (GtkObject *object);
-
-static GnomeDialogClass *parent_class;
-
-GtkType
-e_message_box_get_type (void)
-{
- static GtkType message_box_type = 0;
-
- if (!message_box_type) {
- GtkTypeInfo message_box_info = {
- "EMessageBox",
- sizeof (EMessageBox),
- sizeof (EMessageBoxClass),
- (GtkClassInitFunc) e_message_box_class_init,
- (GtkObjectInitFunc) e_message_box_init,
- NULL,
- NULL
- };
-
- message_box_type = gtk_type_unique (gnome_dialog_get_type (), &message_box_info);
- }
-
- return message_box_type;
-}
-
-static void
-e_message_box_class_init (EMessageBoxClass *klass)
-{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
-
- gobject_class = (GObjectClass *) klass;
- object_class = (GtkObjectClass *) klass;
- parent_class = g_type_class_ref(gnome_dialog_get_type ());
-
- gobject_class->finalize = e_message_box_finalize;
-
- object_class->destroy = e_message_box_destroy;
-}
-
-static void
-e_message_box_init (EMessageBox *message_box)
-{
- message_box->_priv = g_new0 (EMessageBoxPrivate, 1);
-}
-
-static void
-e_message_box_finalize (GObject *object)
-{
- EMessageBox *mbox = E_MESSAGE_BOX (object);
-
- g_free (mbox->_priv);
- mbox->_priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-e_message_box_destroy (GtkObject *object)
-{
- /* remember, destroy can be run multiple times! */
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/**
- * e_message_box_construct:
- * @messagebox: The message box to construct
- * @message: The message to be displayed.
- * @message_box_type: The type of the message
- * @buttons: a NULL terminated array with the buttons to insert.
- *
- * For language bindings or subclassing, from C use #e_message_box_new or
- * #e_message_box_newv
- *
- * Returns:
- */
-void
-e_message_box_construct (EMessageBox *messagebox,
- const gchar *message,
- const gchar *message_box_type,
- const gchar **buttons)
-{
- GtkWidget *hbox;
- GtkWidget *pixmap = NULL;
- GtkWidget *alignment;
- char *s;
- GtkStyle *style;
- const gchar* title = NULL;
- gint i = 0;
-
- g_return_if_fail (messagebox != NULL);
- g_return_if_fail (E_IS_MESSAGE_BOX (messagebox));
- g_return_if_fail (message != NULL);
- g_return_if_fail (message_box_type != NULL);
-
- style = gtk_widget_get_style (GTK_WIDGET (messagebox));
-
- /* Make noises, basically */
- gnome_triggers_vdo (message, message_box_type, NULL);
-
- if (strcmp (E_MESSAGE_BOX_INFO, message_box_type) == 0) {
- title = _("Information");
- s = gnome_unconditional_pixmap_file("gnome-info.png");
- if (s) {
- pixmap = gnome_pixmap_new_from_file (s);
- g_free(s);
- }
- } else if (strcmp (E_MESSAGE_BOX_WARNING, message_box_type) == 0) {
- title = _("Warning");
- s = gnome_unconditional_pixmap_file ("gnome-warning.png");
- if (s) {
- pixmap = gnome_pixmap_new_from_file (s);
- g_free (s);
- }
- } else if (strcmp (E_MESSAGE_BOX_ERROR, message_box_type) == 0) {
- title = _("Error");
- s = gnome_unconditional_pixmap_file ("gnome-error");
- if (s) {
- pixmap = gnome_pixmap_new_from_file (s);
- g_free(s);
- }
- } else if (strcmp (E_MESSAGE_BOX_QUESTION, message_box_type) == 0) {
- title = _("Question");
- s = gnome_unconditional_pixmap_file ("gnome-question.png");
- if (s) {
- pixmap = gnome_pixmap_new_from_file (s);
- g_free (s);
- }
- } else {
- title = _("Message");
- }
-
- g_assert (title != NULL);
-
- gtk_window_set_title (GTK_WINDOW (messagebox), title);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (messagebox)->vbox),
- hbox, TRUE, TRUE, 10);
- gtk_widget_show (hbox);
-
- if (pixmap == NULL) {
- if (pixmap)
- gtk_widget_destroy (pixmap);
- s = gnome_unconditional_pixmap_file ("gnome-default.png");
- if (s) {
- pixmap = gnome_pixmap_new_from_file (s);
- g_free (s);
- } else
- pixmap = NULL;
- }
- if (pixmap) {
- gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, TRUE, 0);
- gtk_widget_show (pixmap);
- }
-
- messagebox->_priv->label = gtk_label_new (message);
- gtk_label_set_justify (GTK_LABEL (messagebox->_priv->label), GTK_JUSTIFY_LEFT);
- gtk_label_set_line_wrap (GTK_LABEL (messagebox->_priv->label), TRUE);
- gtk_misc_set_padding (GTK_MISC (messagebox->_priv->label), GNOME_PAD, 0);
- gtk_box_pack_start (GTK_BOX (hbox), messagebox->_priv->label, TRUE, TRUE, 0);
- gtk_widget_show (messagebox->_priv->label);
-
- /* Add some extra space on the right to balance the pixmap */
- if (pixmap) {
- alignment = gtk_alignment_new (0., 0., 0., 0.);
- gtk_widget_set_size_request (alignment, GNOME_PAD, -1);
- gtk_widget_show (alignment);
-
- gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
- }
-
- /* Add the "Don't show this message again." checkbox */
- messagebox->_priv->checkbox = gtk_check_button_new_with_label (_("Don't show this message again."));
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (messagebox)->vbox),
- messagebox->_priv->checkbox, TRUE, TRUE, 10);
- gtk_widget_show (messagebox->_priv->checkbox);
-
- if (buttons) {
- while (buttons[i]) {
- gnome_dialog_append_button (GNOME_DIALOG (messagebox),
- buttons[i]);
- i++;
- };
- }
-
- if (GNOME_DIALOG (messagebox)->buttons)
- gtk_widget_grab_focus (g_list_last (GNOME_DIALOG (messagebox)->buttons)->data);
-
- gnome_dialog_set_close (GNOME_DIALOG (messagebox), TRUE);
-}
-
-/**
- * e_message_box_new:
- * @message: The message to be displayed.
- * @message_box_type: The type of the message
- * @...: A NULL terminated list of strings to use in each button.
- *
- * Creates a dialog box of type @message_box_type with @message. A number
- * of buttons are inserted on it. You can use the GNOME stock identifiers
- * to create gnome-stock-buttons.
- *
- * Returns a widget that has the dialog box.
- */
-GtkWidget*
-e_message_box_new (const gchar *message,
- const gchar *message_box_type, ...)
-{
- va_list ap;
- EMessageBox *message_box;
-
- g_return_val_if_fail (message != NULL, NULL);
- g_return_val_if_fail (message_box_type != NULL, NULL);
-
- va_start (ap, message_box_type);
-
- message_box = gtk_type_new (e_message_box_get_type ());
-
- e_message_box_construct (message_box, message, message_box_type, NULL);
-
- /* we need to add buttons by hand here */
- while (TRUE) {
- gchar * button_name;
-
- button_name = va_arg (ap, gchar *);
-
- if (button_name == NULL) {
- break;
- }
-
- gnome_dialog_append_button (GNOME_DIALOG (message_box), button_name);
- }
-
- va_end (ap);
-
- gtk_widget_grab_focus (g_list_last (GNOME_DIALOG (message_box)->buttons)->data);
-
- return GTK_WIDGET (message_box);
-}
-
-/**
- * e_message_box_newv:
- * @message: The message to be displayed.
- * @message_box_type: The type of the message
- * @buttons: a NULL terminated array with the buttons to insert.
- *
- * Creates a dialog box of type @message_box_type with @message. A number
- * of buttons are inserted on it, the messages come from the @buttons array.
- * You can use the GNOME stock identifiers to create gnome-stock-buttons.
- * The buttons array can be NULL if you wish to add buttons yourself later.
- *
- * Returns a widget that has the dialog box.
- */
-GtkWidget*
-e_message_box_newv (const gchar *message,
- const gchar *message_box_type,
- const gchar **buttons)
-{
- EMessageBox *message_box;
-
- g_return_val_if_fail (message != NULL, NULL);
- g_return_val_if_fail (message_box_type != NULL, NULL);
-
- message_box = gtk_type_new (e_message_box_get_type ());
-
- e_message_box_construct (message_box, message,
- message_box_type, buttons);
-
- return GTK_WIDGET (message_box);
-}
-
-
-/**
- * e_message_box_get_label:
- * @messagebox: The message box to work on
- *
- * Gets the label widget of the message box. You should use this
- * function instead of using the structure directly.
- *
- * Returns: the widget of the label with the message */
-GtkWidget *
-e_message_box_get_label (EMessageBox *messagebox)
-{
- g_return_val_if_fail (messagebox != NULL, NULL);
- g_return_val_if_fail (E_IS_MESSAGE_BOX (messagebox), NULL);
-
- return messagebox->_priv->label;
-}
-
-
-/**
- * e_message_box_get_checkbox:
- * @messagebox: The message box to work on
- *
- * Gets the checkbox widget of the message box. You should use this
- * function instead of using the structure directly.
- *
- * Returns: the checkbox widget */
-GtkWidget *
-e_message_box_get_checkbox (EMessageBox *messagebox)
-{
- g_return_val_if_fail (messagebox != NULL, NULL);
- g_return_val_if_fail (E_IS_MESSAGE_BOX (messagebox), NULL);
-
- return messagebox->_priv->checkbox;
-}
diff --git a/widgets/misc/e-messagebox.h b/widgets/misc/e-messagebox.h
deleted file mode 100644
index a659262767..0000000000
--- a/widgets/misc/e-messagebox.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Original Author: Jay Painter
- * Modified: Jeffrey Stedfast
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef __E_MESSAGE_BOX_H__
-#define __E_MESSAGE_BOX_H__
-
-#warning "e_messagebox is deprecated, use gtk_message_box instead"
-
-#include <glib.h>
-#include <gtk/gtkwidget.h>
-#include <libgnomeui/gnome-dialog.h>
-
-#define E_TYPE_MESSAGE_BOX (e_message_box_get_type ())
-#define E_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MESSAGE_BOX, EMessageBox))
-#define E_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MESSAGE_BOX, EMessageBoxClass))
-#define E_IS_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MESSAGE_BOX))
-#define E_IS_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_MESSAGE_BOX))
-#define E_MESSAGE_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), E_TYPE_MESSAGE_BOX, EMessageBoxClass))
-
-
-#define E_MESSAGE_BOX_INFO "info"
-#define E_MESSAGE_BOX_WARNING "warning"
-#define E_MESSAGE_BOX_ERROR "error"
-#define E_MESSAGE_BOX_QUESTION "question"
-#define E_MESSAGE_BOX_GENERIC "generic"
-
-
-typedef struct _EMessageBox EMessageBox;
-typedef struct _EMessageBoxPrivate EMessageBoxPrivate;
-typedef struct _EMessageBoxClass EMessageBoxClass;
-typedef struct _EMessageBoxButton EMessageBoxButton;
-
-struct _EMessageBox
-{
- GnomeDialog dialog;
- /*< private >*/
- EMessageBoxPrivate *_priv;
-};
-
-struct _EMessageBoxClass
-{
- GnomeDialogClass parent_class;
-};
-
-
-GtkType e_message_box_get_type (void) G_GNUC_CONST;
-GtkWidget* e_message_box_new (const gchar *message,
- const gchar *messagebox_type,
- ...);
-
-GtkWidget* e_message_box_newv (const gchar *message,
- const gchar *messagebox_type,
- const gchar **buttons);
-
-void e_message_box_construct (EMessageBox *messagebox,
- const gchar *message,
- const gchar *messagebox_type,
- const gchar **buttons);
-
-GtkWidget *e_message_box_get_label (EMessageBox *messagebox);
-
-GtkWidget *e_message_box_get_checkbox (EMessageBox *messagebox);
-
-#endif /* __E_MESSAGE_BOX_H__ */
diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c
deleted file mode 100644
index c13aca4a49..0000000000
--- a/widgets/misc/e-multi-config-dialog.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-multi-config-dialog.c
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-multi-config-dialog.h"
-
-#include "e-clipped-label.h"
-
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/e-table/e-table-memory-store.h>
-#include <gal/e-table/e-cell-pixbuf.h>
-#include <gal/e-table/e-cell-vbox.h>
-#include <gal/e-table/e-cell-text.h>
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-
-#define PARENT_TYPE gtk_dialog_get_type ()
-static GtkDialogClass *parent_class = NULL;
-
-#define SWITCH_PAGE_INTERVAL 250
-
-
-
-struct _EMultiConfigDialogPrivate {
- GSList *pages;
-
- GtkWidget *list_e_table;
- ETableModel *list_e_table_model;
-
- GtkWidget *notebook;
-
- int num_unapplied;
-
- int set_page_timeout_id;
- int set_page_timeout_page;
-};
-
-
-/* ETable stuff. */
-
-static char *list_e_table_spec =
- "<ETableSpecification cursor-mode=\"line\""
- " selection-mode=\"browse\""
- " no-headers=\"true\""
- " alternating-row-colors=\"false\""
- " horizontal-resize=\"true\""
- ">"
- " <ETableColumn model_col=\"0\""
- " expansion=\"1.0\""
- " cell=\"vbox\""
- " minimum_width=\"32\""
- " resizable=\"true\""
- " _title=\"blah\""
- " compare=\"string\"/>"
- " <ETableState>"
- " <column source=\"0\"/>"
- " <grouping>"
- " </grouping>"
- " </ETableState>"
- "</ETableSpecification>";
-
-
-/* Button handling. */
-
-static void
-update_buttons (EMultiConfigDialog *dialog)
-{
- EMultiConfigDialogPrivate *priv;
-
- priv = dialog->priv;
-
- if (priv->num_unapplied > 0) {
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, TRUE);
- } else {
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE);
- }
-}
-
-
-/* Page handling. */
-
-static GtkWidget *
-create_page_container (const char *description,
- GtkWidget *widget)
-{
- GtkWidget *vbox;
-
- vbox = gtk_vbox_new (FALSE, 3);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
-
-#if 0
- label = e_clipped_label_new (description);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
-
- gtk_widget_show (label);
- gtk_widget_show (separator);
-#endif
-
- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
-
- gtk_widget_show (widget);
- gtk_widget_show (vbox);
-
- return vbox;
-}
-
-/* Page callbacks. */
-
-static void
-page_changed_callback (EConfigPage *page,
- void *data)
-{
- EMultiConfigDialog *dialog;
- EMultiConfigDialogPrivate *priv;
-
- dialog = E_MULTI_CONFIG_DIALOG (data);
- priv = dialog->priv;
-
- priv->num_unapplied ++;
-
- update_buttons (dialog);
-}
-
-/* Timeout for switching pages (so it's more comfortable navigating with the
- keyboard). */
-
-static int
-set_page_timeout_callback (void *data)
-{
- EMultiConfigDialog *multi_config_dialog;
- EMultiConfigDialogPrivate *priv;
-
- multi_config_dialog = E_MULTI_CONFIG_DIALOG (data);
- priv = multi_config_dialog->priv;
-
- gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), priv->set_page_timeout_page);
-
- priv->set_page_timeout_id = 0;
- return FALSE;
-}
-
-
-
-/* Button handling. */
-
-static void
-do_close (EMultiConfigDialog *dialog)
-{
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
-do_apply (EMultiConfigDialog *dialog)
-{
- EMultiConfigDialogPrivate *priv;
- GSList *p;
-
- priv = dialog->priv;
-
- for (p = priv->pages; p != NULL; p = p->next) {
- EConfigPage *page_widget = p->data;
-
- if (! e_config_page_is_applied (page_widget)) {
- e_config_page_apply (page_widget);
- priv->num_unapplied --;
- }
- }
-
- g_assert (priv->num_unapplied == 0);
- update_buttons (dialog);
-}
-
-static void
-do_ok (EMultiConfigDialog *dialog)
-{
- do_apply (dialog);
- do_close (dialog);
-}
-
-
-
-
-/* ETable signals. */
-
-static void
-table_cursor_change_callback (ETable *etable,
- int row,
- void *data)
-{
- EMultiConfigDialog *dialog;
- EMultiConfigDialogPrivate *priv;
-
- dialog = E_MULTI_CONFIG_DIALOG (data);
- priv = dialog->priv;
-
- if (priv->set_page_timeout_id == 0)
- priv->set_page_timeout_id = g_timeout_add (SWITCH_PAGE_INTERVAL,
- set_page_timeout_callback,
- dialog);
-
- priv->set_page_timeout_page = row;
-}
-
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- EMultiConfigDialog *dialog;
- EMultiConfigDialogPrivate *priv;
-
- dialog = E_MULTI_CONFIG_DIALOG (object);
- priv = dialog->priv;
-
- if (priv->set_page_timeout_id != 0)
- g_source_remove (priv->set_page_timeout_id);
-
- g_slist_free (priv->pages);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-/* GtkDialog methods. */
-
-static void
-impl_response (GtkDialog *dialog,
- int response_id)
-{
- EMultiConfigDialog *multi_config_dialog;
- EMultiConfigDialogPrivate *priv;
-
- multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog);
- priv = multi_config_dialog->priv;
-
- switch (response_id) {
- case GTK_RESPONSE_OK:
- do_ok (multi_config_dialog);
- break;
- case GTK_RESPONSE_APPLY:
- do_apply (multi_config_dialog);
- break;
- case GTK_RESPONSE_CLOSE:
- default:
- do_close (multi_config_dialog);
- break;
- }
-}
-
-
-/* GObject ctors. */
-
-static void
-class_init (EMultiConfigDialogClass *class)
-{
- GObjectClass *object_class;
- GtkDialogClass *dialog_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = impl_finalize;
-
- dialog_class = GTK_DIALOG_CLASS (class);
- dialog_class->response = impl_response;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-}
-
-#define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \
- ((color).green & 0xff00) | \
- ((color).blue & 0xff00) >> 8)
-
-static void
-fill_in_pixbufs (EMultiConfigDialog *dialog, int row)
-{
- GdkPixbuf *original = e_table_model_value_at (dialog->priv->list_e_table_model, 1, row);
- GtkWidget *canvas;
- guint32 colors[3];
- int i;
-
- if (original == NULL)
- return;
-
- canvas = GTK_WIDGET (e_table_scrolled_get_table (E_TABLE_SCROLLED (dialog->priv->list_e_table))->table_canvas);
-
- colors[0] = RGB_COLOR (canvas->style->bg [GTK_STATE_SELECTED]);
- colors[1] = RGB_COLOR (canvas->style->bg [GTK_STATE_ACTIVE]);
- colors[2] = RGB_COLOR (canvas->style->base [GTK_STATE_NORMAL]);
-
- for (i = 0; i < 3; i++) {
- GdkPixbuf *pixbuf = gdk_pixbuf_composite_color_simple (original,
- gdk_pixbuf_get_width (original),
- gdk_pixbuf_get_height (original),
- GDK_INTERP_BILINEAR,
- 255,
- 1,
- colors[i], colors[i]);
- e_table_model_set_value_at (dialog->priv->list_e_table_model, i + 2, row, pixbuf);
- g_object_unref(pixbuf);
- }
-}
-
-static void
-canvas_realize (GtkWidget *widget, EMultiConfigDialog *dialog)
-{
- int i;
- int row_count;
- row_count = e_table_model_row_count (dialog->priv->list_e_table_model);
- for (i = 0; i < row_count; i++) {
- fill_in_pixbufs (dialog, i);
- }
-}
-
-
-static ETableMemoryStoreColumnInfo columns[] = {
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_TERMINATOR
-};
-
-static void
-init (EMultiConfigDialog *multi_config_dialog)
-{
- EMultiConfigDialogPrivate *priv;
- ETableModel *list_e_table_model;
- GtkWidget *dialog_vbox;
- GtkWidget *hbox;
- GtkWidget *notebook;
- GtkWidget *list_e_table;
- ETableExtras *extras;
- ECell *pixbuf;
- ECell *text;
- ECell *vbox;
-
- hbox = gtk_hbox_new (FALSE, 2);
- dialog_vbox = GTK_DIALOG (multi_config_dialog)->vbox;
- gtk_container_add (GTK_CONTAINER (dialog_vbox), hbox);
-
- list_e_table_model = e_table_memory_store_new (columns);
-
- vbox = e_cell_vbox_new ();
-
- pixbuf = e_cell_pixbuf_new();
- g_object_set (G_OBJECT (pixbuf),
- "focused_column", 2,
- "selected_column", 3,
- "unselected_column", 4,
- NULL);
- e_cell_vbox_append (E_CELL_VBOX (vbox), pixbuf, 1);
- g_object_unref (pixbuf);
-
- text = e_cell_text_new (NULL, GTK_JUSTIFY_CENTER);
- e_cell_vbox_append (E_CELL_VBOX (vbox), text, 0);
- g_object_unref (text);
-
- extras = e_table_extras_new ();
- e_table_extras_add_cell (extras, "vbox", vbox);
-
- list_e_table = e_table_scrolled_new (list_e_table_model, extras, list_e_table_spec, NULL);
- e_scroll_frame_set_policy (E_SCROLL_FRAME (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table)),
- "cursor_change", G_CALLBACK (table_cursor_change_callback), multi_config_dialog);
-
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas,
- "realize", G_CALLBACK (canvas_realize), multi_config_dialog);
-
- g_object_unref (extras);
-
- gtk_box_pack_start (GTK_BOX (hbox), list_e_table, FALSE, TRUE, 0);
-
- 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, TRUE, TRUE, 0);
-
- gtk_widget_show (hbox);
- gtk_widget_show (notebook);
- gtk_widget_show (list_e_table);
-
- gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog),
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK);
-
-
- gtk_window_set_policy (GTK_WINDOW (multi_config_dialog),
- FALSE /* allow_shrink */,
- TRUE /* allow_grow */,
- FALSE /* auto_shrink */);
-
- priv = g_new (EMultiConfigDialogPrivate, 1);
- priv->pages = NULL;
- priv->list_e_table = list_e_table;
- priv->list_e_table_model = list_e_table_model;
- priv->notebook = notebook;
- priv->num_unapplied = 0;
- priv->set_page_timeout_id = 0;
- priv->set_page_timeout_page = 0;
-
- multi_config_dialog->priv = priv;
-}
-
-
-GtkWidget *
-e_multi_config_dialog_new (void)
-{
- EMultiConfigDialog *dialog;
-
- dialog = gtk_type_new (e_multi_config_dialog_get_type ());
-
- return GTK_WIDGET (dialog);
-}
-
-
-void
-e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
- const char *title,
- const char *description,
- GdkPixbuf *icon,
- EConfigPage *page_widget)
-{
- EMultiConfigDialogPrivate *priv;
-
- g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
- g_return_if_fail (title != NULL);
- g_return_if_fail (description != NULL);
- g_return_if_fail (E_IS_CONFIG_PAGE (page_widget));
-
- priv = dialog->priv;
-
- priv->pages = g_slist_append (priv->pages, page_widget);
-
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (priv->list_e_table_model), -1, NULL, title, icon, NULL, NULL, NULL);
-
- if (GTK_WIDGET_REALIZED (e_table_scrolled_get_table (E_TABLE_SCROLLED (dialog->priv->list_e_table))->table_canvas)) {
- fill_in_pixbufs (dialog, e_table_model_row_count (priv->list_e_table_model) - 1);
- }
-
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
- create_page_container (description, GTK_WIDGET (page_widget)),
- NULL);
-
- if (priv->pages->next == NULL) {
- ETable *table;
-
- /* FIXME: This is supposed to select the first entry by default
- but it doesn't seem to work at all. */
- table = e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->list_e_table));
- e_table_set_cursor_row (table, 0);
- e_selection_model_select_all (e_table_get_selection_model (table));
- }
-
- if (! e_config_page_is_applied (page_widget))
- priv->num_unapplied ++;
-
- g_signal_connect (page_widget, "changed", G_CALLBACK (page_changed_callback), dialog);
-
- update_buttons (dialog);
-}
-
-void
-e_multi_config_dialog_show_page (EMultiConfigDialog *dialog, int page)
-{
- EMultiConfigDialogPrivate *priv;
-
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
-
- priv = dialog->priv;
-
- e_table_set_cursor_row (e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->list_e_table)), page);
- gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), page);
-}
-
-
-E_MAKE_TYPE (e_multi_config_dialog, "EMultiConfigDialog", EMultiConfigDialog, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-multi-config-dialog.h b/widgets/misc/e-multi-config-dialog.h
deleted file mode 100644
index 0a4c32d7a4..0000000000
--- a/widgets/misc/e-multi-config-dialog.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-multi-config-dialog.h
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef _E_MULTI_CONFIG_DIALOG_H_
-#define _E_MULTI_CONFIG_DIALOG_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-config-page.h"
-
-#include <gtk/gtkdialog.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MULTI_CONFIG_DIALOG (e_multi_config_dialog_get_type ())
-#define E_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialog))
-#define E_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass))
-#define E_IS_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG))
-#define E_IS_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG))
-
-
-typedef struct _EMultiConfigDialog EMultiConfigDialog;
-typedef struct _EMultiConfigDialogPrivate EMultiConfigDialogPrivate;
-typedef struct _EMultiConfigDialogClass EMultiConfigDialogClass;
-
-struct _EMultiConfigDialog {
- GtkDialog parent;
-
- EMultiConfigDialogPrivate *priv;
-};
-
-struct _EMultiConfigDialogClass {
- GtkDialogClass parent_class;
-};
-
-
-GtkType e_multi_config_dialog_get_type (void);
-GtkWidget *e_multi_config_dialog_new (void);
-
-void e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
- const char *title,
- const char *description,
- GdkPixbuf *icon,
- EConfigPage *page);
-void e_multi_config_dialog_show_page (EMultiConfigDialog *dialog,
- int page);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_MULTI_CONFIG_DIALOG_H_ */
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
deleted file mode 100644
index b8745625ca..0000000000
--- a/widgets/misc/e-popup-menu.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-popup-menu.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Jody Goldberg (jgoldberg@home.com)
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gtk/gtkimage.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkaccellabel.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkimagemenuitem.h>
-
-#include "e-popup-menu.h"
-#include "e-gui-utils.h"
-
-#include <gal/util/e-i18n.h>
-
-/*
- * Creates an item with an optional icon
- */
-static void
-make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap)
-{
- GtkWidget *label;
-
- if (*name == '\0')
- return;
-
- /*
- * Ugh. This needs to go into Gtk+
- */
- label = gtk_label_new_with_mnemonic (name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
-
- gtk_container_add (GTK_CONTAINER (item), label);
-
- if (pixmap && GTK_IS_IMAGE_MENU_ITEM (item)){
- gtk_widget_show (pixmap);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), pixmap);
- }
-}
-
-GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure)
-{
- return e_popup_menu_create_with_domain (menu_list,
- disable_mask,
- hide_mask,
- default_closure,
- NULL);
-}
-
-
-GtkMenu *
-e_popup_menu_create_with_domain (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure,
- const char *domain)
-{
- GtkMenu *menu = GTK_MENU (gtk_menu_new ());
- GSList *group = NULL;
- gboolean last_item_separator = TRUE;
- int last_non_separator = -1;
- int i;
-
- for (i = 0; menu_list[i].name; i++) {
- if (strcmp ("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) {
- last_non_separator = i;
- }
- }
-
- for (i = 0; i <= last_non_separator; i++) {
- gboolean separator;
-
- separator = !strcmp ("", menu_list[i].name);
-
- if ((!(separator && last_item_separator)) && !(menu_list [i].disable_mask & hide_mask)) {
- GtkWidget *item = NULL;
-
- if (!separator) {
- if (menu_list[i].is_toggle)
- item = gtk_check_menu_item_new ();
- else if (menu_list[i].is_radio)
- item = gtk_radio_menu_item_new (group);
- else
- item = menu_list[i].pixmap_widget ? gtk_image_menu_item_new () : gtk_menu_item_new ();
- if (menu_list[i].is_toggle || menu_list[i].is_radio)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active);
- if (menu_list[i].is_radio)
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
-
- make_item (menu, GTK_MENU_ITEM (item), dgettext(domain, menu_list[i].name), menu_list[i].pixmap_widget);
- } else {
- item = gtk_menu_item_new ();
- }
-
- gtk_menu_append (menu, item);
-
- if (!menu_list[i].submenu) {
- if (menu_list[i].fn)
- g_signal_connect (item, "activate",
- G_CALLBACK (menu_list[i].fn),
- menu_list[i].use_custom_closure ? menu_list[i].closure : default_closure);
- } else {
- /* submenu */
- GtkMenu *submenu;
-
- submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask,
- default_closure);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
- }
-
- if (menu_list[i].disable_mask & disable_mask)
- gtk_widget_set_sensitive (item, FALSE);
-
- gtk_widget_show (item);
-
- last_item_separator = separator;
- }
- }
-
- return menu;
-}
-
-void
-e_popup_menu_run (EPopupMenu *menu_list, GdkEvent *event, guint32 disable_mask, guint32 hide_mask, void *default_closure)
-{
- GtkMenu *menu;
-
- g_return_if_fail (menu_list != NULL);
- g_return_if_fail (event != NULL);
-
- menu = e_popup_menu_create (menu_list, disable_mask, hide_mask, default_closure);
-
- e_popup_menu (menu, event);
-}
-
-void
-e_popup_menu_copy_1 (EPopupMenu *destination,
- const EPopupMenu *source)
-{
- destination->name = g_strdup (source->name);
- destination->pixname = g_strdup (source->pixname);
- destination->fn = source->fn;
- destination->submenu = e_popup_menu_copy (source->submenu);
- destination->disable_mask = source->disable_mask;
-
- destination->pixmap_widget = source->pixmap_widget;
- if (destination->pixmap_widget)
- g_object_ref (destination->pixmap_widget);
- destination->closure = source->closure;
-
- destination->is_toggle = source->is_toggle;
- destination->is_radio = source->is_radio;
- destination->is_active = source->is_active;
-
- destination->use_custom_closure = source->use_custom_closure;
-}
-
-void
-e_popup_menu_free_1 (EPopupMenu *menu_item)
-{
- g_free (menu_item->name);
- g_free (menu_item->pixname);
- e_popup_menu_free (menu_item->submenu);
-
- if (menu_item->pixmap_widget)
- g_object_unref (menu_item->pixmap_widget);
-}
-
-EPopupMenu *
-e_popup_menu_copy (const EPopupMenu *menu_list)
-{
- int i;
- EPopupMenu *ret_val;
-
- if (menu_list == NULL)
- return NULL;
-
- for (i = 0; menu_list[i].name; i++) {
- /* Intentionally empty */
- }
-
- ret_val = g_new (EPopupMenu, i + 1);
-
- for (i = 0; menu_list[i].name; i++) {
- e_popup_menu_copy_1 (ret_val + i, menu_list + i);
- }
-
- /* Copy the terminator */
- e_popup_menu_copy_1 (ret_val + i, menu_list + i);
-
- return ret_val;
-}
-
-void
-e_popup_menu_free (EPopupMenu *menu_list)
-{
- int i;
-
- if (menu_list == NULL)
- return;
-
- for (i = 0; menu_list[i].name; i++) {
- e_popup_menu_free_1 (menu_list + i);
- }
- g_free (menu_list);
-}
-
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
deleted file mode 100644
index 7289ab5c86..0000000000
--- a/widgets/misc/e-popup-menu.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-popup-menu.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Jody Goldberg (jgoldberg@home.com)
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef E_POPUP_MENU_H
-#define E_POPUP_MENU_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwidget.h>
-
-G_BEGIN_DECLS
-
-#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 }
-#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
-
-
-/* In the following, CC = custom closure */
-
-#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-
-
-#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
-
-#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 }
-#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
-
-
-/* In the following, CC = custom closure */
-
-#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-
-
-#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
-
-#define E_POPUP_TOGGLE_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
-
-#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 1, 0, value, 1 }
-
-
-#define E_POPUP_RADIO_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
-
-#define E_POPUP_RADIO_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
-
-#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 1, value, 1 }
-
-
-typedef struct _EPopupMenu EPopupMenu;
-
-struct _EPopupMenu {
- char *name;
- char *pixname;
- GtkSignalFunc fn;
-
- EPopupMenu *submenu;
- guint32 disable_mask;
-
- /* Added post 0.19 */
- GtkWidget *pixmap_widget;
- void *closure;
-
- guint is_toggle : 1;
- guint is_radio : 1;
- guint is_active : 1;
-
- guint use_custom_closure : 1;
-};
-
-GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-GtkMenu *e_popup_menu_create_with_domain (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure,
- const char *domain);
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEvent *event,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-
-/* Doesn't copy or free the memory. Just the contents. */
-void e_popup_menu_copy_1 (EPopupMenu *destination,
- const EPopupMenu *menu_item);
-void e_popup_menu_free_1 (EPopupMenu *menu_item);
-
-/* Copies or frees the entire structure. */
-EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item);
-void e_popup_menu_free (EPopupMenu *menu_item);
-
-G_END_DECLS
-
-#endif /* E_POPUP_MENU_H */
diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c
deleted file mode 100644
index 534f153823..0000000000
--- a/widgets/misc/e-printable.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-printable.h"
-
-#define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE GTK_TYPE_OBJECT
-
-
-static GtkObjectClass *e_printable_parent_class;
-
-enum {
- PRINT_PAGE,
- DATA_LEFT,
- RESET,
- HEIGHT,
- WILL_FIT,
- LAST_SIGNAL
-};
-
-static guint e_printable_signals [LAST_SIGNAL] = { 0, };
-
-static void
-e_printable_class_init (GtkObjectClass *object_class)
-{
- EPrintableClass *klass = E_PRINTABLE_CLASS(object_class);
- e_printable_parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_printable_signals [PRINT_PAGE] =
- g_signal_new ("print_page",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, print_page),
- NULL, NULL,
- e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- e_printable_signals [DATA_LEFT] =
- g_signal_new ("data_left",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, data_left),
- NULL, NULL,
- e_marshal_BOOLEAN__NONE,
- G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
-
- e_printable_signals [RESET] =
- g_signal_new ("reset",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, reset),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0, G_TYPE_NONE);
-
- e_printable_signals [HEIGHT] =
- g_signal_new ("height",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, height),
- NULL, NULL,
- e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_DOUBLE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- e_printable_signals [WILL_FIT] =
- g_signal_new ("will_fit",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, will_fit),
- NULL, NULL,
- e_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_BOOLEAN, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- klass->print_page = NULL;
- klass->data_left = NULL;
- klass->reset = NULL;
- klass->height = NULL;
- klass->will_fit = NULL;
-}
-
-
-E_MAKE_TYPE (e_printable,
- "EPrintable",
- EPrintable,
- e_printable_class_init,
- NULL,
- PARENT_TYPE)
-
-EPrintable *
-e_printable_new(void)
-{
- return E_PRINTABLE(g_object_new(E_PRINTABLE_TYPE, NULL));
-}
-
-void
-e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- g_signal_emit (e_printable,
- e_printable_signals [PRINT_PAGE], 0,
- context,
- width,
- height,
- quantized);
-}
-
-gboolean
-e_printable_data_left (EPrintable *e_printable)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, FALSE);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), FALSE);
-
- g_signal_emit (e_printable,
- e_printable_signals [DATA_LEFT], 0,
- &ret_val);
-
- return ret_val;
-}
-
-void
-e_printable_reset (EPrintable *e_printable)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- g_signal_emit (e_printable,
- e_printable_signals [RESET], 0);
-}
-
-gdouble
-e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gdouble ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- g_signal_emit (e_printable,
- e_printable_signals [HEIGHT], 0,
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
-
-gboolean
-e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- g_signal_emit (e_printable,
- e_printable_signals [WILL_FIT], 0,
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h
deleted file mode 100644
index 0c665f89c2..0000000000
--- a/widgets/misc/e-printable.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_PRINTABLE_H_
-#define _E_PRINTABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <libgnomeprint/gnome-print.h>
-
-G_BEGIN_DECLS
-
-#define E_PRINTABLE_TYPE (e_printable_get_type ())
-#define E_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_PRINTABLE_TYPE, EPrintable))
-#define E_PRINTABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass))
-#define E_IS_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_PRINTABLE_TYPE))
-#define E_IS_PRINTABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_PRINTABLE_TYPE))
-
-typedef struct {
- GtkObject base;
-} EPrintable;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
-
- void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized);
- gboolean (*data_left) (EPrintable *etm);
- void (*reset) (EPrintable *etm);
- gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-
- /* e_printable_will_fit (ep, ...) should be equal in value to
- * (e_printable_print_page (ep, ...),
- * !e_printable_data_left(ep)) except that the latter has the
- * side effect of doing the printing and advancing the
- * position of the printable.
- */
-
- gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-} EPrintableClass;
-
-GtkType e_printable_get_type (void);
-
-EPrintable *e_printable_new (void);
-
-/*
- * Routines for emitting signals on the e_table */
-void e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized);
-gboolean e_printable_data_left (EPrintable *e_printable);
-void e_printable_reset (EPrintable *e_printable);
-gdouble e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-gboolean e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-
-G_END_DECLS
-
-#endif /* _E_PRINTABLE_H_ */
diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c
deleted file mode 100644
index 489a18b7e1..0000000000
--- a/widgets/misc/e-reflow-model.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include "e-reflow-model.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-#define d(x)
-
-d(static gint depth = 0;)
-
-
-static GObjectClass *e_reflow_model_parent_class;
-
-enum {
- MODEL_CHANGED,
- MODEL_ITEMS_INSERTED,
- MODEL_ITEM_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_reflow_model_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_reflow_model_set_width:
- * @e_reflow_model: The e-reflow-model to operate on
- * @width: The new value for the width of each item.
- */
-void
-e_reflow_model_set_width (EReflowModel *e_reflow_model, int width)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->set_width (e_reflow_model, width);
-}
-
-/**
- * e_reflow_model_count:
- * @e_reflow_model: The e-reflow-model to operate on
- *
- * Returns: the number of items in the reflow model.
- */
-int
-e_reflow_model_count (EReflowModel *e_reflow_model)
-{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->count (e_reflow_model);
-}
-
-/**
- * e_reflow_model_height:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item number to get the height of.
- * @parent: The parent GnomeCanvasItem.
- *
- * Returns: the height of the nth item.
- */
-int
-e_reflow_model_height (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent)
-{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->height (e_reflow_model, n, parent);
-}
-
-/**
- * e_reflow_model_incarnate:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item to create.
- * @parent: The parent GnomeCanvasItem to create a child of.
- *
- * Create a GnomeCanvasItem to represent the nth piece of data.
- *
- * Returns: the new GnomeCanvasItem.
- */
-GnomeCanvasItem *
-e_reflow_model_incarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent)
-{
- g_return_val_if_fail (e_reflow_model != NULL, NULL);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL);
-
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent);
-}
-
-/**
- * e_reflow_model_compare:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n1: The first item to compare
- * @n2: The second item to compare
- *
- * Compares item n1 and item n2 to see which should come first.
- *
- * Returns: strcmp like semantics for the comparison value.
- */
-int
-e_reflow_model_compare (EReflowModel *e_reflow_model, int n1, int n2)
-{
-#if 0
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-#endif
-
- return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2);
-}
-
-/**
- * e_reflow_model_reincarnate:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item to create.
- * @item: The item to reuse.
- *
- * Update item to represent the nth piece of data.
- */
-void
-e_reflow_model_reincarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasItem *item)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item);
-}
-
-static void
-e_reflow_model_class_init (GObjectClass *object_class)
-{
- EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class);
- e_reflow_model_parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_reflow_model_signals [MODEL_CHANGED] =
- g_signal_new ("model_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_reflow_model_signals [MODEL_ITEMS_INSERTED] =
- g_signal_new ("model_items_inserted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_items_inserted),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_reflow_model_signals [MODEL_ITEM_CHANGED] =
- g_signal_new ("model_item_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_item_changed),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- klass->set_width = NULL;
- klass->count = NULL;
- klass->height = NULL;
- klass->incarnate = NULL;
- klass->reincarnate = NULL;
-
- klass->model_changed = NULL;
- klass->model_items_inserted = NULL;
- klass->model_item_changed = NULL;
-}
-
-static void
-e_reflow_model_init (GObject *object)
-{
-}
-
-E_MAKE_TYPE(e_reflow_model, "EReflowModel", EReflowModel,
- e_reflow_model_class_init, e_reflow_model_init, PARENT_TYPE)
-
-#if d(!)0
-static void
-print_tabs (void)
-{
- int i;
- for (i = 0; i < depth; i++)
- g_print("\t");
-}
-#endif
-
-/**
- * e_reflow_model_changed:
- * @e_reflow_model: the reflow model to notify of the change
- *
- * Use this function to notify any views of this reflow model that
- * the contents of the reflow model have changed. This will emit
- * the signal "model_changed" on the @e_reflow_model object.
- *
- * It is preferable to use the e_reflow_model_item_changed() signal to
- * notify of smaller changes than to invalidate the entire model, as
- * the views might have ways of caching the information they render
- * from the model.
- */
-void
-e_reflow_model_changed (EReflowModel *e_reflow_model)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting model_changed on model 0x%p.\n", e_reflow_model));
- d(depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_CHANGED], 0);
- d(depth--);
-}
-
-/**
- * e_reflow_model_items_inserted:
- * @e_reflow_model: The model changed.
- * @position: The position the items were insert in.
- * @count: The number of items inserted.
- *
- * Use this function to notify any views of the reflow model that a number of items have been inserted.
- **/
-void
-e_reflow_model_items_inserted (EReflowModel *e_reflow_model, int position, int count)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting items_inserted on model 0x%p, position=%d, count=%d.\n", e_reflow_model, position, count));
- d(depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_ITEMS_INSERTED], 0,
- position, count);
- d(depth--);
-}
-
-/**
- * e_reflow_model_item_changed:
- * @e_reflow_model: the reflow model to notify of the change
- * @item: the item that was changed in the model.
- *
- * Use this function to notify any views of the reflow model that the
- * contents of item @item have changed in model such that the height
- * has changed or the item needs to be reincarnated. This function
- * will emit the "model_item_changed" signal on the @e_reflow_model
- * object
- */
-void
-e_reflow_model_item_changed (EReflowModel *e_reflow_model, int n)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting item_changed on model 0x%p, n=%d.\n", e_reflow_model, n));
- d(depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_ITEM_CHANGED], 0,
- n);
- d(depth--);
-}
diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h
deleted file mode 100644
index b755cee447..0000000000
--- a/widgets/misc/e-reflow-model.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_REFLOW_MODEL_H_
-#define _E_REFLOW_MODEL_H_
-
-#include <glib-object.h>
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ())
-#define E_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel))
-#define E_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-#define E_IS_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_REFLOW_MODEL_TYPE))
-#define E_IS_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_TYPE))
-#define E_REFLOW_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-
-typedef struct {
- GObject base;
-} EReflowModel;
-
-typedef struct {
- GObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- void (*set_width) (EReflowModel *etm, int width);
-
- int (*count) (EReflowModel *etm);
- int (*height) (EReflowModel *etm, int n, GnomeCanvasGroup *parent);
- GnomeCanvasItem *(*incarnate) (EReflowModel *etm, int n, GnomeCanvasGroup *parent);
- int (*compare) (EReflowModel *etm, int n1, int n2);
- void (*reincarnate) (EReflowModel *etm, int n, GnomeCanvasItem *item);
-
- /*
- * Signals
- */
-
- /*
- * These all come after the change has been made.
- * Major structural changes: model_changed
- * Changes only in an item: item_changed
- */
- void (*model_changed) (EReflowModel *etm);
- void (*model_items_inserted) (EReflowModel *etm, int position, int count);
- void (*model_item_changed) (EReflowModel *etm, int n);
-} EReflowModelClass;
-
-GType e_reflow_model_get_type (void);
-
-/**/
-void e_reflow_model_set_width (EReflowModel *e_reflow_model,
- int width);
-int e_reflow_model_count (EReflowModel *e_reflow_model);
-int e_reflow_model_height (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasGroup *parent);
-GnomeCanvasItem *e_reflow_model_incarnate (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasGroup *parent);
-int e_reflow_model_compare (EReflowModel *e_reflow_model,
- int n1,
- int n2);
-void e_reflow_model_reincarnate (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasItem *item);
-
-/*
- * Routines for emitting signals on the e_reflow
- */
-void e_reflow_model_changed (EReflowModel *e_reflow_model);
-void e_reflow_model_items_inserted (EReflowModel *e_reflow_model,
- int position,
- int count);
-void e_reflow_model_item_changed (EReflowModel *e_reflow_model,
- int n);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_REFLOW_MODEL_H_ */
diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c
deleted file mode 100644
index e70cd61d0b..0000000000
--- a/widgets/misc/e-reflow.c
+++ /dev/null
@@ -1,1414 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-reflow.h"
-
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include "e-canvas-utils.h"
-#include "e-canvas.h"
-#include "gal/e-text/e-text.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-#include "gal/widgets/e-unicode.h"
-#include <gtk/gtksignal.h>
-#include "e-selection-model-simple.h"
-
-#include <string.h>
-
-static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_reflow_realize (GnomeCanvasItem *item);
-static void e_reflow_unrealize (GnomeCanvasItem *item);
-static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height);
-static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags);
-static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item);
-static void e_reflow_reflow (GnomeCanvasItem *item, int flags);
-static void set_empty(EReflow *reflow);
-
-static void e_reflow_resize_children (GnomeCanvasItem *item);
-
-#define E_REFLOW_DIVIDER_WIDTH 2
-#define E_REFLOW_BORDER_WIDTH 7
-#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_MINIMUM_WIDTH,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_EMPTY_MESSAGE,
- PROP_MODEL,
- PROP_COLUMN_WIDTH
-};
-
-enum {
- SELECTION_EVENT,
- COLUMN_WIDTH_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = {0, };
-
-static gint
-er_compare (int i1, int i2, gpointer user_data)
-{
- EReflow *reflow = user_data;
- return e_reflow_model_compare (reflow->model, i1, i2);
-}
-
-static gint
-e_reflow_pick_line (EReflow *reflow, double x)
-{
- x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- x /= reflow->column_width + E_REFLOW_FULL_GUTTER;
- return x;
-}
-
-static int
-er_find_item (EReflow *reflow, GnomeCanvasItem *item)
-{
- int i;
- for (i = 0; i < reflow->count; i++) {
- if (reflow->items[i] == item)
- return i;
- }
- return -1;
-}
-
-static void
-e_reflow_resize_children (GnomeCanvasItem *item)
-{
- EReflow *reflow;
- int i;
- int count;
-
- reflow = E_REFLOW (item);
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- if (reflow->items[i])
- gnome_canvas_item_set(reflow->items[i],
- "width", (double) reflow->column_width,
- NULL);
- }
-}
-
-static inline void
-e_reflow_update_selection_row (EReflow *reflow, int row)
-{
- if (reflow->items[row]) {
- g_object_set(reflow->items[row],
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
- NULL);
- } else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) {
- reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
- g_object_set (reflow->items[row],
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
- "width", (double) reflow->column_width,
- NULL);
- }
-}
-
-static void
-e_reflow_update_selection (EReflow *reflow)
-{
- int i;
- int count;
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- e_reflow_update_selection_row (reflow, i);
- }
-}
-
-static void
-selection_changed (ESelectionModel *selection, EReflow *reflow)
-{
- e_reflow_update_selection (reflow);
-}
-
-static void
-selection_row_changed (ESelectionModel *selection, int row, EReflow *reflow)
-{
- e_reflow_update_selection_row (reflow, row);
-}
-
-static void
-cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow)
-{
- int count = reflow->count;
- int old_cursor = reflow->cursor_row;
-
- if (old_cursor < count && old_cursor >= 0) {
- if (reflow->items[old_cursor]) {
- g_object_set (reflow->items[old_cursor],
- "has_cursor", FALSE,
- NULL);
- }
- }
-
- reflow->cursor_row = row;
-
- if (row < count && row >= 0) {
- if (reflow->items[row]) {
- g_object_set (reflow->items[row],
- "has_cursor", TRUE,
- NULL);
- } else {
- reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
- g_object_set (reflow->items[row],
- "has_cursor", TRUE,
- "width", (double) reflow->column_width,
- NULL);
- }
- }
-}
-
-static void
-incarnate (EReflow *reflow)
-{
- int column_width;
- int first_column;
- int last_column;
- int first_cell;
- int last_cell;
- int i;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
-
- column_width = reflow->column_width;
-
- first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH;
- first_column /= column_width + E_REFLOW_FULL_GUTTER;
-
- last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
- last_column /= column_width + E_REFLOW_FULL_GUTTER;
- last_column ++;
-
- if (first_column >= 0 && first_column < reflow->column_count)
- first_cell = reflow->columns[first_column];
- else
- first_cell = 0;
-
- if (last_column >= 0 && last_column < reflow->column_count)
- last_cell = reflow->columns[last_column];
- else
- last_cell = reflow->count;
-
- for (i = first_cell; i < last_cell; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->items[unsorted] == NULL) {
- if (reflow->model) {
- reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- g_object_set (reflow->items[unsorted],
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted),
- "width", (double) reflow->column_width,
- NULL);
- }
- }
- }
- reflow->incarnate_idle_id = 0;
-}
-
-static gboolean
-invoke_incarnate (gpointer user_data)
-{
- EReflow *reflow = user_data;
- incarnate (reflow);
- return FALSE;
-}
-
-static void
-queue_incarnate (EReflow *reflow)
-{
- if (reflow->incarnate_idle_id == 0)
- reflow->incarnate_idle_id =
- g_idle_add_full (25, invoke_incarnate, reflow, NULL);
-}
-
-static void
-reflow_columns (EReflow *reflow)
-{
- GSList *list;
- int count;
- int i;
- int column_count;
- double running_height;
-
- g_free (reflow->columns);
- reflow->column_count = 0;
- reflow->columns = NULL;
-
- list = NULL;
-
- running_height = E_REFLOW_BORDER_WIDTH;
- column_count = 1;
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->heights[unsorted] == -1) {
- if (reflow->model)
- reflow->heights[unsorted] = e_reflow_model_height (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- else
- reflow->heights[unsorted] = 0;
- }
- if (i != 0 && running_height + reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH > reflow->height) {
- list = g_slist_prepend (list, GINT_TO_POINTER(i));
- column_count ++;
- running_height = E_REFLOW_BORDER_WIDTH * 2 + reflow->heights[unsorted];
- } else
- running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
- }
-
- reflow->column_count = column_count;
- reflow->columns = g_new (int, column_count);
- column_count --;
- for (; column_count > 0; column_count--) {
- GSList *to_free;
- reflow->columns[column_count] = GPOINTER_TO_INT(list->data);
- to_free = list;
- list = list->next;
- g_slist_free_1 (to_free);
- }
- reflow->columns[0] = 0;
-
- queue_incarnate (reflow);
-
- reflow->need_reflow_columns = FALSE;
-}
-
-static void
-item_changed (EReflowModel *model, int i, EReflow *reflow)
-{
- if (i < 0 || i >= reflow->count)
- return;
-
- reflow->heights[i] = -1;
- if (reflow->items[i] != NULL)
- e_reflow_model_reincarnate (model, i, reflow->items[i]);
- e_sorter_array_clean (reflow->sorter);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-items_inserted (EReflowModel *model, int position, int count, EReflow *reflow)
-{
- int i;
- int oldcount;
- if (position < 0 || position > reflow->count)
- return;
-
- oldcount = reflow->count;
-
- reflow->count += count;
-
- if (reflow->count > reflow->allocated_count) {
- while (reflow->count > reflow->allocated_count)
- reflow->allocated_count += 256;
- reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count);
- reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count);
- }
- memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (int));
- memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *));
- for (i = position; i < position + count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count);
- if (position == oldcount)
- e_sorter_array_append (reflow->sorter, count);
- else
- e_sorter_array_set_count (reflow->sorter, reflow->count);
- reflow->need_reflow_columns = TRUE;
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-model_changed (EReflowModel *model, EReflow *reflow)
-{
- int i;
- int count;
- int oldcount;
-
- count = reflow->count;
- oldcount = count;
-
- for (i = 0; i < count; i++) {
- if (reflow->items[i])
- gtk_object_destroy (GTK_OBJECT (reflow->items[i]));
- }
- g_free (reflow->items);
- g_free (reflow->heights);
- reflow->count = e_reflow_model_count (model);
- reflow->allocated_count = reflow->count;
- reflow->items = g_new (GnomeCanvasItem *, reflow->count);
- reflow->heights = g_new (int, reflow->count);
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), count);
- e_sorter_array_set_count (reflow->sorter, reflow->count);
-
- reflow->need_reflow_columns = TRUE;
- if (oldcount > reflow->count)
- reflow_columns (reflow);
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-set_empty(EReflow *reflow)
-{
- if (reflow->count == 0) {
- if (reflow->empty_text) {
- if (reflow->empty_message) {
- gnome_canvas_item_set(reflow->empty_text,
- "width", reflow->minimum_width,
- "text", reflow->empty_message,
- NULL);
- e_canvas_item_move_absolute(reflow->empty_text,
- reflow->minimum_width / 2,
- 0);
- } else {
- gtk_object_destroy(GTK_OBJECT(reflow->empty_text));
- reflow->empty_text = NULL;
- }
- } else {
- if (reflow->empty_message) {
- reflow->empty_text =
- gnome_canvas_item_new(GNOME_CANVAS_GROUP(reflow),
- e_text_get_type(),
- "anchor", GTK_ANCHOR_N,
- "width", reflow->minimum_width,
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(reflow)->canvas)->style),
- "fill_color", "black",
- "justification", GTK_JUSTIFY_CENTER,
- "text", reflow->empty_message,
- "draw_background", FALSE,
- NULL);
- e_canvas_item_move_absolute(reflow->empty_text,
- reflow->minimum_width / 2,
- 0);
- }
- }
- } else {
- if (reflow->empty_text) {
- gtk_object_destroy(GTK_OBJECT(reflow->empty_text));
- reflow->empty_text = NULL;
- }
- }
-}
-
-static void
-disconnect_model (EReflow *reflow)
-{
- if (reflow->model == NULL)
- return;
-
- g_signal_handler_disconnect (reflow->model,
- reflow->model_changed_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_items_inserted_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_item_changed_id);
- g_object_unref (reflow->model);
-
- reflow->model_changed_id = 0;
- reflow->model_items_inserted_id = 0;
- reflow->model_item_changed_id = 0;
- reflow->model = NULL;
-}
-
-static void
-disconnect_selection (EReflow *reflow)
-{
- if (reflow->selection == NULL)
- return;
-
- g_signal_handler_disconnect (reflow->selection,
- reflow->selection_changed_id);
- g_signal_handler_disconnect (reflow->selection,
- reflow->selection_row_changed_id);
- g_signal_handler_disconnect (reflow->selection,
- reflow->cursor_changed_id);
- g_object_unref (reflow->selection);
-
- reflow->selection_changed_id = 0;
- reflow->selection_row_changed_id = 0;
- reflow->cursor_changed_id = 0;
- reflow->selection = NULL;
-}
-
-static void
-connect_model (EReflow *reflow, EReflowModel *model)
-{
- if (reflow->model != NULL)
- disconnect_model (reflow);
-
- if (model == NULL)
- return;
-
- reflow->model = model;
- g_object_ref (reflow->model);
- reflow->model_changed_id =
- g_signal_connect (reflow->model, "model_changed",
- G_CALLBACK (model_changed), reflow);
- reflow->model_items_inserted_id =
- g_signal_connect (reflow->model, "model_items_inserted",
- G_CALLBACK (items_inserted), reflow);
- reflow->model_item_changed_id =
- g_signal_connect (reflow->model, "model_item_changed",
- G_CALLBACK (item_changed), reflow);
- model_changed (model, reflow);
-}
-
-static void
-adjustment_changed (GtkAdjustment *adjustment, EReflow *reflow)
-{
- incarnate (reflow);
-}
-
-static void
-disconnect_adjustment (EReflow *reflow)
-{
- if (reflow->adjustment == NULL)
- return;
-
- g_signal_handler_disconnect (reflow->adjustment,
- reflow->adjustment_changed_id);
- g_signal_handler_disconnect (reflow->adjustment,
- reflow->adjustment_value_changed_id);
-
- g_object_unref (reflow->adjustment);
-
- reflow->adjustment_changed_id = 0;
- reflow->adjustment_value_changed_id = 0;
- reflow->adjustment = NULL;
-}
-
-static void
-connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment)
-{
- if (reflow->adjustment != NULL)
- disconnect_adjustment (reflow);
-
- if (adjustment == NULL)
- return;
-
- reflow->adjustment = adjustment;
- reflow->adjustment_changed_id =
- g_signal_connect (adjustment, "changed",
- G_CALLBACK (adjustment_changed), reflow);
- reflow->adjustment_value_changed_id =
- g_signal_connect (adjustment, "value_changed",
- G_CALLBACK (adjustment_changed), reflow);
- g_object_ref (adjustment);
-}
-
-#if 0
-static void
-set_scroll_adjustments (GtkLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj, EReflow *reflow)
-{
- connect_adjustment (reflow, hadj);
-}
-
-static void
-connect_set_adjustment (EReflow *reflow)
-{
- reflow->set_scroll_adjustments_id =
- g_signal_connect (GNOME_CANVAS_ITEM (reflow)->canvas,
- "set_scroll_adjustments",
- G_CALLBACK (set_scroll_adjustments), reflow);
-}
-#endif
-
-static void
-disconnect_set_adjustment (EReflow *reflow)
-{
- if (reflow->set_scroll_adjustments_id != 0) {
- g_signal_handler_disconnect (GNOME_CANVAS_ITEM (reflow)->canvas,
- reflow->set_scroll_adjustments_id);
- reflow->set_scroll_adjustments_id = 0;
- }
-}
-
-static void
-column_width_changed (EReflow *reflow)
-{
- g_signal_emit (reflow, signals[COLUMN_WIDTH_CHANGED], 0, reflow->column_width);
-}
-
-
-
-
-/* Virtual functions */
-static void
-e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- EReflow *reflow;
-
- item = GNOME_CANVAS_ITEM (object);
- reflow = E_REFLOW (object);
-
- switch (prop_id){
- case PROP_HEIGHT:
- reflow->height = g_value_get_double (value);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(item);
- break;
- case PROP_MINIMUM_WIDTH:
- reflow->minimum_width = g_value_get_double (value);
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
- set_empty(reflow);
- e_canvas_item_request_reflow(item);
- break;
- case PROP_EMPTY_MESSAGE:
- g_free(reflow->empty_message);
- reflow->empty_message = g_strdup(g_value_get_string (value));
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
- set_empty(reflow);
- break;
- case PROP_MODEL:
- connect_model (reflow, (EReflowModel *) g_value_get_object (value));
- break;
- case PROP_COLUMN_WIDTH:
- if (reflow->column_width != g_value_get_double (value)) {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- double old_width = reflow->column_width;
-
- reflow->column_width = g_value_get_double (value);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
- e_reflow_resize_children(item);
- e_canvas_item_request_reflow(item);
-
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
-
- if (old_width != reflow->column_width)
- column_width_changed (reflow);
- }
- break;
- }
-}
-
-static void
-e_reflow_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EReflow *reflow;
-
- reflow = E_REFLOW (object);
-
- switch (prop_id) {
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, reflow->minimum_width);
- break;
- case PROP_WIDTH:
- g_value_set_double (value, reflow->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, reflow->height);
- break;
- case PROP_EMPTY_MESSAGE:
- g_value_set_string (value, g_strdup(reflow->empty_message));
- break;
- case PROP_MODEL:
- g_value_set_object (value, reflow->model);
- break;
- case PROP_COLUMN_WIDTH:
- g_value_set_double (value, reflow->column_width);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_reflow_dispose (GObject *object)
-{
- EReflow *reflow = E_REFLOW(object);
-
- g_free (reflow->items);
- g_free (reflow->heights);
- g_free (reflow->columns);
-
- reflow->items = NULL;
- reflow->heights = NULL;
- reflow->columns = NULL;
- reflow->count = 0;
- reflow->allocated_count = 0;
-
- if (reflow->incarnate_idle_id)
- g_source_remove (reflow->incarnate_idle_id);
- reflow->incarnate_idle_id = 0;
-
- disconnect_model (reflow);
- disconnect_selection (reflow);
-
- g_free(reflow->empty_message);
- reflow->empty_message = NULL;
-
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static void
-e_reflow_realize (GnomeCanvasItem *item)
-{
- EReflow *reflow;
- GnomeCanvasGroup *group;
- GtkAdjustment *adjustment;
- int count;
- int i;
-
- reflow = E_REFLOW (item);
- group = GNOME_CANVAS_GROUP (item);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
-
- count = reflow->count;
- for(i = 0; i < count; i++) {
- if (reflow->items[i])
- gnome_canvas_item_set(reflow->items[i],
- "width", reflow->column_width,
- NULL);
- }
-
- set_empty(reflow);
-
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(item);
-
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
-
-#if 0
- connect_set_adjustment (reflow);
-#endif
- connect_adjustment (reflow, adjustment);
-
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
-
- if (!item->canvas->aa) {
- }
-}
-
-static void
-e_reflow_unrealize (GnomeCanvasItem *item)
-{
- EReflow *reflow;
-
- reflow = E_REFLOW (item);
-
- if (!item->canvas->aa) {
- }
-
- gdk_cursor_destroy (reflow->arrow_cursor);
- gdk_cursor_destroy (reflow->default_cursor);
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
-
- g_free (reflow->columns);
- reflow->columns = NULL;
-
- disconnect_set_adjustment (reflow);
- disconnect_adjustment (reflow);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-static gboolean
-e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EReflow *reflow;
- int return_val = FALSE;
-
- reflow = E_REFLOW (item);
-
- switch( event->type )
- {
- case GDK_KEY_PRESS:
- return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event);
- break;
-#if 0
- if (event->key.keyval == GDK_Tab ||
- event->key.keyval == GDK_KP_Tab ||
- event->key.keyval == GDK_ISO_Left_Tab) {
- int i;
- int count;
- count = reflow->count;
- for (i = 0; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- GnomeCanvasItem *item = reflow->items[unsorted];
- EFocus has_focus;
- if (item) {
- g_object_get(item,
- "has_focus", &has_focus,
- NULL);
- if (has_focus) {
- if (event->key.state & GDK_SHIFT_MASK) {
- if (i == 0)
- return 0;
- i--;
- } else {
- if (i == count - 1)
- return 0;
- i++;
- }
-
- unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->items[unsorted] == NULL) {
- reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- }
-
- item = reflow->items[unsorted];
- gnome_canvas_item_set(item,
- "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START,
- NULL);
- return 1;
- }
- }
- }
- }
-#endif
- break;
- case GDK_BUTTON_PRESS:
- switch(event->button.button)
- {
- case 1:
- {
- GdkEventButton *button = (GdkEventButton *) event;
- double n_x, max_x;
- n_x = button->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
- if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) {
- reflow->which_column_dragged = e_reflow_pick_line(reflow, button->x);
- reflow->start_x = reflow->which_column_dragged * (reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
- reflow->temp_column_width = reflow->column_width;
- reflow->column_drag = TRUE;
-
- gnome_canvas_item_grab (item,
- GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
- reflow->arrow_cursor,
- button->time);
-
- reflow->previous_temp_column_width = -1;
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- return TRUE;
- }
- }
- break;
- case 4:
- {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value -= adjustment->step_increment;
- gtk_adjustment_set_value(adjustment, new_value);
- }
- break;
- case 5:
- {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value += adjustment->step_increment;
- if ( new_value > adjustment->upper - adjustment->page_size )
- new_value = adjustment->upper - adjustment->page_size;
- gtk_adjustment_set_value(adjustment, new_value);
- }
- break;
- }
- break;
- case GDK_BUTTON_RELEASE:
- if (reflow->column_drag) {
- gdouble old_width = reflow->column_width;
- GdkEventButton *button = (GdkEventButton *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- reflow->temp_column_width = reflow->column_width +
- (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
- if ( reflow->temp_column_width < 50 )
- reflow->temp_column_width = 50;
- reflow->column_drag = FALSE;
- if ( old_width != reflow->temp_column_width ) {
- gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width));
- reflow->column_width = reflow->temp_column_width;
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
- e_reflow_resize_children(item);
- e_canvas_item_request_reflow(item);
- column_width_changed (reflow);
- }
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- gnome_canvas_item_ungrab (item, button->time);
- return TRUE;
- }
- break;
- case GDK_MOTION_NOTIFY:
- if (reflow->column_drag) {
- double old_width = reflow->temp_column_width;
- GdkEventMotion *motion = (GdkEventMotion *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- reflow->temp_column_width = reflow->column_width +
- (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
- if (reflow->temp_column_width < 50)
- reflow->temp_column_width = 50;
- if (old_width != reflow->temp_column_width) {
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- }
- return TRUE;
- } else {
- GdkEventMotion *motion = (GdkEventMotion *) event;
- double n_x, max_x;
-
- n_x = motion->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
-
- if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) {
- if ( reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
- reflow->default_cursor_shown = FALSE;
- }
- } else
- if ( ! reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
- reflow->default_cursor_shown = TRUE;
- }
-
- }
- break;
- case GDK_ENTER_NOTIFY:
- if (!reflow->column_drag) {
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double n_x, max_x;
- n_x = crossing->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
- if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) {
- if ( reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
- reflow->default_cursor_shown = FALSE;
- }
- }
- }
- break;
- case GDK_LEAVE_NOTIFY:
- if (!reflow->column_drag) {
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double n_x;
- n_x = crossing->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
- if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
- if ( ! reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
- reflow->default_cursor_shown = TRUE;
- }
- }
- }
- break;
- default:
- break;
- }
- if (return_val)
- return return_val;
- else if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return FALSE;
-}
-
-static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height)
-{
- int x_rect, y_rect, width_rect, height_rect;
- gdouble running_width;
- EReflow *reflow = E_REFLOW(item);
- int i;
- double column_width;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
- GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
- column_width = reflow->column_width;
- running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- x_rect = running_width;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- /* Compute first column to draw. */
- i = x;
- i /= column_width + E_REFLOW_FULL_GUTTER;
- running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
-
- for ( ; i < reflow->column_count; i++) {
- if ( running_width > x + width )
- break;
- x_rect = running_width;
- gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style,
- drawable,
- GTK_STATE_ACTIVE,
- GTK_SHADOW_NONE,
- NULL,
- GTK_WIDGET(item->canvas),
- "reflow",
- x_rect - x,
- y_rect - y,
- width_rect,
- height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- if (reflow->column_drag) {
- int start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
- i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
- column_width = reflow->temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- x_rect = running_width;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- /* Compute first column to draw. */
- i /= column_width + E_REFLOW_FULL_GUTTER;
- running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
-
- for ( ; i < reflow->column_count; i++) {
- if ( running_width > x + width )
- break;
- x_rect = running_width;
- gdk_draw_rectangle(drawable,
- GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL],
- TRUE,
- x_rect - x,
- y_rect - y,
- width_rect - 1,
- height_rect - 1);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-}
-
-static void
-e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags)
-{
- EReflow *reflow;
- double x0, x1, y0, y1;
-
- reflow = E_REFLOW (item);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update)
- GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags);
-
- x0 = item->x1;
- y0 = item->y1;
- x1 = item->x2;
- y1 = item->y2;
- if ( x1 < x0 + reflow->width )
- x1 = x0 + reflow->width;
- if ( y1 < y0 + reflow->height )
- y1 = y0 + reflow->height;
- item->x2 = x1;
- item->y2 = y1;
-
- if (reflow->need_height_update) {
- x0 = item->x1;
- y0 = item->y1;
- x1 = item->x2;
- y1 = item->y2;
- if ( x0 > 0 )
- x0 = 0;
- if ( y0 > 0 )
- y0 = 0;
- if ( x1 < E_REFLOW(item)->width )
- x1 = E_REFLOW(item)->width;
- if ( x1 < E_REFLOW(item)->height )
- x1 = E_REFLOW(item)->height;
-
- gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1);
- reflow->need_height_update = FALSE;
- } else if (reflow->need_column_resize) {
- int x_rect, y_rect, width_rect, height_rect;
- int start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
- gdouble running_width;
- int i;
- double column_width;
-
- if ( reflow->previous_temp_column_width != -1 ) {
- running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = reflow->previous_temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < reflow->column_count; i++) {
- x_rect = running_width;
- gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-
- if ( reflow->temp_column_width != -1 ) {
- running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = reflow->temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < reflow->column_count; i++) {
- x_rect = running_width;
- gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-
- reflow->previous_temp_column_width = reflow->temp_column_width;
- reflow->need_column_resize = FALSE;
- }
-}
-
-static double
-e_reflow_point (GnomeCanvasItem *item,
- double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- double distance = 1;
-
- *actual_item = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point)
- distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item);
- if ((int) (distance * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough && *actual_item)
- return distance;
-
- *actual_item = item;
- return 0;
-#if 0
- if (y >= E_REFLOW_BORDER_WIDTH && y <= reflow->height - E_REFLOW_BORDER_WIDTH) {
- float n_x;
- n_x = x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x, (reflow->column_width + E_REFLOW_FULL_GUTTER));
- if (n_x < E_REFLOW_FULL_GUTTER) {
- *actual_item = item;
- return 0;
- }
- }
- return distance;
-#endif
-}
-
-static void
-e_reflow_reflow( GnomeCanvasItem *item, int flags )
-{
- EReflow *reflow = E_REFLOW(item);
- gdouble old_width;
- gdouble running_width;
- gdouble running_height;
- int next_column;
- int i;
-
- if (! (GTK_OBJECT_FLAGS (reflow) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- if (reflow->need_reflow_columns) {
- reflow_columns (reflow);
- }
-
- old_width = reflow->width;
-
- running_width = E_REFLOW_BORDER_WIDTH;
- running_height = E_REFLOW_BORDER_WIDTH;
-
- next_column = 1;
-
- for (i = 0; i < reflow->count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (next_column < reflow->column_count && i == reflow->columns[next_column]) {
- running_height = E_REFLOW_BORDER_WIDTH;
- running_width += reflow->column_width + E_REFLOW_FULL_GUTTER;
- next_column ++;
- }
-
- if (unsorted >= 0 && reflow->items[unsorted]) {
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(reflow->items[unsorted]),
- (double) running_width,
- (double) running_height);
- running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
- }
- }
- reflow->width = running_width + reflow->column_width + E_REFLOW_BORDER_WIDTH;
- if ( reflow->width < reflow->minimum_width )
- reflow->width = reflow->minimum_width;
- if (old_width != reflow->width)
- e_canvas_item_request_parent_reflow(item);
-}
-
-static int
-e_reflow_selection_event_real (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event)
-{
- int row;
- int return_val = TRUE;
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- switch (event->button.button) {
- case 1: /* Fall through. */
- case 2:
- row = er_find_item (reflow, item);
- if (event->button.button == 1) {
- reflow->maybe_did_something =
- e_selection_model_maybe_do_something(reflow->selection, row, 0, event->button.state);
- reflow->maybe_in_drag = TRUE;
- } else {
- e_selection_model_do_something(reflow->selection, row, 0, event->button.state);
- }
- break;
- case 3:
- row = er_find_item (reflow, item);
- e_selection_model_right_click_down(reflow->selection, row, 0, 0);
- break;
- default:
- return_val = FALSE;
- break;
- }
- break;
- case GDK_BUTTON_RELEASE:
- if (event->button.button == 1) {
- if (reflow->maybe_in_drag) {
- reflow->maybe_in_drag = FALSE;
- if (!reflow->maybe_did_something) {
- row = er_find_item (reflow, item);
- e_selection_model_do_something(reflow->selection, row, 0, event->button.state);
- }
- }
- }
- break;
- case GDK_KEY_PRESS:
- return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event);
- break;
- default:
- return_val = FALSE;
- break;
- }
-
- return return_val;
-}
-
-static void
-e_reflow_class_init (EReflowClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = e_reflow_set_property;
- object_class->get_property = e_reflow_get_property;
- object_class->dispose = e_reflow_dispose;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_reflow_event;
- item_class->realize = e_reflow_realize;
- item_class->unrealize = e_reflow_unrealize;
- item_class->draw = e_reflow_draw;
- item_class->update = e_reflow_update;
- item_class->point = e_reflow_point;
-
- klass->selection_event = e_reflow_selection_event_real;
- klass->column_width_changed = NULL;
-
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EMPTY_MESSAGE,
- g_param_spec_string ("empty_message",
- _( "Empty message" ),
- _( "Empty message" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _( "Reflow model" ),
- _( "Reflow model" ),
- E_REFLOW_MODEL_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_COLUMN_WIDTH,
- g_param_spec_double ("column_width",
- _( "Column width" ),
- _( "Column width" ),
- 0.0, G_MAXDOUBLE, 150.0,
- G_PARAM_READWRITE));
-
- signals [SELECTION_EVENT] =
- g_signal_new ("selection_event",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowClass, selection_event),
- NULL, NULL,
- e_marshal_INT__OBJECT_BOXED,
- G_TYPE_INT, 2, G_TYPE_OBJECT,
- GDK_TYPE_EVENT);
-
- signals [COLUMN_WIDTH_CHANGED] =
- g_signal_new ("column_width_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowClass, column_width_changed),
- NULL, NULL,
- e_marshal_NONE__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
-}
-
-static void
-e_reflow_init (EReflow *reflow)
-{
- reflow->model = NULL;
- reflow->items = NULL;
- reflow->heights = NULL;
- reflow->count = 0;
-
- reflow->columns = NULL;
- reflow->column_count = 0;
-
- reflow->empty_text = NULL;
- reflow->empty_message = NULL;
-
- reflow->minimum_width = 10;
- reflow->width = 10;
- reflow->height = 10;
-
- reflow->column_width = 150;
-
- reflow->column_drag = FALSE;
-
- reflow->need_height_update = FALSE;
- reflow->need_column_resize = FALSE;
- reflow->need_reflow_columns = FALSE;
-
- reflow->maybe_did_something = FALSE;
- reflow->maybe_in_drag = FALSE;
-
- reflow->default_cursor_shown = TRUE;
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
-
- reflow->cursor_row = -1;
-
- reflow->incarnate_idle_id = 0;
- reflow->set_scroll_adjustments_id = 0;
-
- reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new());
- reflow->sorter = e_sorter_array_new (er_compare, reflow);
-
- g_object_set (reflow->selection,
- "sorter", reflow->sorter,
- NULL);
-
- reflow->selection_changed_id =
- g_signal_connect(reflow->selection, "selection_changed",
- G_CALLBACK (selection_changed), reflow);
- reflow->selection_row_changed_id =
- g_signal_connect(reflow->selection, "selection_row_changed",
- G_CALLBACK (selection_row_changed), reflow);
- reflow->cursor_changed_id =
- g_signal_connect(reflow->selection, "cursor_changed",
- G_CALLBACK (cursor_changed), reflow);
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
-}
-
-E_MAKE_TYPE (e_reflow,
- "EReflow",
- EReflow,
- e_reflow_class_init,
- e_reflow_init,
- PARENT_TYPE)
diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h
deleted file mode 100644
index 09f1292c4e..0000000000
--- a/widgets/misc/e-reflow.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __E_REFLOW_H__
-#define __E_REFLOW_H__
-
-#include <libgnomecanvas/gnome-canvas.h>
-#include <gal/widgets/e-reflow-model.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/util/e-sorter-array.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EReflow - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * minimum_width double RW minimum width of the reflow. width >= minimum_width
- * width double R width of the reflow
- * height double RW height of the reflow
- */
-
-#define E_REFLOW_TYPE (e_reflow_get_type ())
-#define E_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_REFLOW_TYPE, EReflow))
-#define E_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass))
-#define E_IS_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_REFLOW_TYPE))
-#define E_IS_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE))
-
-
-typedef struct EReflowPriv EReflowPriv;
-
-typedef struct _EReflow EReflow;
-typedef struct _EReflowClass EReflowClass;
-
-struct _EReflow
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- EReflowModel *model;
- guint model_changed_id;
- guint model_items_inserted_id;
- guint model_item_changed_id;
-
- ESelectionModel *selection;
- guint selection_changed_id;
- guint selection_row_changed_id;
- guint cursor_changed_id;
- ESorterArray *sorter;
-
- GtkAdjustment *adjustment;
- guint adjustment_changed_id;
- guint adjustment_value_changed_id;
- guint set_scroll_adjustments_id;
-
- int *heights;
- GnomeCanvasItem **items;
- int count;
- int allocated_count;
-
- int *columns;
- gint column_count; /* Number of columnns */
-
- GnomeCanvasItem *empty_text;
- gchar *empty_message;
-
- double minimum_width;
- double width;
- double height;
-
- double column_width;
-
- int incarnate_idle_id;
-
- /* These are all for when the column is being dragged. */
- gdouble start_x;
- gint which_column_dragged;
- double temp_column_width;
- double previous_temp_column_width;
-
- int cursor_row;
-
- guint column_drag : 1;
-
- guint need_height_update : 1;
- guint need_column_resize : 1;
- guint need_reflow_columns : 1;
-
- guint default_cursor_shown : 1;
-
- guint maybe_did_something : 1;
- guint maybe_in_drag : 1;
- GdkCursor *arrow_cursor;
- GdkCursor *default_cursor;
-};
-
-struct _EReflowClass
-{
- GnomeCanvasGroupClass parent_class;
-
- int (*selection_event) (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event);
- void (*column_width_changed) (EReflow *reflow, double width);
-};
-
-/*
- * To be added to a reflow, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent reflow request if its size
- * changes.
- */
-GtkType e_reflow_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_REFLOW_H__ */
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
deleted file mode 100644
index 2b58d98421..0000000000
--- a/widgets/misc/e-search-bar.c
+++ /dev/null
@@ -1,1230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-search-bar.c
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Ettore Perazzoli <ettore@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
-
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkmain.h>
-
-#include <gal/widgets/e-unicode.h>
-#include <gal/widgets/e-gui-utils.h>
-
-#include <libgnome/gnome-i18n.h>
-
-#include <bonobo/bonobo-ui-util.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "e-search-bar.h"
-#include "e-util-marshal.h"
-
-
-enum {
- QUERY_CHANGED,
- MENU_ACTIVATED,
- SEARCH_ACTIVATED,
-
- LAST_SIGNAL
-};
-
-static gint esb_signals [LAST_SIGNAL] = { 0, };
-
-static GtkHBoxClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_ITEM_ID,
- PROP_SUBITEM_ID,
- PROP_TEXT,
-};
-
-
-/* Forward decls. */
-
-static void emit_search_activated (ESearchBar *esb);
-static void emit_query_changed (ESearchBar *esb);
-
-
-/* Utility functions. */
-
-static void
-set_find_now_sensitive (ESearchBar *search_bar,
- gboolean sensitive)
-{
- if (search_bar->ui_component != NULL)
- bonobo_ui_component_set_prop (search_bar->ui_component,
- "/commands/ESearchBar:FindNow",
- "sensitive", sensitive ? "1" : "0", NULL);
-
- gtk_widget_set_sensitive (search_bar->activate_button, sensitive);
-}
-
-static char *
-verb_name_from_id (int id)
-{
- return g_strdup_printf ("ESearchBar:Activate:%d", id);
-}
-
-/* This implements the "clear" action, i.e. clears the text and then emits
- * ::search_activated. */
-
-static void
-clear_search (ESearchBar *esb)
-{
- e_search_bar_set_text (esb, "");
- e_search_bar_set_item_id (esb, 0);
- emit_search_activated (esb);
-}
-
-/* Frees an array of subitem information */
-static void
-free_subitems (ESearchBarSubitem *subitems)
-{
- ESearchBarSubitem *s;
-
- g_assert (subitems != NULL);
-
- for (s = subitems; s->id != -1; s++) {
- if (s->text)
- g_free (s->text);
- }
-
- g_free (subitems);
-}
-
-static void
-free_menu_items (ESearchBar *esb)
-{
- GSList *p;
-
- if (esb->menu_items == NULL)
- return;
-
- for (p = esb->menu_items; p != NULL; p = p->next) {
- ESearchBarItem *item;
-
- item = (ESearchBarItem *) p->data;
-
- /* (No submitems for the menu_items, so no need to free that
- member.) */
-
- g_free (item->text);
- g_free (item);
- }
-
- g_slist_free (esb->menu_items);
- esb->menu_items = NULL;
-}
-
-
-/* Signals. */
-
-static void
-emit_query_changed (ESearchBar *esb)
-{
- g_signal_emit (esb, esb_signals [QUERY_CHANGED], 0);
-}
-
-static void
-emit_search_activated (ESearchBar *esb)
-{
- if (esb->pending_activate) {
- g_source_remove (esb->pending_activate);
- esb->pending_activate = 0;
- }
-
- g_signal_emit (esb, esb_signals [SEARCH_ACTIVATED], 0);
-
- set_find_now_sensitive (esb, FALSE);
-}
-
-static void
-emit_menu_activated (ESearchBar *esb, int item)
-{
- g_signal_emit (esb,
- esb_signals [MENU_ACTIVATED], 0,
- item);
-}
-
-
-/* Callbacks -- Standard verbs. */
-
-static void
-search_now_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
-
- esb = E_SEARCH_BAR (data);
- emit_query_changed (esb);
-}
-
-static void
-clear_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
-
- esb = E_SEARCH_BAR (data);
- clear_search (esb);
-}
-
-static void
-setup_standard_verbs (ESearchBar *search_bar)
-{
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:Clear",
- clear_verb_cb, search_bar);
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:FindNow",
- search_now_verb_cb, search_bar);
-
- bonobo_ui_component_set (search_bar->ui_component, "/",
- ("<commands>"
- " <cmd name=\"ESearchBar:Clear\"/>"
- " <cmd name=\"ESearchBar:FindNow\"/>"
- "</commands>"),
- NULL);
-
- /* Make sure the entries are created with the correct sensitivity. */
- set_find_now_sensitive (search_bar, FALSE);
-}
-
-/* Callbacks -- The verbs for all the definable items. */
-
-static void
-search_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
- const char *p;
- int id;
-
- esb = E_SEARCH_BAR (data);
-
- p = strrchr (verb_name, ':');
- g_assert (p != NULL);
-
- id = atoi (p + 1);
- emit_menu_activated (esb, id);
-}
-
-static void
-entry_activated_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- emit_search_activated (esb);
-}
-
-static void
-entry_changed_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- set_find_now_sensitive (esb, TRUE);
-}
-
-static void
-subitem_activated_cb (GtkWidget *widget, ESearchBar *esb)
-{
- gint id, subid;
-
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
- subid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbSubitemId"));
-
- esb->item_id = id;
- esb->subitem_id = subid;
-
- set_find_now_sensitive (esb, TRUE);
-}
-
-static char *
-string_without_underscores (const char *s)
-{
- char *new_string;
- const char *sp;
- char *dp;
-
- new_string = g_malloc (strlen (s) + 1);
-
- dp = new_string;
- for (sp = s; *sp != '\0'; sp ++) {
- if (*sp != '_') {
- *dp = *sp;
- dp ++;
- } else if (sp[1] == '_') {
- /* Translate "__" in "_". */
- *dp = '_';
- dp ++;
- sp ++;
- }
- }
- *dp = 0;
-
- return new_string;
-}
-
-static void
-activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems)
-{
- if (subitems == NULL) {
- /* This item uses the entry. */
-
- /* Remove the menu */
- if (esb->suboption && esb->subitem_id != -1) {
- g_assert (esb->suboption->parent == esb->entry_box);
- g_assert (!esb->entry || esb->entry->parent == NULL);
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->suboption);
- }
-
- /* Create and add the entry */
-
- if (esb->entry == NULL) {
- esb->entry = gtk_entry_new();
- gtk_widget_set_size_request (esb->entry, 4, -1);
- g_object_ref (esb->entry);
- g_signal_connect (esb->entry, "changed",
- G_CALLBACK (entry_changed_cb), esb);
- g_signal_connect (esb->entry, "activate",
- G_CALLBACK (entry_activated_cb), esb);
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
- gtk_widget_show(esb->entry);
-
- esb->subitem_id = -1;
- }
-
- if (esb->subitem_id == -1) {
- g_assert (esb->entry->parent == esb->entry_box);
- g_assert (!esb->suboption || esb->suboption->parent == NULL);
- } else {
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
- gtk_widget_grab_focus (esb->entry);
-
- esb->subitem_id = -1;
-
- }
- } else {
- /* This item uses a submenu */
- GtkWidget *menu;
- GtkWidget *menu_item;
- gint i;
-
- /* Remove the entry */
- if (esb->entry && esb->subitem_id == -1) {
- g_assert (esb->entry->parent == esb->entry_box);
- g_assert (!esb->suboption || esb->suboption->parent == NULL);
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->entry);
- }
-
- /* Create and add the menu */
-
- if (esb->suboption == NULL) {
- esb->suboption = gtk_option_menu_new ();
- g_object_ref (esb->suboption);
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
- gtk_widget_show (esb->suboption);
-
- esb->subitem_id = subitems[0].id;
- }
-
- if (esb->subitem_id != -1) {
- g_assert (esb->suboption->parent == esb->entry_box);
- g_assert (!esb->entry || esb->entry->parent == NULL);
- } else {
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
- esb->subitem_id = subitems[0].id;
- }
-
- /* Create the items */
-
- esb->suboption_menu = menu = gtk_menu_new ();
- for (i = 0; subitems[i].id != -1; ++i) {
- if (subitems[i].text) {
- char *str;
-
- if (subitems[i].translate)
- str = string_without_underscores (_(subitems[i].text));
- else
- str = string_without_underscores (subitems[i].text);
-
- menu_item = gtk_menu_item_new_with_label (str);
-
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (item_id));
- g_object_set_data (G_OBJECT (menu_item), "EsbSubitemId",
- GINT_TO_POINTER (subitems[i].id));
-
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (subitem_activated_cb),
- esb);
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
-
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (esb->suboption));
- gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->suboption), menu);
- }
-
- if (esb->activate_button)
- gtk_widget_set_sensitive (esb->activate_button, subitems == NULL);
-}
-
-static void
-option_activated_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- int id;
-
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbChoiceId"));
-
- activate_by_subitems (esb, id, g_object_get_data (G_OBJECT (widget), "EsbChoiceSubitems"));
-
- esb->item_id = id;
- emit_query_changed (esb);
-}
-
-static void
-activate_button_clicked_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- emit_search_activated (esb);
-
- gtk_widget_grab_focus (esb->entry);
-}
-
-static void
-clear_button_clicked_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- clear_search (esb);
-
- gtk_widget_grab_focus (esb->entry);
-}
-
-
-/* Widgetry creation. */
-
-/* This function exists to fix the irreparable GtkOptionMenu stupidity. In
- fact, this lame-ass widget adds a 1-pixel-wide empty border around the
- button for no reason. So we have add a 1-pixel-wide border around the the
- buttons we have in the search bar to make things look right. This is done
- through an event box. */
-static GtkWidget *
-put_in_spacer_widget (GtkWidget *widget)
-{
- GtkWidget *holder;
-
- holder = gtk_event_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (holder), 1);
- gtk_container_add (GTK_CONTAINER (holder), widget);
-
- return holder;
-}
-
-static ESearchBarSubitem *
-copy_subitems (ESearchBarSubitem *subitems)
-{
- gint i, N;
- ESearchBarSubitem *copy;
-
- if (subitems == NULL)
- return NULL;
-
- for (N=0; subitems[N].id != -1; ++N);
- copy = g_new (ESearchBarSubitem, N+1);
-
- for (i=0; i<N; ++i) {
- copy[i].text = g_strdup (subitems[i].text);
- copy[i].id = subitems[i].id;
- copy[i].translate = subitems[i].translate;
- }
-
- copy[N].text = NULL;
- copy[N].id = -1;
-
- return copy;
-}
-
-static void
-append_xml_menu_item (GString *xml,
- const char *name,
- const char *label,
- const char *verb,
- const char *accelerator)
-{
- char *encoded_label;
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_string_sprintfa (xml, "<menuitem name=\"%s\" verb=\"%s\" label=\"%s\"",
- name, verb, encoded_label);
- g_free (encoded_label);
-
- if (accelerator != NULL)
- g_string_sprintfa (xml, " accel=\"%s\"", accelerator);
-
- g_string_sprintfa (xml, "/>");
-}
-
-static void
-setup_bonobo_menus (ESearchBar *esb)
-{
- GString *xml;
- GSList *p;
- char *verb_name;
- char *encoded_title;
-
- xml = g_string_new ("");
-
- encoded_title = bonobo_ui_util_encode_str (_("_Search"));
- g_string_sprintfa (xml, "<submenu name=\"Search\" label=\"%s\">", encoded_title);
- g_free (encoded_title);
-
- g_string_sprintfa (xml, "<placeholder name=\"SearchBar\">");
-
- append_xml_menu_item (xml, "FindNow", _("_Find Now"), "ESearchBar:FindNow", NULL);
- append_xml_menu_item (xml, "Clear", _("_Clear"), "ESearchBar:Clear", "*Control**Shift*b");
-
- for (p = esb->menu_items; p != NULL; p = p->next) {
- const ESearchBarItem *item;
-
- item = (const ESearchBarItem *) p->data;
-
- verb_name = verb_name_from_id (item->id);
- bonobo_ui_component_add_verb (esb->ui_component, verb_name, search_verb_cb, esb);
-
- if (item->text == NULL)
- g_string_append (xml, "<separator/>");
- else
- append_xml_menu_item (xml, verb_name, item->text, verb_name, NULL);
-
- g_free (verb_name);
- }
-
- g_string_sprintfa (xml, "</placeholder>");
- g_string_sprintfa (xml, "</submenu>");
-
- bonobo_ui_component_set (esb->ui_component, "/menu/SearchPlaceholder", xml->str, NULL);
-
- g_string_free (xml, TRUE);
-}
-
-static void
-remove_bonobo_menus (ESearchBar *esb)
-{
- bonobo_ui_component_rm (esb->ui_component, "/menu/SearchPlaceholder/Search", NULL);
-}
-
-static void
-update_bonobo_menus (ESearchBar *esb)
-{
- setup_bonobo_menus (esb);
-}
-
-static void
-set_menu (ESearchBar *esb,
- ESearchBarItem *items)
-{
- int i;
-
- free_menu_items (esb);
-
- if (items == NULL)
- return;
-
- for (i = 0; items[i].id != -1; i++) {
- ESearchBarItem *new_item;
-
- g_assert (items[i].subitems == NULL);
-
- new_item = g_new (ESearchBarItem, 1);
- new_item->text = g_strdup (items[i].text);
- new_item->id = items[i].id;
- new_item->subitems = NULL;
-
- esb->menu_items = g_slist_append (esb->menu_items, new_item);
- }
-
- if (esb->ui_component != NULL)
- update_bonobo_menus (esb);
-}
-
-/* Callback used when an option item is destroyed. We have to destroy its
- * suboption items.
- */
-static void
-option_item_destroy_cb (GtkObject *object, gpointer data)
-{
- ESearchBarSubitem *subitems;
-
- subitems = data;
-
- g_assert (subitems != NULL);
- free_subitems (subitems);
- g_object_set_data (G_OBJECT (object), "EsbChoiceSubitems", NULL);
-}
-
-static void
-set_option (ESearchBar *esb, ESearchBarItem *items)
-{
- GtkWidget *menu;
- int i;
-
- if (esb->option) {
- gtk_widget_destroy (esb->option_menu);
- } else {
- esb->option = gtk_option_menu_new ();
- gtk_widget_show (esb->option);
- gtk_box_pack_start (GTK_BOX (esb), esb->option, FALSE, FALSE, 0);
- }
-
- esb->option_menu = menu = gtk_menu_new ();
- for (i = 0; items[i].id != -1; i++) {
- GtkWidget *item;
- ESearchBarSubitem *subitems = NULL;
-
- if (items[i].text) {
- char *str;
-
- str = string_without_underscores (_(items[i].text));
- if (_(items[i].text) == items[i].text) {
- /* It may be english string, or utf8 rule name */
- item = e_utf8_gtk_menu_item_new_with_label (GTK_MENU (menu), str);
- } else {
- item = gtk_menu_item_new_with_label (str);
- }
-
- g_free (str);
- } else {
- item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (item, FALSE);
- }
-
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-
- g_object_set_data (G_OBJECT (item), "EsbChoiceId", GINT_TO_POINTER(items[i].id));
-
- if (items[i].subitems != NULL) {
- subitems = copy_subitems (items[i].subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", subitems);
- g_signal_connect (item, "destroy",
- G_CALLBACK (option_item_destroy_cb), subitems);
- }
-
- if (i == 0)
- activate_by_subitems (esb, items[i].id, subitems);
-
- g_signal_connect (item, "activate",
- G_CALLBACK (option_activated_cb),
- esb);
- }
-
- gtk_widget_show_all (menu);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->option), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (esb->option), 0);
-
- gtk_widget_set_sensitive (esb->option, TRUE);
-}
-
-static GtkWidget *
-add_button (ESearchBar *esb,
- const char *text,
- GCallback callback)
-{
- GtkWidget *label;
- GtkWidget *holder;
- GtkWidget *button;
-
- label = gtk_label_new (text);
- gtk_misc_set_padding (GTK_MISC (label), 2, 0);
- gtk_widget_show (label);
-
- /* See the comment in `put_in_spacer_widget()' to understand
- why we have to do this. */
-
- button = gtk_button_new ();
- gtk_widget_show (button);
- gtk_container_add (GTK_CONTAINER (button), label);
-
- holder = put_in_spacer_widget (button);
- gtk_widget_show (holder);
-
- g_signal_connect (G_OBJECT (button), "clicked", callback, esb);
-
- gtk_box_pack_end (GTK_BOX (esb), holder, FALSE, FALSE, 1);
-
- return button;
-}
-
-static int
-find_id (GtkWidget *menu, int idin, const char *type, GtkWidget **widget)
-{
- GList *l = GTK_MENU_SHELL (menu)->children;
- int row = -1, i = 0, id;
-
- if (widget)
- *widget = NULL;
- while (l) {
- id = GPOINTER_TO_INT (g_object_get_data (l->data, type));
- if (id == idin) {
- row = i;
- if (widget)
- *widget = l->data;
- break;
- }
- i++;
- l = l->next;
- }
- return row;
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ESearchBar *esb = E_SEARCH_BAR (object);
-
- switch (prop_id) {
- case PROP_ITEM_ID:
- g_value_set_int (value, e_search_bar_get_item_id (esb));
- break;
-
- case PROP_SUBITEM_ID:
- g_value_set_int (value, e_search_bar_get_subitem_id (esb));
- break;
-
- case PROP_TEXT:
- g_value_set_string (value, e_search_bar_get_text (esb));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESearchBar *esb = E_SEARCH_BAR(object);
-
- switch (prop_id) {
- case PROP_ITEM_ID:
- e_search_bar_set_item_id (esb, g_value_get_int (value));
- break;
-
- case PROP_SUBITEM_ID:
- e_search_bar_set_subitem_id (esb, g_value_get_int (value));
- break;
-
- case PROP_TEXT:
- e_search_bar_set_text (esb, g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-impl_dispose (GObject *object)
-{
- ESearchBar *esb = E_SEARCH_BAR (object);
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (object));
-
- /* These three we do need to unref, because we explicitly hold
- references to them. */
-
- if (esb->ui_component != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (esb->ui_component));
- esb->ui_component = NULL;
- }
- if (esb->entry) {
- g_object_unref (esb->entry);
- esb->entry = NULL;
- }
- if (esb->suboption) {
- g_object_unref (esb->suboption);
- esb->suboption = NULL;
- }
-
- if (esb->pending_activate) {
- g_source_remove (esb->pending_activate);
- esb->pending_activate = 0;
- }
-
- free_menu_items (esb);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-
-static void
-class_init (ESearchBarClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (gtk_hbox_get_type ());
-
- object_class->set_property = impl_set_property;
- object_class->get_property = impl_get_property;
- object_class->dispose = impl_dispose;
-
- klass->set_menu = set_menu;
- klass->set_option = set_option;
-
- g_object_class_install_property (object_class, PROP_ITEM_ID,
- g_param_spec_int ("item_id",
- _("Item ID"),
- /*_( */"XXX blurb" /*)*/,
- 0, 0, 0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
-
- g_object_class_install_property (object_class, PROP_SUBITEM_ID,
- g_param_spec_int ("subitem_id",
- _("Subitem ID"),
- /*_( */"XXX blurb" /*)*/,
- 0, 0, 0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
-
- g_object_class_install_property (object_class, PROP_TEXT,
- g_param_spec_string ("text",
- _("Text"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- esb_signals [QUERY_CHANGED] =
- g_signal_new ("query_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, query_changed),
- NULL, NULL,
- e_util_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- esb_signals [MENU_ACTIVATED] =
- g_signal_new ("menu_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, menu_activated),
- NULL, NULL,
- e_util_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- esb_signals [SEARCH_ACTIVATED] =
- g_signal_new ("search_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, search_activated),
- NULL, NULL,
- e_util_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-init (ESearchBar *esb)
-{
- esb->ui_component = NULL;
- esb->menu_items = NULL;
-
- esb->option = NULL;
- esb->entry = NULL;
- esb->suboption = NULL;
-
- esb->option_menu = NULL;
- esb->suboption_menu = NULL;
- esb->activate_button = NULL;
- esb->clear_button = NULL;
- esb->entry_box = NULL;
-
- esb->pending_activate = 0;
-
- esb->item_id = 0;
- esb->subitem_id = 0;
-}
-
-
-/* Object construction. */
-
-static gint
-idle_activate_hack (gpointer ptr)
-{
- ESearchBar *esb = E_SEARCH_BAR (ptr);
- esb->pending_activate = 0;
- emit_search_activated (esb);
- return FALSE;
-}
-
-void
-e_search_bar_construct (ESearchBar *search_bar,
- ESearchBarItem *menu_items,
- ESearchBarItem *option_items)
-{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- g_return_if_fail (option_items != NULL);
-
- gtk_box_set_spacing (GTK_BOX (search_bar), 1);
-
- search_bar->clear_button = add_button (search_bar, _("Clear"),
- G_CALLBACK (clear_button_clicked_cb));
- search_bar->activate_button = add_button (search_bar, _("Find Now"),
- G_CALLBACK (activate_button_clicked_cb));
-
- e_search_bar_set_menu (search_bar, menu_items);
-
- search_bar->entry_box = gtk_hbox_new (0, FALSE);
-
- e_search_bar_set_option (search_bar, option_items);
-
- gtk_widget_show (search_bar->entry_box);
- gtk_box_pack_start (GTK_BOX(search_bar), search_bar->entry_box, TRUE, TRUE, 0);
-
- /*
- * If the default choice for the option menu has subitems, then we need to
- * activate the search immediately. However, the developer won't have
- * connected to the activated signal until after the object is constructed,
- * so we can't emit here. Thus we launch a one-shot idle function that will
- * emit the changed signal, so that the proper callback will get invoked.
- */
- if (search_bar->subitem_id >= 0) {
- gtk_widget_set_sensitive (search_bar->activate_button, FALSE);
-
- search_bar->pending_activate = g_idle_add (idle_activate_hack, search_bar);
- }
-}
-
-void
-e_search_bar_set_menu (ESearchBar *search_bar, ESearchBarItem *menu_items)
-{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- ((ESearchBarClass *) GTK_OBJECT_GET_CLASS (search_bar))->set_menu (search_bar, menu_items);
-}
-
-void
-e_search_bar_add_menu (ESearchBar *search_bar, ESearchBarItem *menu_item)
-{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- set_menu (search_bar, menu_item);
-}
-
-void
-e_search_bar_set_option (ESearchBar *search_bar, ESearchBarItem *option_items)
-{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- g_return_if_fail (option_items != NULL);
-
- ((ESearchBarClass *) GTK_OBJECT_GET_CLASS (search_bar))->set_option (search_bar, option_items);
-}
-
-/**
- * e_search_bar_set_suboption:
- * @search_bar: A search bar.
- * @option_id: Identifier of the main option menu item under which the subitems
- * are to be set.
- * @subitems: Array of subitem information.
- *
- * Sets the items for the secondary option menu of a search bar.
- **/
-void
-e_search_bar_set_suboption (ESearchBar *search_bar, int option_id, ESearchBarSubitem *subitems)
-{
- int row;
- GtkWidget *item;
- ESearchBarSubitem *old_subitems;
- ESearchBarSubitem *new_subitems;
-
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- row = find_id (search_bar->option_menu, option_id, "EsbChoiceId", &item);
- g_return_if_fail (row != -1);
- g_assert (item != NULL);
-
- old_subitems = g_object_get_data (G_OBJECT (item), "EsbChoiceSubitems");
- if (old_subitems) {
- /* This was connected in set_option() */
- g_signal_handlers_disconnect_matched (item,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- old_subitems);
- free_subitems (old_subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", NULL);
- }
-
- if (subitems) {
- new_subitems = copy_subitems (subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", new_subitems);
- g_signal_connect (item, "destroy",
- G_CALLBACK (option_item_destroy_cb), new_subitems);
- } else
- new_subitems = NULL;
-
- if (search_bar->item_id == option_id)
- activate_by_subitems (search_bar, option_id, new_subitems);
-}
-
-GtkWidget *
-e_search_bar_new (ESearchBarItem *menu_items,
- ESearchBarItem *option_items)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (option_items != NULL, NULL);
-
- widget = GTK_WIDGET (gtk_type_new (e_search_bar_get_type ()));
-
- e_search_bar_construct (E_SEARCH_BAR (widget), menu_items, option_items);
-
- return widget;
-}
-
-void
-e_search_bar_set_ui_component (ESearchBar *search_bar,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- if (search_bar->ui_component != NULL) {
- remove_bonobo_menus (search_bar);
- bonobo_object_unref (BONOBO_OBJECT (search_bar->ui_component));
- }
-
- search_bar->ui_component = ui_component;
- if (ui_component != NULL) {
- bonobo_object_ref (BONOBO_OBJECT (ui_component));
- setup_standard_verbs (search_bar);
- setup_bonobo_menus (search_bar);
- }
-}
-
-void
-e_search_bar_set_menu_sensitive (ESearchBar *search_bar, int id, gboolean state)
-{
- char *verb_name;
- char *path;
-
- verb_name = verb_name_from_id (id);
- path = g_strconcat ("/commands/", verb_name, NULL);
- g_free (verb_name);
-
- bonobo_ui_component_set_prop (search_bar->ui_component, path,
- "sensitive", state ? "1" : "0",
- NULL);
-
- g_free (path);
-}
-
-GType
-e_search_bar_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESearchBarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESearchBar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) init,
- };
-
- type = g_type_register_static (gtk_hbox_get_type (), "ESearchBar", &info, 0);
- }
-
- return type;
-}
-
-/**
- * e_search_bar_set_item_id:
- * @search_bar: A search bar.
- * @id: Identifier of the item to set.
- *
- * Sets the active item in the options menu of a search bar.
- **/
-void
-e_search_bar_set_item_id (ESearchBar *search_bar, int id)
-{
- int row;
-
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- row = find_id (search_bar->option_menu, id, "EsbChoiceId", NULL);
- g_return_if_fail (row != -1);
-
- search_bar->item_id = id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), row);
- emit_query_changed (search_bar);
-}
-
-/**
- * e_search_bar_get_item_id:
- * @search_bar: A search bar.
- *
- * Queries the currently selected item in the options menu of a search bar.
- *
- * Return value: Identifier of the selected item in the options menu.
- **/
-int
-e_search_bar_get_item_id (ESearchBar *search_bar)
-{
- g_return_val_if_fail (search_bar != NULL, -1);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
-
- return search_bar->item_id;
-}
-
-void
-e_search_bar_set_subitem_id (ESearchBar *search_bar, int id)
-{
- int row;
-
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- row = find_id (search_bar->suboption_menu, id, "EsbSubitemId", NULL);
- g_return_if_fail (row != -1);
-
- search_bar->subitem_id = id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->suboption), row);
-}
-
-/**
- * e_search_bar_get_subitem_id:
- * @search_bar: A search bar.
- *
- * Queries the currently selected item in the suboptions menu of a search bar.
- *
- * Return value: Identifier of the selected item in the suboptions menu.
- * If the search bar currently contains an entry rather than a a suboption menu,
- * a value less than zero is returned.
- **/
-int
-e_search_bar_get_subitem_id (ESearchBar *search_bar)
-{
- g_return_val_if_fail (search_bar != NULL, -1);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
-
- return search_bar->subitem_id;
-}
-
-/**
- * e_search_bar_set_ids:
- * @search_bar: A search bar.
- * @item_id: Identifier of the item to set.
- * @subitem_id: Identifier of the subitem to set.
- *
- * Sets the item and subitem ids for a search bar. This is intended to switch
- * to an item that has subitems.
- **/
-void
-e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id)
-{
- int item_row;
- GtkWidget *item_widget;
- ESearchBarSubitem *subitems;
-
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- item_row = find_id (search_bar->option_menu, item_id, "EsbChoiceId", &item_widget);
- g_return_if_fail (item_row != -1);
- g_assert (item_widget != NULL);
-
- subitems = g_object_get_data (G_OBJECT (item_widget), "EsbChoiceSubitems");
- g_return_if_fail (subitems != NULL);
-
- search_bar->item_id = item_id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), item_row);
-
- activate_by_subitems (search_bar, item_id, subitems);
- e_search_bar_set_subitem_id (search_bar, subitem_id);
-}
-
-/**
- * e_search_bar_set_text:
- * @search_bar: A search bar.
- * @text: Text to set in the search bar's entry line.
- *
- * Sets the text string inside the entry line of a search bar.
- **/
-void
-e_search_bar_set_text (ESearchBar *search_bar, const char *text)
-{
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- e_utf8_gtk_editable_set_text (GTK_EDITABLE (search_bar->entry), text);
-}
-
-/**
- * e_search_bar_get_text:
- * @search_bar: A search bar.
- *
- * Queries the text of the entry line in a search bar.
- *
- * Return value: The text string that is in the entry line of the search bar.
- * This must be freed using g_free(). If a suboption menu is active instead
- * of an entry, NULL is returned.
- **/
-char *
-e_search_bar_get_text (ESearchBar *search_bar)
-{
- g_return_val_if_fail (search_bar != NULL, NULL);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
-
- return search_bar->subitem_id < 0 ? e_utf8_gtk_editable_get_text (GTK_EDITABLE (search_bar->entry)) : NULL;
-}
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
deleted file mode 100644
index b0333ad58b..0000000000
--- a/widgets/misc/e-search-bar.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-search-bar.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_SEARCH_BAR_H__
-#define __E_SEARCH_BAR_H__
-
-#include <gtk/gtkhbox.h>
-
-#include <bonobo/bonobo-ui-component.h>
-
-G_BEGIN_DECLS
-
-/* ESearchBar - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * ---------------------------------------------------------------------------------
- * item_id int RW Which option item is currently selected.
- * subitem_id int RW Which option subitem is currently selected.
- * text string RW Text in the entry box.
- */
-
-#define E_SEARCH_BAR_TYPE (e_search_bar_get_type ())
-#define E_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_SEARCH_BAR_TYPE, ESearchBar))
-#define E_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_SEARCH_BAR_TYPE, ESearchBarClass))
-#define E_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_SEARCH_BAR_TYPE))
-#define E_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_SEARCH_BAR_TYPE))
-
-typedef struct {
- char *text;
- int id;
- gboolean translate; /* whether to translate the text */
-} ESearchBarSubitem;
-
-typedef struct {
- char *text;
- int id;
- ESearchBarSubitem *subitems;
-} ESearchBarItem;
-
-typedef struct _ESearchBar ESearchBar;
-typedef struct _ESearchBarClass ESearchBarClass;
-
-struct _ESearchBar
-{
- GtkHBox parent;
-
- BonoboUIComponent *ui_component;
-
- GSList *menu_items;
-
- /* item specific fields */
- GtkWidget *option;
- GtkWidget *entry;
- GtkWidget *suboption; /* an option menu for the choices associated with some options */
-
- /* PRIVATE */
- GtkWidget *dropdown_holder; /* holds the dropdown */
- GtkWidget *option_menu;
- GtkWidget *suboption_menu;
- GtkWidget *activate_button;
- GtkWidget *clear_button;
- GtkWidget *entry_box;
- guint pending_activate;
-
- /* The currently-selected item & subitem */
- int item_id;
- int subitem_id; /* < 0 if the entry widget is active */
-};
-
-struct _ESearchBarClass
-{
- GtkHBoxClass parent_class;
-
- void (*set_menu) (ESearchBar *, ESearchBarItem *);
- void (*set_option) (ESearchBar *, ESearchBarItem *);
-
- /* signals */
- void (*search_activated) (ESearchBar *search);
- void (*query_changed) (ESearchBar *search);
- void (*menu_activated) (ESearchBar *search, int item);
-};
-
-enum {
- E_SEARCHBAR_FIND_NOW_ID = -1,
- E_SEARCHBAR_CLEAR_ID = -2
-};
-
-
-GType e_search_bar_get_type (void);
-void e_search_bar_construct (ESearchBar *search_bar,
- ESearchBarItem *menu_items,
- ESearchBarItem *option_items);
-GtkWidget *e_search_bar_new (ESearchBarItem *menu_items,
- ESearchBarItem *option_items);
-
-void e_search_bar_set_ui_component (ESearchBar *search_bar,
- BonoboUIComponent *ui_component);
-
-void e_search_bar_set_menu (ESearchBar *search_bar,
- ESearchBarItem *menu_items);
-void e_search_bar_add_menu (ESearchBar *search_bar,
- ESearchBarItem *menu_item);
-
-void e_search_bar_set_option (ESearchBar *search_bar,
- ESearchBarItem *option_items);
-void e_search_bar_set_suboption (ESearchBar *search_bar,
- int option_id,
- ESearchBarSubitem *subitems);
-
-void e_search_bar_set_menu_sensitive (ESearchBar *search_bar,
- int id,
- gboolean state);
-
-void e_search_bar_set_item_id (ESearchBar *search_bar,
- int id);
-int e_search_bar_get_item_id (ESearchBar *search_bar);
-
-void e_search_bar_set_subitem_id (ESearchBar *search_bar,
- int id);
-int e_search_bar_get_subitem_id (ESearchBar *search_bar);
-
-void e_search_bar_set_ids (ESearchBar *search_bar,
- int item_id,
- int subitem_id);
-
-void e_search_bar_set_text (ESearchBar *search_bar,
- const char *text);
-char *e_search_bar_get_text (ESearchBar *search_bar);
-
-G_END_DECLS
-
-
-#endif /* __E_SEARCH_BAR_H__ */
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
deleted file mode 100644
index e6e96702a3..0000000000
--- a/widgets/misc/e-selection-model-array.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-selection-model-array.h"
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- PROP_0,
- PROP_CURSOR_ROW,
- PROP_CURSOR_COL
-};
-
-void
-e_selection_model_array_confirm_row_count(ESelectionModelArray *esma)
-{
- if (esma->eba == NULL) {
- int row_count = e_selection_model_array_get_row_count(esma);
- esma->eba = e_bit_array_new(row_count);
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- }
-}
-
-/* FIXME: Should this deal with moving the selection if it's in single mode? */
-void
-e_selection_model_array_delete_rows(ESelectionModelArray *esma, int row, int count)
-{
- if (esma->eba) {
- if (E_SELECTION_MODEL(esma)->mode == GTK_SELECTION_SINGLE)
- e_bit_array_delete_single_mode(esma->eba, row, count);
- else
- e_bit_array_delete(esma->eba, row, count);
-
- if (esma->cursor_row > row + count)
- esma->cursor_row -= count;
- else if (esma->cursor_row > row)
- esma->cursor_row = row;
-
- if (esma->cursor_row >= e_bit_array_bit_count (esma->eba)) {
- esma->cursor_row = e_bit_array_bit_count (esma->eba) - 1;
- } else if (esma->cursor_row < 0) {
- esma->cursor_row = -1;
- }
- if (esma->cursor_row >= 0)
- e_bit_array_change_one_row(esma->eba, esma->cursor_row, TRUE);
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
- }
-}
-
-void
-e_selection_model_array_insert_rows(ESelectionModelArray *esma, int row, int count)
-{
- if (esma->eba) {
- e_bit_array_insert(esma->eba, row, count);
-
- if (esma->cursor_row >= row)
- esma->cursor_row += count;
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
- }
-}
-
-void
-e_selection_model_array_move_row(ESelectionModelArray *esma, int old_row, int new_row)
-{
- ESelectionModel *esm = E_SELECTION_MODEL(esma);
-
- if (esma->eba) {
- gboolean selected = e_bit_array_value_at(esma->eba, old_row);
- gboolean cursor = (esma->cursor_row == old_row);
-
- if (old_row < esma->cursor_row && esma->cursor_row < new_row)
- esma->cursor_row --;
- else if (new_row < esma->cursor_row && esma->cursor_row < old_row)
- esma->cursor_row ++;
-
- e_bit_array_move_row(esma->eba, old_row, new_row);
-
- if (selected) {
- if (esm->mode == GTK_SELECTION_SINGLE)
- e_bit_array_select_single_row (esma->eba, new_row);
- else
- e_bit_array_change_one_row(esma->eba, new_row, TRUE);
- }
- if (cursor) {
- esma->cursor_row = new_row;
- }
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(esm);
- e_selection_model_cursor_changed(esm, esma->cursor_row, esma->cursor_col);
- }
-}
-
-static void
-esma_dispose (GObject *object)
-{
- ESelectionModelArray *esma;
-
- esma = E_SELECTION_MODEL_ARRAY (object);
-
- if (esma->eba) {
- g_object_unref (esma->eba);
- esma->eba = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-esma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- g_value_set_int (value, esma->cursor_row);
- break;
-
- case PROP_CURSOR_COL:
- g_value_set_int (value, esma->cursor_col);
- break;
- }
-}
-
-static void
-esma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- e_selection_model_do_something(esm, g_value_get_int (value), esma->cursor_col, 0);
- break;
-
- case PROP_CURSOR_COL:
- e_selection_model_do_something(esm, esma->cursor_row, g_value_get_int(value), 0);
- break;
- }
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-static gboolean
-esma_is_row_selected (ESelectionModel *selection,
- gint n)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- return e_bit_array_value_at(esma->eba, n);
- else
- return FALSE;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-static void
-esma_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- e_bit_array_foreach(esma->eba, callback, closure);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-static void
-esma_clear(ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba) {
- g_object_unref(esma->eba);
- esma->eba = NULL;
- }
- esma->cursor_row = -1;
- esma->cursor_col = -1;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
-}
-
-#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
-#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-static gint
-esma_selected_count (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- return e_bit_array_selected_count(esma->eba);
- else
- return 0;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-static void
-esma_select_all (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_select_all(esma->eba);
-
- esma->cursor_col = 0;
- esma->cursor_row = 0;
- esma->selection_start_row = 0;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), 0, 0);
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-static void
-esma_invert_selection (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_invert_selection(esma->eba);
-
- esma->cursor_col = -1;
- esma->cursor_row = -1;
- esma->selection_start_row = 0;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
-}
-
-static int
-esma_row_count (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- e_selection_model_array_confirm_row_count(esma);
- return e_bit_array_bit_count(esma->eba);
-}
-
-static void
-esma_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_change_one_row(esma->eba, row, grow);
-}
-
-static void
-esma_change_cursor (ESelectionModel *selection, int row, int col)
-{
- ESelectionModelArray *esma;
-
- g_return_if_fail(selection != NULL);
- g_return_if_fail(E_IS_SELECTION_MODEL(selection));
-
- esma = E_SELECTION_MODEL_ARRAY(selection);
-
- esma->cursor_row = row;
- esma->cursor_col = col;
-}
-
-static void
-esma_change_range(ESelectionModel *selection, int start, int end, gboolean grow)
-{
- int i;
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (start != end) {
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- for ( i = start; i < end; i++) {
- e_bit_array_change_one_row(esma->eba, e_sorter_sorted_to_model(selection->sorter, i), grow);
- }
- } else {
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_change_range(esma->eba, start, end, grow);
- }
- }
-}
-
-static int
-esma_cursor_row (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- return esma->cursor_row;
-}
-
-static int
-esma_cursor_col (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- return esma->cursor_col;
-}
-
-static void
-esma_real_select_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_select_single_row(esma->eba, row);
-
- esma->selection_start_row = row;
- esma->selected_row = row;
- esma->selected_range_end = row;
-}
-
-static void
-esma_select_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int selected_row = esma->selected_row;
- esma_real_select_single_row (selection, row);
-
- if (selected_row != -1 && esma->eba && selected_row < e_bit_array_bit_count (esma->eba)) {
- if (selected_row != row) {
- e_selection_model_selection_row_changed(selection, selected_row);
- e_selection_model_selection_row_changed(selection, row);
- }
- } else {
- e_selection_model_selection_changed(selection);
- }
-}
-
-static void
-esma_toggle_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_toggle_single_row(esma->eba, row);
-
- esma->selection_start_row = row;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(esma), row);
-}
-
-static void
-esma_real_move_selection_end (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int old_start;
- int old_end;
- int new_start;
- int new_end;
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- old_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, esma->cursor_row));
- old_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, esma->cursor_row)) + 1;
- new_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, row));
- new_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, row)) + 1;
- } else {
- old_start = MIN (esma->selection_start_row, esma->cursor_row);
- old_end = MAX (esma->selection_start_row, esma->cursor_row) + 1;
- new_start = MIN (esma->selection_start_row, row);
- new_end = MAX (esma->selection_start_row, row) + 1;
- }
- /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */
- if (old_start < new_start)
- esma_change_range(selection, old_start, new_start, FALSE);
- if (new_start < old_start)
- esma_change_range(selection, new_start, old_start, TRUE);
- if (old_end < new_end)
- esma_change_range(selection, old_end, new_end, TRUE);
- if (new_end < old_end)
- esma_change_range(selection, new_end, old_end, FALSE);
- esma->selected_row = -1;
- esma->selected_range_end = -1;
-}
-
-static void
-esma_move_selection_end (ESelectionModel *selection, int row)
-{
- esma_real_move_selection_end (selection, row);
- e_selection_model_selection_changed(selection);
-}
-
-static void
-esma_set_selection_end (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int selected_range_end = esma->selected_range_end;
- int view_row = e_sorter_model_to_sorted(selection->sorter, row);
-
- esma_real_select_single_row(selection, esma->selection_start_row);
- esma->cursor_row = esma->selection_start_row;
- esma_real_move_selection_end(selection, row);
-
- esma->selected_range_end = view_row;
- if (selected_range_end != -1 && view_row != -1) {
- if (selected_range_end == view_row - 1 ||
- selected_range_end == view_row + 1) {
- e_selection_model_selection_row_changed(selection, selected_range_end);
- e_selection_model_selection_row_changed(selection, view_row);
- }
- }
- e_selection_model_selection_changed(selection);
-}
-
-int
-e_selection_model_array_get_row_count (ESelectionModelArray *esma)
-{
- g_return_val_if_fail(esma != NULL, 0);
- g_return_val_if_fail(E_IS_SELECTION_MODEL_ARRAY(esma), 0);
-
- if (E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count)
- return E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count (esma);
- else
- return 0;
-}
-
-
-static void
-e_selection_model_array_init (ESelectionModelArray *esma)
-{
- esma->eba = NULL;
- esma->selection_start_row = 0;
- esma->cursor_row = -1;
- esma->cursor_col = -1;
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
-}
-
-static void
-e_selection_model_array_class_init (ESelectionModelArrayClass *klass)
-{
- GObjectClass *object_class;
- ESelectionModelClass *esm_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
- esm_class = E_SELECTION_MODEL_CLASS(klass);
-
- object_class->dispose = esma_dispose;
- object_class->get_property = esma_get_property;
- object_class->set_property = esma_set_property;
-
- esm_class->is_row_selected = esma_is_row_selected ;
- esm_class->foreach = esma_foreach ;
- esm_class->clear = esma_clear ;
- esm_class->selected_count = esma_selected_count ;
- esm_class->select_all = esma_select_all ;
- esm_class->invert_selection = esma_invert_selection ;
- esm_class->row_count = esma_row_count ;
-
- esm_class->change_one_row = esma_change_one_row ;
- esm_class->change_cursor = esma_change_cursor ;
- esm_class->cursor_row = esma_cursor_row ;
- esm_class->cursor_col = esma_cursor_col ;
-
- esm_class->select_single_row = esma_select_single_row ;
- esm_class->toggle_single_row = esma_toggle_single_row ;
- esm_class->move_selection_end = esma_move_selection_end ;
- esm_class->set_selection_end = esma_set_selection_end ;
-
- klass->get_row_count = NULL ;
-
- g_object_class_install_property (object_class, PROP_CURSOR_ROW,
- g_param_spec_int ("cursor_row",
- _("Cursor Row"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_COL,
- g_param_spec_int ("cursor_col",
- _("Cursor Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-}
-
-E_MAKE_TYPE(e_selection_model_array, "ESelectionModelArray", ESelectionModelArray,
- e_selection_model_array_class_init, e_selection_model_array_init, PARENT_TYPE)
diff --git a/widgets/misc/e-selection-model-array.h b/widgets/misc/e-selection-model-array.h
deleted file mode 100644
index a533030f92..0000000000
--- a/widgets/misc/e-selection-model-array.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_SELECTION_MODEL_ARRAY_H_
-#define _E_SELECTION_MODEL_ARRAY_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/util/e-bit-array.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_ARRAY_TYPE (e_selection_model_array_get_type ())
-#define E_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray))
-#define E_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass))
-#define E_IS_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE))
-#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE))
-#define E_SELECTION_MODEL_ARRAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass))
-
-typedef struct {
- ESelectionModel base;
-
- EBitArray *eba;
-
- gint cursor_row;
- gint cursor_col;
- gint selection_start_row;
-
- guint model_changed_id;
- guint model_row_inserted_id, model_row_deleted_id;
-
- /* Anything other than -1 means that the selection is a single
- * row. This being -1 does not impart any information. */
- gint selected_row;
- /* Anything other than -1 means that the selection is a all
- * rows between selection_start_path and cursor_path where
- * selected_range_end is the rwo number of cursor_path. This
- * being -1 does not impart any information. */
- gint selected_range_end;
-
- guint frozen : 1;
- guint selection_model_changed : 1;
- guint group_info_changed : 1;
-} ESelectionModelArray;
-
-typedef struct {
- ESelectionModelClass parent_class;
-
- gint (*get_row_count) (ESelectionModelArray *selection);
-} ESelectionModelArrayClass;
-
-GType e_selection_model_array_get_type (void);
-
-/* Protected Functions */
-void e_selection_model_array_insert_rows (ESelectionModelArray *esm,
- int row,
- int count);
-void e_selection_model_array_delete_rows (ESelectionModelArray *esm,
- int row,
- int count);
-void e_selection_model_array_move_row (ESelectionModelArray *esm,
- int old_row,
- int new_row);
-void e_selection_model_array_confirm_row_count (ESelectionModelArray *esm);
-
-/* Protected Virtual Function */
-gint e_selection_model_array_get_row_count (ESelectionModelArray *esm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_SELECTION_MODEL_ARRAY_H_ */
diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c
deleted file mode 100644
index 51a0d86623..0000000000
--- a/widgets/misc/e-selection-model-simple.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-simple.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gal/util/e-util.h>
-#include "e-selection-model-array.h"
-#include "e-selection-model-simple.h"
-
-#define PARENT_TYPE e_selection_model_array_get_type ()
-
-static ESelectionModelArray *parent_class;
-
-static gint esms_get_row_count (ESelectionModelArray *esma);
-
-static void
-e_selection_model_simple_init (ESelectionModelSimple *selection)
-{
- selection->row_count = 0;
-}
-
-static void
-e_selection_model_simple_class_init (ESelectionModelSimpleClass *klass)
-{
- ESelectionModelArrayClass *esma_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass);
-
- esma_class->get_row_count = esms_get_row_count;
-}
-
-E_MAKE_TYPE(e_selection_model_simple, "ESelectionModelSimple", ESelectionModelSimple,
- e_selection_model_simple_class_init, e_selection_model_simple_init, PARENT_TYPE)
-
-/**
- * e_selection_model_simple_new
- *
- * This routine creates a new #ESelectionModelSimple.
- *
- * Returns: The new #ESelectionModelSimple.
- */
-ESelectionModelSimple *
-e_selection_model_simple_new (void)
-{
- return g_object_new (E_SELECTION_MODEL_SIMPLE_TYPE, NULL);
-}
-
-void
-e_selection_model_simple_set_row_count (ESelectionModelSimple *esms,
- int row_count)
-{
- if (esms->row_count != row_count) {
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(esms);
- if (esma->eba)
- g_object_unref(esma->eba);
- esma->eba = NULL;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- }
- esms->row_count = row_count;
-}
-
-static gint
-esms_get_row_count (ESelectionModelArray *esma)
-{
- ESelectionModelSimple *esms = E_SELECTION_MODEL_SIMPLE(esma);
-
- return esms->row_count;
-}
-
-void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
- int row,
- int count)
-{
- esms->row_count += count;
- e_selection_model_array_insert_rows (E_SELECTION_MODEL_ARRAY(esms), row, count);
-}
-
-void
-e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
- int row,
- int count)
-{
- esms->row_count -= count;
- e_selection_model_array_delete_rows (E_SELECTION_MODEL_ARRAY(esms), row, count);
-}
-
-void
-e_selection_model_simple_move_row (ESelectionModelSimple *esms,
- int old_row,
- int new_row)
-{
- e_selection_model_array_move_row (E_SELECTION_MODEL_ARRAY(esms), old_row, new_row);
-}
diff --git a/widgets/misc/e-selection-model-simple.h b/widgets/misc/e-selection-model-simple.h
deleted file mode 100644
index 6b4f84b4f9..0000000000
--- a/widgets/misc/e-selection-model-simple.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-simple.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_SELECTION_MODEL_SIMPLE_H_
-#define _E_SELECTION_MODEL_SIMPLE_H_
-
-#include <gal/widgets/e-selection-model-array.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_SIMPLE_TYPE (e_selection_model_simple_get_type ())
-#define E_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple))
-#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass))
-#define E_IS_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE))
-#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE))
-
-typedef struct {
- ESelectionModelArray parent;
-
- int row_count;
-} ESelectionModelSimple;
-
-typedef struct {
- ESelectionModelArrayClass parent_class;
-} ESelectionModelSimpleClass;
-
-GType e_selection_model_simple_get_type (void);
-ESelectionModelSimple *e_selection_model_simple_new (void);
-
-void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
- int row,
- int count);
-void e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
- int row,
- int count);
-void e_selection_model_simple_move_row (ESelectionModelSimple *esms,
- int old_row,
- int new_row);
-
-void e_selection_model_simple_set_row_count (ESelectionModelSimple *selection,
- int row_count);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SELECTION_MODEL_SIMPLE_H_ */
-
diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c
deleted file mode 100644
index 991fc78490..0000000000
--- a/widgets/misc/e-selection-model.c
+++ /dev/null
@@ -1,689 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include "e-selection-model.h"
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *e_selection_model_parent_class;
-
-enum {
- CURSOR_CHANGED,
- CURSOR_ACTIVATED,
- SELECTION_CHANGED,
- SELECTION_ROW_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_selection_model_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- PROP_0,
- PROP_SORTER,
- PROP_SELECTION_MODE,
- PROP_CURSOR_MODE
-};
-
-inline static void
-add_sorter(ESelectionModel *esm, ESorter *sorter)
-{
- esm->sorter = sorter;
- if (sorter) {
- g_object_ref (sorter);
- }
-}
-
-inline static void
-drop_sorter(ESelectionModel *esm)
-{
- if (esm->sorter) {
- g_object_unref (esm->sorter);
- }
- esm->sorter = NULL;
-}
-
-static void
-esm_dispose (GObject *object)
-{
- ESelectionModel *esm;
-
- esm = E_SELECTION_MODEL (object);
-
- drop_sorter(esm);
-
- if (e_selection_model_parent_class->dispose)
- (* e_selection_model_parent_class->dispose) (object);
-}
-
-static void
-esm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_SORTER:
- g_value_set_object (value, esm->sorter);
- break;
-
- case PROP_SELECTION_MODE:
- g_value_set_int (value, esm->mode);
- break;
-
- case PROP_CURSOR_MODE:
- g_value_set_int (value, esm->cursor_mode);
- break;
- }
-}
-
-static void
-esm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_SORTER:
- drop_sorter(esm);
- add_sorter(esm, g_value_get_object (value) ? E_SORTER(g_value_get_object(value)) : NULL);
- break;
-
- case PROP_SELECTION_MODE:
- esm->mode = g_value_get_int (value);
- if (esm->mode == GTK_SELECTION_SINGLE) {
- int cursor_row = e_selection_model_cursor_row(esm);
- int cursor_col = e_selection_model_cursor_col(esm);
- e_selection_model_do_something(esm, cursor_row, cursor_col, 0);
- }
- break;
-
- case PROP_CURSOR_MODE:
- esm->cursor_mode = g_value_get_int (value);
- break;
- }
-}
-
-static void
-e_selection_model_init (ESelectionModel *selection)
-{
- selection->mode = GTK_SELECTION_MULTIPLE;
- selection->cursor_mode = E_CURSOR_SIMPLE;
- selection->old_selection = -1;
-}
-
-static void
-e_selection_model_class_init (ESelectionModelClass *klass)
-{
- GObjectClass *object_class;
-
- e_selection_model_parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
-
- object_class->dispose = esm_dispose;
- object_class->get_property = esm_get_property;
- object_class->set_property = esm_set_property;
-
- e_selection_model_signals [CURSOR_CHANGED] =
- g_signal_new ("cursor_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, cursor_changed),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_selection_model_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_selection_model_signals [SELECTION_CHANGED] =
- g_signal_new ("selection_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, selection_changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_selection_model_signals [SELECTION_ROW_CHANGED] =
- g_signal_new ("selection_row_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, selection_row_changed),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- klass->cursor_changed = NULL;
- klass->cursor_activated = NULL;
- klass->selection_changed = NULL;
- klass->selection_row_changed = NULL;
-
- klass->is_row_selected = NULL;
- klass->foreach = NULL;
- klass->clear = NULL;
- klass->selected_count = NULL;
- klass->select_all = NULL;
- klass->invert_selection = NULL;
- klass->row_count = NULL;
-
- klass->change_one_row = NULL;
- klass->change_cursor = NULL;
- klass->cursor_row = NULL;
- klass->cursor_col = NULL;
-
- klass->select_single_row = NULL;
- klass->toggle_single_row = NULL;
- klass->move_selection_end = NULL;
- klass->set_selection_end = NULL;
-
- g_object_class_install_property (object_class, PROP_SORTER,
- g_param_spec_object ("sorter",
- _("Sorter"),
- /*_( */"XXX blurb" /*)*/,
- E_SORTER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODE,
- g_param_spec_int ("selection_mode",
- _("Selection Mode"),
- /*_( */"XXX blurb" /*)*/,
- GTK_SELECTION_NONE, GTK_SELECTION_MULTIPLE,
- GTK_SELECTION_SINGLE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- _("Cursor Mode"),
- /*_( */"XXX blurb" /*)*/,
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET,
- E_CURSOR_LINE,
- G_PARAM_READWRITE));
-}
-
-E_MAKE_TYPE(e_selection_model, "ESelectionModel", ESelectionModel,
- e_selection_model_class_init, e_selection_model_init, PARENT_TYPE)
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-gboolean
-e_selection_model_is_row_selected (ESelectionModel *selection,
- gint n)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected)
- return E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected (selection, n);
- else
- return FALSE;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-void
-e_selection_model_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->foreach)
- E_SELECTION_MODEL_GET_CLASS(selection)->foreach (selection, callback, closure);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-void
-e_selection_model_clear(ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->clear)
- E_SELECTION_MODEL_GET_CLASS(selection)->clear (selection);
-}
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-gint
-e_selection_model_selected_count (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->selected_count)
- return E_SELECTION_MODEL_GET_CLASS(selection)->selected_count (selection);
- else
- return 0;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-void
-e_selection_model_select_all (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->select_all)
- E_SELECTION_MODEL_GET_CLASS(selection)->select_all (selection);
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-void
-e_selection_model_invert_selection (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection)
- E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection (selection);
-}
-
-int
-e_selection_model_row_count (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->row_count)
- return E_SELECTION_MODEL_GET_CLASS(selection)->row_count (selection);
- else
- return 0;
-}
-
-void
-e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row (selection, row, grow);
-}
-
-void
-e_selection_model_change_cursor (ESelectionModel *selection, int row, int col)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor)
- E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor (selection, row, col);
-}
-
-int
-e_selection_model_cursor_row (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row)
- return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row (selection);
- else
- return -1;
-}
-
-int
-e_selection_model_cursor_col (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col)
- return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col (selection);
- else
- return -1;
-}
-
-void
-e_selection_model_select_single_row (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row (selection, row);
-}
-
-void
-e_selection_model_toggle_single_row (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row (selection, row);
-}
-
-void
-e_selection_model_move_selection_end (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end)
- E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end (selection, row);
-}
-
-void
-e_selection_model_set_selection_end (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end)
- E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end (selection, row);
-}
-
-/**
- * e_selection_model_do_something
- * @selection: #ESelectionModel to do something to.
- * @row: The row to do something in.
- * @col: The col to do something in.
- * @state: The state in which to do something.
- *
- * This routine does whatever is appropriate as if the user clicked
- * the mouse in the given row and column.
- */
-void
-e_selection_model_do_something (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- gint shift_p = state & GDK_SHIFT_MASK;
- gint ctrl_p = state & GDK_CONTROL_MASK;
- int row_count;
-
- selection->old_selection = -1;
-
- if (row == -1 && col != -1)
- row = 0;
- if (col == -1 && row != -1)
- col = 0;
-
- row_count = e_selection_model_row_count(selection);
- if (row_count >= 0 && row < row_count) {
- switch (selection->mode) {
- case GTK_SELECTION_SINGLE:
- e_selection_model_select_single_row (selection, row);
- break;
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- if (shift_p) {
- e_selection_model_set_selection_end (selection, row);
- } else {
- if (ctrl_p) {
- e_selection_model_toggle_single_row (selection, row);
- } else {
- e_selection_model_select_single_row (selection, row);
- }
- }
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- e_selection_model_change_cursor(selection, row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
- }
-}
-
-/**
- * e_selection_model_maybe_do_something
- * @selection: #ESelectionModel to do something to.
- * @row: The row to do something in.
- * @col: The col to do something in.
- * @state: The state in which to do something.
- *
- * If this row is selected, this routine just moves the cursor row and
- * column. Otherwise, it does the same thing as
- * e_selection_model_do_something(). This is for being used on
- * right clicks and other events where if the user hit the selection,
- * they don't want it to change.
- */
-gboolean
-e_selection_model_maybe_do_something (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- selection->old_selection = -1;
-
- if (e_selection_model_is_row_selected(selection, row)) {
- e_selection_model_change_cursor(selection, row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
- return FALSE;
- } else {
- e_selection_model_do_something(selection, row, col, state);
- return TRUE;
- }
-}
-
-void
-e_selection_model_right_click_down (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- if (selection->mode == GTK_SELECTION_SINGLE) {
- selection->old_selection = e_selection_model_cursor_row (selection);
- e_selection_model_select_single_row (selection, row);
- } else {
- e_selection_model_maybe_do_something (selection, row, col, state);
- }
-}
-
-void
-e_selection_model_right_click_up (ESelectionModel *selection)
-{
- if (selection->mode == GTK_SELECTION_SINGLE && selection->old_selection != -1) {
- e_selection_model_select_single_row (selection, selection->old_selection);
- }
-}
-
-void
-e_selection_model_select_as_key_press (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- int cursor_activated = TRUE;
-
- gint shift_p = state & GDK_SHIFT_MASK;
- gint ctrl_p = state & GDK_CONTROL_MASK;
-
- selection->old_selection = -1;
-
- switch (selection->mode) {
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- if (shift_p) {
- e_selection_model_set_selection_end (selection, row);
- } else if (!ctrl_p) {
- e_selection_model_select_single_row (selection, row);
- } else
- cursor_activated = FALSE;
- break;
- case GTK_SELECTION_SINGLE:
- e_selection_model_select_single_row (selection, row);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- if (row != -1) {
- e_selection_model_change_cursor(selection, row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
- if (cursor_activated)
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
- }
-}
-
-static gint
-move_selection (ESelectionModel *selection,
- gboolean up,
- GdkModifierType state)
-{
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- int row_count;
-
- row = e_sorter_model_to_sorted(selection->sorter, row);
- if (up)
- row--;
- else
- row++;
- if (row < 0)
- row = 0;
- row_count = e_selection_model_row_count(selection);
- if (row >= row_count)
- row = row_count - 1;
- row = e_sorter_sorted_to_model(selection->sorter, row);
-
- e_selection_model_select_as_key_press (selection, row, col, state);
- return TRUE;
-}
-
-/**
- * e_selection_model_key_press
- * @selection: #ESelectionModel to affect.
- * @key: The event.
- *
- * This routine does whatever is appropriate as if the user pressed
- * the given key.
- *
- * Returns: %TRUE if the #ESelectionModel used the key.
- */
-gint
-e_selection_model_key_press (ESelectionModel *selection,
- GdkEventKey *key)
-{
- selection->old_selection = -1;
-
- switch (key->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
- return move_selection(selection, TRUE, key->state);
- break;
- case GDK_Down:
- case GDK_KP_Down:
- return move_selection(selection, FALSE, key->state);
- break;
- case GDK_space:
- case GDK_KP_Space:
- if (selection->mode != GTK_SELECTION_SINGLE) {
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- e_selection_model_toggle_single_row (selection, row);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
- return TRUE;
- }
- break;
- case GDK_Return:
- case GDK_KP_Enter:
- if (selection->mode != GTK_SELECTION_SINGLE) {
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- e_selection_model_select_single_row (selection, row);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
- return TRUE;
- }
- break;
- case GDK_Home:
- case GDK_KP_Home:
- if (selection->cursor_mode == E_CURSOR_LINE) {
- int row = 0;
- int cursor_col = e_selection_model_cursor_col(selection);
-
- row = e_sorter_sorted_to_model(selection->sorter, row);
- e_selection_model_select_as_key_press (selection, row, cursor_col, key->state);
- return TRUE;
- }
- break;
- case GDK_End:
- case GDK_KP_End:
- if (selection->cursor_mode == E_CURSOR_LINE) {
- int row = e_selection_model_row_count(selection) - 1;
- int cursor_col = e_selection_model_cursor_col(selection);
-
- row = e_sorter_sorted_to_model(selection->sorter, row);
- e_selection_model_select_as_key_press (selection, row, cursor_col, key->state);
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-void
-e_selection_model_cursor_changed (ESelectionModel *selection,
- int row,
- int col)
-{
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
-}
-
-void
-e_selection_model_cursor_activated (ESelectionModel *selection,
- int row,
- int col)
-{
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
-}
-
-void
-e_selection_model_selection_changed (ESelectionModel *selection)
-{
- g_signal_emit(selection,
- e_selection_model_signals[SELECTION_CHANGED], 0);
-}
-
-void
-e_selection_model_selection_row_changed (ESelectionModel *selection,
- int row)
-{
- g_signal_emit(selection,
- e_selection_model_signals[SELECTION_ROW_CHANGED], 0,
- row);
-}
diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h
deleted file mode 100644
index a78bdfd9c3..0000000000
--- a/widgets/misc/e-selection-model.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_SELECTION_MODEL_H_
-#define _E_SELECTION_MODEL_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <gdk/gdkevents.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ())
-#define E_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel))
-#define E_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass))
-#define E_IS_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_TYPE))
-#define E_IS_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE))
-#define E_SELECTION_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_TYPE, ESelectionModelClass))
-
-#ifndef _E_FOREACH_FUNC_H_
-#define _E_FOREACH_FUNC_H_
-typedef void (*EForeachFunc) (int model_row,
- gpointer closure);
-#endif
-
-/* list selection modes */
-typedef enum {
- E_CURSOR_LINE,
- E_CURSOR_SIMPLE,
- E_CURSOR_SPREADSHEET
-} ECursorMode;
-
-typedef struct {
- GObject base;
-
- ESorter *sorter;
-
- GtkSelectionMode mode;
- ECursorMode cursor_mode;
-
- int old_selection;
-} ESelectionModel;
-
-typedef struct {
- GObjectClass parent_class;
-
- /* Virtual methods */
- gboolean (*is_row_selected) (ESelectionModel *esm, int row);
- void (*foreach) (ESelectionModel *esm, EForeachFunc callback, gpointer closure);
- void (*clear) (ESelectionModel *esm);
- gint (*selected_count) (ESelectionModel *esm);
- void (*select_all) (ESelectionModel *esm);
- void (*invert_selection) (ESelectionModel *esm);
- int (*row_count) (ESelectionModel *esm);
-
- /* Protected virtual methods. */
- void (*change_one_row) (ESelectionModel *esm, int row, gboolean on);
- void (*change_cursor) (ESelectionModel *esm, int row, int col);
- int (*cursor_row) (ESelectionModel *esm);
- int (*cursor_col) (ESelectionModel *esm);
-
- void (*select_single_row) (ESelectionModel *selection, int row);
- void (*toggle_single_row) (ESelectionModel *selection, int row);
- void (*move_selection_end) (ESelectionModel *selection, int row);
- void (*set_selection_end) (ESelectionModel *selection, int row);
-
- /*
- * Signals
- */
-
- void (*cursor_changed) (ESelectionModel *esm, int row, int col);
- void (*cursor_activated) (ESelectionModel *esm, int row, int col);
- void (*selection_row_changed) (ESelectionModel *esm, int row);
- void (*selection_changed) (ESelectionModel *esm);
-
-} ESelectionModelClass;
-
-
-GType e_selection_model_get_type (void);
-void e_selection_model_do_something (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-gboolean e_selection_model_maybe_do_something (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-void e_selection_model_right_click_down (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state);
-void e_selection_model_right_click_up (ESelectionModel *selection);
-gint e_selection_model_key_press (ESelectionModel *esm,
- GdkEventKey *key);
-void e_selection_model_select_as_key_press (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-
-/* Virtual functions */
-gboolean e_selection_model_is_row_selected (ESelectionModel *esm,
- gint n);
-void e_selection_model_foreach (ESelectionModel *esm,
- EForeachFunc callback,
- gpointer closure);
-void e_selection_model_clear (ESelectionModel *esm);
-gint e_selection_model_selected_count (ESelectionModel *esm);
-void e_selection_model_select_all (ESelectionModel *esm);
-void e_selection_model_invert_selection (ESelectionModel *esm);
-int e_selection_model_row_count (ESelectionModel *esm);
-
-
-/* Private virtual Functions */
-void e_selection_model_change_one_row (ESelectionModel *esm,
- int row,
- gboolean on);
-void e_selection_model_change_cursor (ESelectionModel *esm,
- int row,
- int col);
-int e_selection_model_cursor_row (ESelectionModel *esm);
-int e_selection_model_cursor_col (ESelectionModel *esm);
-void e_selection_model_select_single_row (ESelectionModel *selection,
- int row);
-void e_selection_model_toggle_single_row (ESelectionModel *selection,
- int row);
-void e_selection_model_move_selection_end (ESelectionModel *selection,
- int row);
-void e_selection_model_set_selection_end (ESelectionModel *selection,
- int row);
-
-/* Signals */
-void e_selection_model_cursor_changed (ESelectionModel *selection,
- int row,
- int col);
-void e_selection_model_cursor_activated (ESelectionModel *selection,
- int row,
- int col);
-void e_selection_model_selection_row_changed (ESelectionModel *selection,
- int row);
-void e_selection_model_selection_changed (ESelectionModel *selection);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_SELECTION_MODEL_H_ */
-
diff --git a/widgets/misc/e-title-bar.c b/widgets/misc/e-title-bar.c
deleted file mode 100644
index f5ce0f97c4..0000000000
--- a/widgets/misc/e-title-bar.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-title-bar.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktypeutils.h>
-
-#include <gal/util/e-util.h>
-#include "e-clipped-label.h"
-
-#include "e-title-bar.h"
-
-
-enum {
- LABEL_BUTTON_PRESS_EVENT,
- BUTTON_CLICKED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-/* The pixmaps. */
-
-static char *close_xpm[] = {
- "16 16 2 1",
- " c none",
- ". c #000000000000",
- " ",
- " ",
- " ",
- " .. .. ",
- " ... ... ",
- " ... ... ",
- " ...... ",
- " .... ",
- " .... ",
- " ...... ",
- " ... ... ",
- " ... ... ",
- " .. .. ",
- " ",
- " ",
- " "
-};
-
-static char *pin_xpm[] = {
- "16 16 33 1",
- " c None",
- ". c #000000",
- "+ c #74744D",
- "@ c #B2B279",
- "# c #6C6C46",
- "$ c #CACA9C",
- "% c #F4F4AD",
- "& c #85855A",
- "* c #B1B175",
- "= c #9A9A66",
- "- c #A9A98A",
- "; c #B0B07B",
- "> c #535353",
- ", c #818181",
- "' c #B7B7B7",
- ") c #D8D8D8",
- "! c #FFFFFF",
- "~ c #EBEBA1",
- "{ c #8A8A75",
- "] c #9F9F76",
- "^ c #9E9E75",
- "/ c #8A8A66",
- "( c #979770",
- "_ c #6B6B46",
- ": c #28281A",
- "< c #505034",
- "[ c #666645",
- "} c #61614D",
- "| c #818155",
- "1 c #4A4A31",
- "2 c #4D4D34",
- "3 c #6C6C48",
- "4 c #5D5D3E",
- " ",
- " ",
- " ",
- " . . ",
- " .. .+. ",
- " .@...#$. ",
- " ......%&*=-;. ",
- ".>,')!.~{]^/(. ",
- " ......_:<[}|. ",
- " .1...23. ",
- " .. .4. ",
- " . . ",
- " ",
- " ",
- " ",
- " "
-};
-
-
-#define PARENT_TYPE GTK_TYPE_FRAME
-static GtkFrameClass *parent_class = NULL;
-
-struct _ETitleBarPrivate {
- ETitleBarButtonMode button_mode;
- GtkWidget *label;
- GtkWidget *button;
- GtkWidget *close_gtk_pixmap;
- GtkWidget *pin_gtk_pixmap;
-};
-
-
-/* Mode handling. We put both the close and pin GtkPixmaps into an hbox in the
- button, and hide one of them according to the mode. */
-
-static void
-show_and_hide_pixmaps_according_to_mode (ETitleBar *title_bar)
-{
- ETitleBarPrivate *priv;
-
- priv = title_bar->priv;
-
- if (priv->close_gtk_pixmap == NULL || priv->pin_gtk_pixmap == NULL)
- return;
-
- switch (priv->button_mode) {
- case E_TITLE_BAR_BUTTON_MODE_PIN:
- gtk_widget_hide (priv->close_gtk_pixmap);
- gtk_widget_show (priv->pin_gtk_pixmap);
- break;
- case E_TITLE_BAR_BUTTON_MODE_CLOSE:
- gtk_widget_hide (priv->pin_gtk_pixmap);
- gtk_widget_show (priv->close_gtk_pixmap);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-
-/* Child signal callbacks. */
-
-static void
-button_realize_cb (GtkWidget *widget,
- gpointer data)
-{
- GdkPixmap *close_pixmap;
- GdkBitmap *close_mask;
- GdkPixmap *pin_pixmap;
- GdkBitmap *pin_mask;
- GtkWidget *hbox;
- ETitleBar *title_bar;
- ETitleBarPrivate *priv;
-
- title_bar = E_TITLE_BAR (data);
- priv = title_bar->priv;
-
- if (priv->close_gtk_pixmap != NULL)
- return;
-
- close_pixmap = gdk_pixmap_create_from_xpm_d (GTK_WIDGET (priv->button)->window,
- &close_mask, NULL, close_xpm);
- priv->close_gtk_pixmap = gtk_pixmap_new (close_pixmap, close_mask);
-
- pin_pixmap = gdk_pixmap_create_from_xpm_d (GTK_WIDGET (priv->button)->window,
- &pin_mask, NULL, pin_xpm);
- priv->pin_gtk_pixmap = gtk_pixmap_new (pin_pixmap, pin_mask);
-
- hbox = gtk_hbox_new (TRUE, 0);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (hbox), priv->pin_gtk_pixmap, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), priv->close_gtk_pixmap, TRUE, TRUE, 0);
-
- gtk_container_add (GTK_CONTAINER (priv->button), hbox);
-
- gdk_pixmap_unref (close_pixmap);
- g_object_unref (close_mask);
- gdk_pixmap_unref (pin_pixmap);
- g_object_unref (pin_mask);
-
- show_and_hide_pixmaps_according_to_mode (title_bar);
-}
-
-static void
-button_clicked_cb (GtkButton *button,
- gpointer data)
-{
- ETitleBar *title_bar;
-
- title_bar = E_TITLE_BAR (data);
-
- gtk_signal_emit (GTK_OBJECT (title_bar), signals[BUTTON_CLICKED]);
-}
-
-static void
-label_button_press_event_cb (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- ETitleBar *title_bar;
-
- title_bar = E_TITLE_BAR (data);
-
- gtk_signal_emit (GTK_OBJECT (title_bar), signals[LABEL_BUTTON_PRESS_EVENT], event);
-}
-
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- ETitleBar *title_bar;
- ETitleBarPrivate *priv;
-
- title_bar = E_TITLE_BAR (object);
- priv = title_bar->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-static void
-class_init (ETitleBarClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = impl_finalize;
-
- parent_class = g_type_class_ref(gtk_frame_get_type ());
-
- signals[LABEL_BUTTON_PRESS_EVENT] =
- gtk_signal_new ("label_button_press_event",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ETitleBarClass, label_button_press_event),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- signals[BUTTON_CLICKED] =
- gtk_signal_new ("button_clicked",
- GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ETitleBarClass, button_clicked),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-}
-
-static void
-init (ETitleBar *title_bar)
-{
- ETitleBarPrivate *priv;
-
- priv = g_new (ETitleBarPrivate, 1);
-
- priv->button_mode = E_TITLE_BAR_BUTTON_MODE_CLOSE;
- priv->label = NULL;
- priv->button = NULL;
- priv->close_gtk_pixmap = NULL;
- priv->pin_gtk_pixmap = NULL;
-
- title_bar->priv = priv;
-}
-
-
-void
-e_title_bar_construct (ETitleBar *title_bar,
- const char *title)
-{
- ETitleBarPrivate *priv;
- GtkWidget *hbox;
-
- g_return_if_fail (title_bar != NULL);
- g_return_if_fail (E_IS_TITLE_BAR (title_bar));
-
- priv = title_bar->priv;
-
- priv->label = e_clipped_label_new (title);
- gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (priv->label), 2, 0);
- gtk_widget_show (priv->label);
-
- priv->button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (priv->button, GTK_CAN_FOCUS);
- gtk_container_set_border_width (GTK_CONTAINER (priv->button), 1);
- gtk_button_set_relief (GTK_BUTTON (priv->button), GTK_RELIEF_NONE);
- gtk_widget_show (priv->button);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), priv->label, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), priv->button, FALSE, TRUE, 1);
- gtk_widget_show (hbox);
-
- gtk_container_add (GTK_CONTAINER (title_bar), hbox);
-
- g_signal_connect((priv->button), "realize",
- G_CALLBACK (button_realize_cb), title_bar);
- g_signal_connect((priv->button), "clicked",
- G_CALLBACK (button_clicked_cb), title_bar);
- g_signal_connect((priv->label), "button_press_event",
- G_CALLBACK (label_button_press_event_cb), title_bar);
-}
-
-GtkWidget *
-e_title_bar_new (const char *title)
-{
- ETitleBar *title_bar;
-
- title_bar = gtk_type_new (e_title_bar_get_type ());
-
- e_title_bar_construct (title_bar, title);
-
- return GTK_WIDGET (title_bar);
-}
-
-
-void
-e_title_bar_set_title (ETitleBar *title_bar,
- const char *title)
-{
- g_return_if_fail (title_bar != NULL);
- g_return_if_fail (E_IS_TITLE_BAR (title_bar));
-
- e_clipped_label_set_text (E_CLIPPED_LABEL (title_bar->priv->label), title);
-}
-
-void
-e_title_bar_show_button (ETitleBar *title_bar,
- gboolean show)
-{
- ETitleBarPrivate *priv;
-
- g_return_if_fail (title_bar != NULL);
- g_return_if_fail (E_IS_TITLE_BAR (title_bar));
-
- priv = title_bar->priv;
-
- if (show)
- gtk_widget_show (priv->button);
- else
- gtk_widget_hide (priv->button);
-}
-
-void
-e_title_bar_set_button_mode (ETitleBar *title_bar,
- ETitleBarButtonMode button_mode)
-{
- ETitleBarPrivate *priv;
-
- g_return_if_fail (title_bar != NULL);
- g_return_if_fail (E_IS_TITLE_BAR (title_bar));
- g_return_if_fail (button_mode == E_TITLE_BAR_BUTTON_MODE_CLOSE
- || button_mode == E_TITLE_BAR_BUTTON_MODE_PIN);
-
- priv = title_bar->priv;
-
- if (priv->button_mode == button_mode)
- return;
-
- priv->button_mode = button_mode;
- show_and_hide_pixmaps_according_to_mode (title_bar);
-}
-
-ETitleBarButtonMode
-e_title_bar_get_button_mode (ETitleBar *title_bar)
-{
- g_return_val_if_fail (title_bar != NULL, E_TITLE_BAR_BUTTON_MODE_CLOSE);
- g_return_val_if_fail (E_IS_TITLE_BAR (title_bar), E_TITLE_BAR_BUTTON_MODE_CLOSE);
-
- return title_bar->priv->button_mode;
-}
-
-
-E_MAKE_TYPE (e_title_bar, "ETitleBar", ETitleBar, class_init, init, PARENT_TYPE)
diff --git a/widgets/misc/e-title-bar.h b/widgets/misc/e-title-bar.h
deleted file mode 100644
index 32c4f2b262..0000000000
--- a/widgets/misc/e-title-bar.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-title-bar.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_TITLE_BAR_H__
-#define __E_TITLE_BAR_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkframe.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_TITLE_BAR (e_title_bar_get_type ())
-#define E_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TITLE_BAR, ETitleBar))
-#define E_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TITLE_BAR, ETitleBarClass))
-#define E_IS_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TITLE_BAR))
-#define E_IS_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_TITLE_BAR))
-
-
-enum _ETitleBarButtonMode {
- E_TITLE_BAR_BUTTON_MODE_PIN,
- E_TITLE_BAR_BUTTON_MODE_CLOSE
-};
-typedef enum _ETitleBarButtonMode ETitleBarButtonMode;
-
-typedef struct _ETitleBar ETitleBar;
-typedef struct _ETitleBarPrivate ETitleBarPrivate;
-typedef struct _ETitleBarClass ETitleBarClass;
-
-struct _ETitleBar {
- GtkFrame parent;
-
- ETitleBarPrivate *priv;
-};
-
-struct _ETitleBarClass {
- GtkFrameClass parent_class;
-
- /* Signals. */
-
- void (* label_button_press_event) (ETitleBar *title_bar, GdkEventButton *event);
- void (* button_clicked) (ETitleBar *title_bar);
-};
-
-
-GtkType e_title_bar_get_type (void);
-void e_title_bar_construct (ETitleBar *title_bar,
- const char *title);
-GtkWidget *e_title_bar_new (const char *title);
-void e_title_bar_set_title (ETitleBar *title_bar,
- const char *title);
-void e_title_bar_show_button (ETitleBar *title_bar,
- gboolean show);
-void e_title_bar_set_button_mode (ETitleBar *title_bar,
- ETitleBarButtonMode button_mode);
-ETitleBarButtonMode e_title_bar_get_button_mode (ETitleBar *title_bar);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_TITLE_BAR_H__ */
diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c
deleted file mode 100644
index 0cea6371b4..0000000000
--- a/widgets/misc/e-unicode.c
+++ /dev/null
@@ -1,2272 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-unicode.c - utf-8 support functions for gal
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/*
- * TODO: Break simple ligatures in e_utf8_strstrcasedecomp
- */
-
-#include <config.h>
-
-#include "e-unicode.h"
-
-#include "gal/util/e-i18n.h"
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <iconv.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmenuitem.h>
-#include "e-font.h"
-#include <libxml/xmlmemory.h>
-#include <stdlib.h>
-#include "gal/util/e-iconv.h"
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#define d(x) x
-
-#define FONT_TESTING
-#define MAX_DECOMP 8
-
-static gint e_canonical_decomposition (gunichar ch, gunichar * buf);
-static gunichar e_stripped_char (gunichar ch);
-
-#ifndef NO_WARNINGS
-#warning FIXME: this has not been ported fully yet - non ASCII people beware.
-#endif
-
-/*
- * This my favourite
- *
- * strstr doing case insensitive, decomposing search
- *
- * Lauris
- */
-
-const gchar *
-e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle)
-{
- gunichar *nuni;
- gunichar unival;
- gint nlen;
- const guchar *o, *p;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
- if (strlen (haystack) == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- nlen = 0;
- for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = e_stripped_char (unival);
- if (sc) {
- nuni[nlen++] = sc;
- }
- }
- /* NULL means there was illegal utf-8 sequence */
- if (!p) return NULL;
- /* If everything is correct, we have decomposed, lowercase, stripped needle */
- if (nlen < 1) return haystack;
-
- o = haystack;
- for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = e_stripped_char (unival);
- if (sc) {
- /* We have valid stripped char */
- if (sc == nuni[0]) {
- const gchar *q = p;
- gint npos = 1;
- while (npos < nlen) {
- q = e_unicode_get_utf8 (q, &unival);
- if (!q || !unival) return NULL;
- sc = e_stripped_char (unival);
- if ((!sc) || (sc != nuni[npos])) break;
- npos++;
- }
- if (npos == nlen) {
- return o;
- }
- }
- }
- o = p;
- }
-
- return NULL;
-}
-
-const gchar *
-e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
-{
- gunichar *nuni;
- gunichar unival;
- gint nlen;
- const guchar *o, *p;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
- if (strlen (haystack) == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- nlen = 0;
- for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- nuni[nlen++] = g_unichar_tolower (unival);
- }
- /* NULL means there was illegal utf-8 sequence */
- if (!p) return NULL;
-
- o = haystack;
- for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = g_unichar_tolower (unival);
- /* We have valid stripped char */
- if (sc == nuni[0]) {
- const gchar *q = p;
- gint npos = 1;
- while (npos < nlen) {
- q = e_unicode_get_utf8 (q, &unival);
- if (!q || !unival) return NULL;
- sc = g_unichar_tolower (unival);
- if (sc != nuni[npos]) break;
- npos++;
- }
- if (npos == nlen) {
- return o;
- }
- }
- o = p;
- }
-
- return NULL;
-}
-
-#if 0
-const gchar *
-e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
-{
- gchar *p;
- gunichar *huni, *nuni;
- gunichar unival;
- gint hlen, nlen, hp, np;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
-
- huni = alloca (sizeof (gunichar) * strlen (haystack));
-
- for (hlen = 0, p = e_unicode_get_utf8 (haystack, &unival); p && unival; hlen++, p = e_unicode_get_utf8 (p, &unival)) {
- huni[hlen] = g_unichar_tolower (unival);
- }
-
- if (!p) return NULL;
- if (hlen == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- for (nlen = 0, p = e_unicode_get_utf8 (needle, &unival); p && unival; nlen++, p = e_unicode_get_utf8 (p, &unival)) {
- nuni[nlen] = g_unichar_tolower (unival);
- }
-
- if (!p) return NULL;
- if (nlen == 0) return NULL;
-
- if (hlen < nlen) return NULL;
-
- for (hp = 0; hp <= hlen - nlen; hp++) {
- for (np = 0; np < nlen; np++) {
- if (huni[hp + np] != nuni[np]) break;
- }
- if (np == nlen) return haystack + unicode_offset_to_index (haystack, hp);
- }
-
- return NULL;
-}
-#endif
-
-gchar *
-e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string)
-{
- gint unival;
- gchar *utf;
- gint unilen;
-
- if (keyval == GDK_VoidSymbol) {
- utf = e_utf8_from_locale_string (string);
- } else {
- unival = gdk_keyval_to_unicode (keyval);
-
- if (unival < ' ') return NULL;
-
- utf = g_new (gchar, 7);
-
- unilen = e_unichar_to_utf8 (unival, utf);
-
- utf[unilen] = '\0';
- }
-
- return utf;
-}
-
-gchar *
-e_utf8_from_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes)
-{
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- if (ic == (iconv_t) -1) {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- return new;
-}
-
-gchar *
-e_utf8_from_iconv_string (iconv_t ic, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_iconv_string_sized (ic, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes)
-{
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- if (ic == (iconv_t) -1) {
- gint len;
- const gchar *u;
- gunichar uc;
-
- new = g_new (unsigned char, bytes * 4 + 1);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- new[len++] = uc & 0xff;
- }
- new[len] = '\0';
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (char, ibl * 4 + 4);
- obl = ibl * 4;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
-
- /* FIXME: this is wrong... what if the destination charset is 16 or 32 bit? */
- *ob++ = '_';
- obl--;
- }
- }
-
- /* Make sure to terminate with plenty of padding */
- memset (ob, 0, 4);
-
- return new;
-}
-
-gchar *
-e_utf8_to_iconv_string (iconv_t ic, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_iconv_string_sized (ic, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_charset_string_sized (const gchar *charset, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open("utf-8", charset);
- ret = e_utf8_from_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_from_charset_string (const gchar *charset, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_charset_string_sized (charset, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_charset_string_sized (const gchar *charset, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open(charset, "utf-8");
- ret = e_utf8_to_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_to_charset_string (const gchar *charset, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_charset_string_sized (charset, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- ic = e_iconv_from_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- if (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) {
- gint i;
- const guchar *ib;
- guchar * ob, * new;
- /* iso-10646 */
- ib = string;
- new = ob = g_new (unsigned char, bytes * 6 + 1);
- for (i = 0; i < (bytes - 1); i += 2) {
- ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob);
- }
- *ob = '\0';
- return new;
- } else {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- gtk_widget_ensure_style (widget);
- ic = e_iconv_to_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- gboolean twobyte;
- gint len;
- const gchar *u;
- gunichar uc;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- twobyte = (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0)));
-
- new = g_new (unsigned char, bytes * 4 + 2);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- if (twobyte) {
- new[len++] = (uc & 0xff00) >> 8;
- }
- new[len++] = uc & 0xff;
- }
-
- new[len++] = '\0';
- if (twobyte)
- new[len] = '\0';
-
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 4 + 4);
- obl = ibl * 4;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- /* Make sure to terminate with plenty of padding */
- memset (ob, 0, 4);
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open("utf-8", e_iconv_locale_charset());
- ret = e_utf8_from_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_from_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_locale_string_sized (string, strlen (string));
-}
-
-gchar *
-e_utf8_to_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open(e_iconv_locale_charset(), "utf-8");
- ret = e_utf8_to_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_to_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_locale_string_sized (string, strlen (string));
-}
-
-gboolean
-e_utf8_is_ascii (const gchar *string)
-{
- char c;
-
- g_return_val_if_fail (string != NULL, FALSE);
-
- for (; (c = *string); string++) {
- if (c & 0x80)
- return FALSE;
- }
-
- return TRUE;
-}
-
-gchar *
-e_utf8_gtk_entry_get_text (GtkEntry *entry)
-{
- return g_strdup (gtk_entry_get_text (entry));
-}
-
-gchar *
-e_utf8_gtk_editable_get_text (GtkEditable *editable)
-{
- return gtk_editable_get_chars (editable, 0, -1);
-}
-
-gchar *
-e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end)
-{
- return gtk_editable_get_chars (editable, start, end);
-}
-
-void
-e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position)
-{
- gtk_editable_insert_text (editable, text, length, position);
-}
-
-void
-e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text)
-{
- int position;
-
- gtk_editable_delete_text(editable, 0, -1);
- gtk_editable_insert_text (editable, text, strlen (text), &position);
-}
-
-void
-e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text)
-{
- if (!text)
- gtk_entry_set_text(entry, "");
- else
- gtk_entry_set_text (entry, text);
-}
-
-GtkWidget *
-e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label)
-{
- GtkWidget *w;
- gchar *s;
-
- if (!label) return NULL;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) menu, label);
- w = gtk_menu_item_new_with_label (s);
-
- g_free (s);
-
- return w;
-}
-
-void
-e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
-{
- gchar *s;
-
- if (!text) return;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
- gtk_clist_set_text (clist, row, col, s);
-
- if (s) g_free (s);
-}
-
-gint
-e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
-{
- gint row, i;
- gchar **v;
-
- if (!text) return 0;
-
- v = g_new (gchar *, clist->columns);
- for (i = 0; i < clist->columns; i++)
- v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
-
- row = gtk_clist_append (clist, v);
-
- for (i = 0; i < clist->columns; i++)
- if (v[i]) g_free (v[i]);
-
- return row;
-}
-
-/*
- * Translate \U+XXXX\ sequences to utf8 chars
- */
-
-gchar *
-e_utf8_xml1_decode (const gchar *text)
-{
- const guchar *c;
- guchar *u, *d;
- int len, s;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = strlen (text)+1;
- /* len * 2 is absolute maximum */
- u = d = g_malloc (len * 2);
-
- c = text;
- s = 0;
- while (s < len) {
- if ((s <= (len - 8)) &&
- (c[s ] == '\\') &&
- (c[s + 1] == 'U' ) &&
- (c[s + 2] == '+' ) &&
- isxdigit (c[s + 3]) &&
- isxdigit (c[s + 4]) &&
- isxdigit (c[s + 5]) &&
- isxdigit (c[s + 6]) &&
- (c[s + 7] == '\\')) {
- /* Valid \U+XXXX\ sequence */
- unsigned int unival;
- unival = strtol (c + s + 3, NULL, 16);
- d += e_unichar_to_utf8 (unival, d);
- s += 8;
- } else if (c[s] > 127) {
- /* fixme: We assume iso-8859-1 currently */
- d += e_unichar_to_utf8 (c[s], d);
- s += 1;
- } else {
- *d++ = c[s++];
- }
- }
- *d++ = '\0';
- u = g_realloc (u, (d - u));
-
- return u;
-}
-
-gchar *
-e_utf8_xml1_encode (const gchar *text)
-{
- guchar *u, *d, *c;
- int unival;
- int len;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = 0;
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- len += 8;
- } else {
- len += 1;
- }
- }
- d = c = g_new (guchar, len + 1);
-
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- *c++ = '\\';
- *c++ = 'U';
- *c++ = '+';
- c += sprintf (c, "%04x", unival);
- *c++ = '\\';
- } else {
- *c++ = unival;
- }
- }
- *c = '\0';
-
- return d;
-}
-
-/**
- * e_unichar_to_utf8:
- * @c: a ISO10646 character code
- * @outbuf: output buffer, must have at least 6 bytes of space.
- * If %NULL, the length will be computed and returned
- * and nothing will be written to @out.
- *
- * Convert a single character to utf8
- *
- * Return value: number of bytes written
- **/
-
-gint
-e_unichar_to_utf8 (gint c, gchar *outbuf)
-{
- size_t len = 0;
- int first;
- int i;
-
- if (c < 0x80)
- {
- first = 0;
- len = 1;
- }
- else if (c < 0x800)
- {
- first = 0xc0;
- len = 2;
- }
- else if (c < 0x10000)
- {
- first = 0xe0;
- len = 3;
- }
- else if (c < 0x200000)
- {
- first = 0xf0;
- len = 4;
- }
- else if (c < 0x4000000)
- {
- first = 0xf8;
- len = 5;
- }
- else
- {
- first = 0xfc;
- len = 6;
- }
-
- if (outbuf)
- {
- for (i = len - 1; i > 0; --i)
- {
- outbuf[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
- outbuf[0] = c | first;
- }
-
- return len;
-}
-
-gchar *
-e_unicode_get_utf8 (const gchar *text, gunichar *out)
-{
- *out = g_utf8_get_char (text);
- return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text);
-}
-
-/*
- * Canonical decomposition
- *
- * It is copied here from libunicode, because we do not want malloc
- *
- */
-
-typedef struct
-{
- unsigned short ch;
- unsigned char *expansion;
-} e_decomposition;
-
-static e_decomposition e_decomp_table[] =
-{
- { 0x00c0, "\x00\x41\x03\x00\0" },
- { 0x00c1, "\x00\x41\x03\x01\0" },
- { 0x00c2, "\x00\x41\x03\x02\0" },
- { 0x00c3, "\x00\x41\x03\x03\0" },
- { 0x00c4, "\x00\x41\x03\x08\0" },
- { 0x00c5, "\x00\x41\x03\x0a\0" },
- { 0x00c7, "\x00\x43\x03\x27\0" },
- { 0x00c8, "\x00\x45\x03\x00\0" },
- { 0x00c9, "\x00\x45\x03\x01\0" },
- { 0x00ca, "\x00\x45\x03\x02\0" },
- { 0x00cb, "\x00\x45\x03\x08\0" },
- { 0x00cc, "\x00\x49\x03\x00\0" },
- { 0x00cd, "\x00\x49\x03\x01\0" },
- { 0x00ce, "\x00\x49\x03\x02\0" },
- { 0x00cf, "\x00\x49\x03\x08\0" },
- { 0x00d1, "\x00\x4e\x03\x03\0" },
- { 0x00d2, "\x00\x4f\x03\x00\0" },
- { 0x00d3, "\x00\x4f\x03\x01\0" },
- { 0x00d4, "\x00\x4f\x03\x02\0" },
- { 0x00d5, "\x00\x4f\x03\x03\0" },
- { 0x00d6, "\x00\x4f\x03\x08\0" },
- { 0x00d9, "\x00\x55\x03\x00\0" },
- { 0x00da, "\x00\x55\x03\x01\0" },
- { 0x00db, "\x00\x55\x03\x02\0" },
- { 0x00dc, "\x00\x55\x03\x08\0" },
- { 0x00dd, "\x00\x59\x03\x01\0" },
- { 0x00e0, "\x00\x61\x03\x00\0" },
- { 0x00e1, "\x00\x61\x03\x01\0" },
- { 0x00e2, "\x00\x61\x03\x02\0" },
- { 0x00e3, "\x00\x61\x03\x03\0" },
- { 0x00e4, "\x00\x61\x03\x08\0" },
- { 0x00e5, "\x00\x61\x03\x0a\0" },
- { 0x00e7, "\x00\x63\x03\x27\0" },
- { 0x00e8, "\x00\x65\x03\x00\0" },
- { 0x00e9, "\x00\x65\x03\x01\0" },
- { 0x00ea, "\x00\x65\x03\x02\0" },
- { 0x00eb, "\x00\x65\x03\x08\0" },
- { 0x00ec, "\x00\x69\x03\x00\0" },
- { 0x00ed, "\x00\x69\x03\x01\0" },
- { 0x00ee, "\x00\x69\x03\x02\0" },
- { 0x00ef, "\x00\x69\x03\x08\0" },
- { 0x00f1, "\x00\x6e\x03\x03\0" },
- { 0x00f2, "\x00\x6f\x03\x00\0" },
- { 0x00f3, "\x00\x6f\x03\x01\0" },
- { 0x00f4, "\x00\x6f\x03\x02\0" },
- { 0x00f5, "\x00\x6f\x03\x03\0" },
- { 0x00f6, "\x00\x6f\x03\x08\0" },
- { 0x00f9, "\x00\x75\x03\x00\0" },
- { 0x00fa, "\x00\x75\x03\x01\0" },
- { 0x00fb, "\x00\x75\x03\x02\0" },
- { 0x00fc, "\x00\x75\x03\x08\0" },
- { 0x00fd, "\x00\x79\x03\x01\0" },
- { 0x00ff, "\x00\x79\x03\x08\0" },
- { 0x0100, "\x00\x41\x03\x04\0" },
- { 0x0101, "\x00\x61\x03\x04\0" },
- { 0x0102, "\x00\x41\x03\x06\0" },
- { 0x0103, "\x00\x61\x03\x06\0" },
- { 0x0104, "\x00\x41\x03\x28\0" },
- { 0x0105, "\x00\x61\x03\x28\0" },
- { 0x0106, "\x00\x43\x03\x01\0" },
- { 0x0107, "\x00\x63\x03\x01\0" },
- { 0x0108, "\x00\x43\x03\x02\0" },
- { 0x0109, "\x00\x63\x03\x02\0" },
- { 0x010a, "\x00\x43\x03\x07\0" },
- { 0x010b, "\x00\x63\x03\x07\0" },
- { 0x010c, "\x00\x43\x03\x0c\0" },
- { 0x010d, "\x00\x63\x03\x0c\0" },
- { 0x010e, "\x00\x44\x03\x0c\0" },
- { 0x010f, "\x00\x64\x03\x0c\0" },
- { 0x0112, "\x00\x45\x03\x04\0" },
- { 0x0113, "\x00\x65\x03\x04\0" },
- { 0x0114, "\x00\x45\x03\x06\0" },
- { 0x0115, "\x00\x65\x03\x06\0" },
- { 0x0116, "\x00\x45\x03\x07\0" },
- { 0x0117, "\x00\x65\x03\x07\0" },
- { 0x0118, "\x00\x45\x03\x28\0" },
- { 0x0119, "\x00\x65\x03\x28\0" },
- { 0x011a, "\x00\x45\x03\x0c\0" },
- { 0x011b, "\x00\x65\x03\x0c\0" },
- { 0x011c, "\x00\x47\x03\x02\0" },
- { 0x011d, "\x00\x67\x03\x02\0" },
- { 0x011e, "\x00\x47\x03\x06\0" },
- { 0x011f, "\x00\x67\x03\x06\0" },
- { 0x0120, "\x00\x47\x03\x07\0" },
- { 0x0121, "\x00\x67\x03\x07\0" },
- { 0x0122, "\x00\x47\x03\x27\0" },
- { 0x0123, "\x00\x67\x03\x27\0" },
- { 0x0124, "\x00\x48\x03\x02\0" },
- { 0x0125, "\x00\x68\x03\x02\0" },
- { 0x0128, "\x00\x49\x03\x03\0" },
- { 0x0129, "\x00\x69\x03\x03\0" },
- { 0x012a, "\x00\x49\x03\x04\0" },
- { 0x012b, "\x00\x69\x03\x04\0" },
- { 0x012c, "\x00\x49\x03\x06\0" },
- { 0x012d, "\x00\x69\x03\x06\0" },
- { 0x012e, "\x00\x49\x03\x28\0" },
- { 0x012f, "\x00\x69\x03\x28\0" },
- { 0x0130, "\x00\x49\x03\x07\0" },
- { 0x0134, "\x00\x4a\x03\x02\0" },
- { 0x0135, "\x00\x6a\x03\x02\0" },
- { 0x0136, "\x00\x4b\x03\x27\0" },
- { 0x0137, "\x00\x6b\x03\x27\0" },
- { 0x0139, "\x00\x4c\x03\x01\0" },
- { 0x013a, "\x00\x6c\x03\x01\0" },
- { 0x013b, "\x00\x4c\x03\x27\0" },
- { 0x013c, "\x00\x6c\x03\x27\0" },
- { 0x013d, "\x00\x4c\x03\x0c\0" },
- { 0x013e, "\x00\x6c\x03\x0c\0" },
- { 0x0143, "\x00\x4e\x03\x01\0" },
- { 0x0144, "\x00\x6e\x03\x01\0" },
- { 0x0145, "\x00\x4e\x03\x27\0" },
- { 0x0146, "\x00\x6e\x03\x27\0" },
- { 0x0147, "\x00\x4e\x03\x0c\0" },
- { 0x0148, "\x00\x6e\x03\x0c\0" },
- { 0x014c, "\x00\x4f\x03\x04\0" },
- { 0x014d, "\x00\x6f\x03\x04\0" },
- { 0x014e, "\x00\x4f\x03\x06\0" },
- { 0x014f, "\x00\x6f\x03\x06\0" },
- { 0x0150, "\x00\x4f\x03\x0b\0" },
- { 0x0151, "\x00\x6f\x03\x0b\0" },
- { 0x0154, "\x00\x52\x03\x01\0" },
- { 0x0155, "\x00\x72\x03\x01\0" },
- { 0x0156, "\x00\x52\x03\x27\0" },
- { 0x0157, "\x00\x72\x03\x27\0" },
- { 0x0158, "\x00\x52\x03\x0c\0" },
- { 0x0159, "\x00\x72\x03\x0c\0" },
- { 0x015a, "\x00\x53\x03\x01\0" },
- { 0x015b, "\x00\x73\x03\x01\0" },
- { 0x015c, "\x00\x53\x03\x02\0" },
- { 0x015d, "\x00\x73\x03\x02\0" },
- { 0x015e, "\x00\x53\x03\x27\0" },
- { 0x015f, "\x00\x73\x03\x27\0" },
- { 0x0160, "\x00\x53\x03\x0c\0" },
- { 0x0161, "\x00\x73\x03\x0c\0" },
- { 0x0162, "\x00\x54\x03\x27\0" },
- { 0x0163, "\x00\x74\x03\x27\0" },
- { 0x0164, "\x00\x54\x03\x0c\0" },
- { 0x0165, "\x00\x74\x03\x0c\0" },
- { 0x0168, "\x00\x55\x03\x03\0" },
- { 0x0169, "\x00\x75\x03\x03\0" },
- { 0x016a, "\x00\x55\x03\x04\0" },
- { 0x016b, "\x00\x75\x03\x04\0" },
- { 0x016c, "\x00\x55\x03\x06\0" },
- { 0x016d, "\x00\x75\x03\x06\0" },
- { 0x016e, "\x00\x55\x03\x0a\0" },
- { 0x016f, "\x00\x75\x03\x0a\0" },
- { 0x0170, "\x00\x55\x03\x0b\0" },
- { 0x0171, "\x00\x75\x03\x0b\0" },
- { 0x0172, "\x00\x55\x03\x28\0" },
- { 0x0173, "\x00\x75\x03\x28\0" },
- { 0x0174, "\x00\x57\x03\x02\0" },
- { 0x0175, "\x00\x77\x03\x02\0" },
- { 0x0176, "\x00\x59\x03\x02\0" },
- { 0x0177, "\x00\x79\x03\x02\0" },
- { 0x0178, "\x00\x59\x03\x08\0" },
- { 0x0179, "\x00\x5a\x03\x01\0" },
- { 0x017a, "\x00\x7a\x03\x01\0" },
- { 0x017b, "\x00\x5a\x03\x07\0" },
- { 0x017c, "\x00\x7a\x03\x07\0" },
- { 0x017d, "\x00\x5a\x03\x0c\0" },
- { 0x017e, "\x00\x7a\x03\x0c\0" },
- { 0x01a0, "\x00\x4f\x03\x1b\0" },
- { 0x01a1, "\x00\x6f\x03\x1b\0" },
- { 0x01af, "\x00\x55\x03\x1b\0" },
- { 0x01b0, "\x00\x75\x03\x1b\0" },
- { 0x01cd, "\x00\x41\x03\x0c\0" },
- { 0x01ce, "\x00\x61\x03\x0c\0" },
- { 0x01cf, "\x00\x49\x03\x0c\0" },
- { 0x01d0, "\x00\x69\x03\x0c\0" },
- { 0x01d1, "\x00\x4f\x03\x0c\0" },
- { 0x01d2, "\x00\x6f\x03\x0c\0" },
- { 0x01d3, "\x00\x55\x03\x0c\0" },
- { 0x01d4, "\x00\x75\x03\x0c\0" },
- { 0x01d5, "\x00\x55\x03\x08\x03\x04\0" },
- { 0x01d6, "\x00\x75\x03\x08\x03\x04\0" },
- { 0x01d7, "\x00\x55\x03\x08\x03\x01\0" },
- { 0x01d8, "\x00\x75\x03\x08\x03\x01\0" },
- { 0x01d9, "\x00\x55\x03\x08\x03\x0c\0" },
- { 0x01da, "\x00\x75\x03\x08\x03\x0c\0" },
- { 0x01db, "\x00\x55\x03\x08\x03\x00\0" },
- { 0x01dc, "\x00\x75\x03\x08\x03\x00\0" },
- { 0x01de, "\x00\x41\x03\x08\x03\x04\0" },
- { 0x01df, "\x00\x61\x03\x08\x03\x04\0" },
- { 0x01e0, "\x00\x41\x03\x07\x03\x04\0" },
- { 0x01e1, "\x00\x61\x03\x07\x03\x04\0" },
- { 0x01e2, "\x00\xc6\x03\x04\0" },
- { 0x01e3, "\x00\xe6\x03\x04\0" },
- { 0x01e6, "\x00\x47\x03\x0c\0" },
- { 0x01e7, "\x00\x67\x03\x0c\0" },
- { 0x01e8, "\x00\x4b\x03\x0c\0" },
- { 0x01e9, "\x00\x6b\x03\x0c\0" },
- { 0x01ea, "\x00\x4f\x03\x28\0" },
- { 0x01eb, "\x00\x6f\x03\x28\0" },
- { 0x01ec, "\x00\x4f\x03\x28\x03\x04\0" },
- { 0x01ed, "\x00\x6f\x03\x28\x03\x04\0" },
- { 0x01ee, "\x01\xb7\x03\x0c\0" },
- { 0x01ef, "\x02\x92\x03\x0c\0" },
- { 0x01f0, "\x00\x6a\x03\x0c\0" },
- { 0x01f4, "\x00\x47\x03\x01\0" },
- { 0x01f5, "\x00\x67\x03\x01\0" },
- { 0x01fa, "\x00\x41\x03\x0a\x03\x01\0" },
- { 0x01fb, "\x00\x61\x03\x0a\x03\x01\0" },
- { 0x01fc, "\x00\xc6\x03\x01\0" },
- { 0x01fd, "\x00\xe6\x03\x01\0" },
- { 0x01fe, "\x00\xd8\x03\x01\0" },
- { 0x01ff, "\x00\xf8\x03\x01\0" },
- { 0x0200, "\x00\x41\x03\x0f\0" },
- { 0x0201, "\x00\x61\x03\x0f\0" },
- { 0x0202, "\x00\x41\x03\x11\0" },
- { 0x0203, "\x00\x61\x03\x11\0" },
- { 0x0204, "\x00\x45\x03\x0f\0" },
- { 0x0205, "\x00\x65\x03\x0f\0" },
- { 0x0206, "\x00\x45\x03\x11\0" },
- { 0x0207, "\x00\x65\x03\x11\0" },
- { 0x0208, "\x00\x49\x03\x0f\0" },
- { 0x0209, "\x00\x69\x03\x0f\0" },
- { 0x020a, "\x00\x49\x03\x11\0" },
- { 0x020b, "\x00\x69\x03\x11\0" },
- { 0x020c, "\x00\x4f\x03\x0f\0" },
- { 0x020d, "\x00\x6f\x03\x0f\0" },
- { 0x020e, "\x00\x4f\x03\x11\0" },
- { 0x020f, "\x00\x6f\x03\x11\0" },
- { 0x0210, "\x00\x52\x03\x0f\0" },
- { 0x0211, "\x00\x72\x03\x0f\0" },
- { 0x0212, "\x00\x52\x03\x11\0" },
- { 0x0213, "\x00\x72\x03\x11\0" },
- { 0x0214, "\x00\x55\x03\x0f\0" },
- { 0x0215, "\x00\x75\x03\x0f\0" },
- { 0x0216, "\x00\x55\x03\x11\0" },
- { 0x0217, "\x00\x75\x03\x11\0" },
- { 0x0340, "\x03\x00\0" },
- { 0x0341, "\x03\x01\0" },
- { 0x0343, "\x03\x13\0" },
- { 0x0344, "\x03\x08\x03\x01\0" },
- { 0x0374, "\x02\xb9\0" },
- { 0x037e, "\x00\x3b\0" },
- { 0x0385, "\x00\xa8\x03\x01\0" },
- { 0x0386, "\x03\x91\x03\x01\0" },
- { 0x0387, "\x00\xb7\0" },
- { 0x0388, "\x03\x95\x03\x01\0" },
- { 0x0389, "\x03\x97\x03\x01\0" },
- { 0x038a, "\x03\x99\x03\x01\0" },
- { 0x038c, "\x03\x9f\x03\x01\0" },
- { 0x038e, "\x03\xa5\x03\x01\0" },
- { 0x038f, "\x03\xa9\x03\x01\0" },
- { 0x0390, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x03aa, "\x03\x99\x03\x08\0" },
- { 0x03ab, "\x03\xa5\x03\x08\0" },
- { 0x03ac, "\x03\xb1\x03\x01\0" },
- { 0x03ad, "\x03\xb5\x03\x01\0" },
- { 0x03ae, "\x03\xb7\x03\x01\0" },
- { 0x03af, "\x03\xb9\x03\x01\0" },
- { 0x03b0, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x03ca, "\x03\xb9\x03\x08\0" },
- { 0x03cb, "\x03\xc5\x03\x08\0" },
- { 0x03cc, "\x03\xbf\x03\x01\0" },
- { 0x03cd, "\x03\xc5\x03\x01\0" },
- { 0x03ce, "\x03\xc9\x03\x01\0" },
- { 0x03d3, "\x03\xd2\x03\x01\0" },
- { 0x03d4, "\x03\xd2\x03\x08\0" },
- { 0x0401, "\x04\x15\x03\x08\0" },
- { 0x0403, "\x04\x13\x03\x01\0" },
- { 0x0407, "\x04\x06\x03\x08\0" },
- { 0x040c, "\x04\x1a\x03\x01\0" },
- { 0x040e, "\x04\x23\x03\x06\0" },
- { 0x0419, "\x04\x18\x03\x06\0" },
- { 0x0439, "\x04\x38\x03\x06\0" },
- { 0x0451, "\x04\x35\x03\x08\0" },
- { 0x0453, "\x04\x33\x03\x01\0" },
- { 0x0457, "\x04\x56\x03\x08\0" },
- { 0x045c, "\x04\x3a\x03\x01\0" },
- { 0x045e, "\x04\x43\x03\x06\0" },
- { 0x0476, "\x04\x74\x03\x0f\0" },
- { 0x0477, "\x04\x75\x03\x0f\0" },
- { 0x04c1, "\x04\x16\x03\x06\0" },
- { 0x04c2, "\x04\x36\x03\x06\0" },
- { 0x04d0, "\x04\x10\x03\x06\0" },
- { 0x04d1, "\x04\x30\x03\x06\0" },
- { 0x04d2, "\x04\x10\x03\x08\0" },
- { 0x04d3, "\x04\x30\x03\x08\0" },
- { 0x04d6, "\x04\x15\x03\x06\0" },
- { 0x04d7, "\x04\x35\x03\x06\0" },
- { 0x04da, "\x04\xd8\x03\x08\0" },
- { 0x04db, "\x04\xd9\x03\x08\0" },
- { 0x04dc, "\x04\x16\x03\x08\0" },
- { 0x04dd, "\x04\x36\x03\x08\0" },
- { 0x04de, "\x04\x17\x03\x08\0" },
- { 0x04df, "\x04\x37\x03\x08\0" },
- { 0x04e2, "\x04\x18\x03\x04\0" },
- { 0x04e3, "\x04\x38\x03\x04\0" },
- { 0x04e4, "\x04\x18\x03\x08\0" },
- { 0x04e5, "\x04\x38\x03\x08\0" },
- { 0x04e6, "\x04\x1e\x03\x08\0" },
- { 0x04e7, "\x04\x3e\x03\x08\0" },
- { 0x04ea, "\x04\xe8\x03\x08\0" },
- { 0x04eb, "\x04\xe9\x03\x08\0" },
- { 0x04ee, "\x04\x23\x03\x04\0" },
- { 0x04ef, "\x04\x43\x03\x04\0" },
- { 0x04f0, "\x04\x23\x03\x08\0" },
- { 0x04f1, "\x04\x43\x03\x08\0" },
- { 0x04f2, "\x04\x23\x03\x0b\0" },
- { 0x04f3, "\x04\x43\x03\x0b\0" },
- { 0x04f4, "\x04\x27\x03\x08\0" },
- { 0x04f5, "\x04\x47\x03\x08\0" },
- { 0x04f8, "\x04\x2b\x03\x08\0" },
- { 0x04f9, "\x04\x4b\x03\x08\0" },
- { 0x0929, "\x09\x28\x09\x3c\0" },
- { 0x0931, "\x09\x30\x09\x3c\0" },
- { 0x0934, "\x09\x33\x09\x3c\0" },
- { 0x0958, "\x09\x15\x09\x3c\0" },
- { 0x0959, "\x09\x16\x09\x3c\0" },
- { 0x095a, "\x09\x17\x09\x3c\0" },
- { 0x095b, "\x09\x1c\x09\x3c\0" },
- { 0x095c, "\x09\x21\x09\x3c\0" },
- { 0x095d, "\x09\x22\x09\x3c\0" },
- { 0x095e, "\x09\x2b\x09\x3c\0" },
- { 0x095f, "\x09\x2f\x09\x3c\0" },
- { 0x09b0, "\x09\xac\x09\xbc\0" },
- { 0x09cb, "\x09\xc7\x09\xbe\0" },
- { 0x09cc, "\x09\xc7\x09\xd7\0" },
- { 0x09dc, "\x09\xa1\x09\xbc\0" },
- { 0x09dd, "\x09\xa2\x09\xbc\0" },
- { 0x09df, "\x09\xaf\x09\xbc\0" },
- { 0x0a59, "\x0a\x16\x0a\x3c\0" },
- { 0x0a5a, "\x0a\x17\x0a\x3c\0" },
- { 0x0a5b, "\x0a\x1c\x0a\x3c\0" },
- { 0x0a5c, "\x0a\x21\x0a\x3c\0" },
- { 0x0a5e, "\x0a\x2b\x0a\x3c\0" },
- { 0x0b48, "\x0b\x47\x0b\x56\0" },
- { 0x0b4b, "\x0b\x47\x0b\x3e\0" },
- { 0x0b4c, "\x0b\x47\x0b\x57\0" },
- { 0x0b5c, "\x0b\x21\x0b\x3c\0" },
- { 0x0b5d, "\x0b\x22\x0b\x3c\0" },
- { 0x0b5f, "\x0b\x2f\x0b\x3c\0" },
- { 0x0b94, "\x0b\x92\x0b\xd7\0" },
- { 0x0bca, "\x0b\xc6\x0b\xbe\0" },
- { 0x0bcb, "\x0b\xc7\x0b\xbe\0" },
- { 0x0bcc, "\x0b\xc6\x0b\xd7\0" },
- { 0x0c48, "\x0c\x46\x0c\x56\0" },
- { 0x0cc0, "\x0c\xbf\x0c\xd5\0" },
- { 0x0cc7, "\x0c\xc6\x0c\xd5\0" },
- { 0x0cc8, "\x0c\xc6\x0c\xd6\0" },
- { 0x0cca, "\x0c\xc6\x0c\xc2\0" },
- { 0x0ccb, "\x0c\xc6\x0c\xc2\x0c\xd5\0" },
- { 0x0d4a, "\x0d\x46\x0d\x3e\0" },
- { 0x0d4b, "\x0d\x47\x0d\x3e\0" },
- { 0x0d4c, "\x0d\x46\x0d\x57\0" },
- { 0x0e33, "\x0e\x4d\x0e\x32\0" },
- { 0x0eb3, "\x0e\xcd\x0e\xb2\0" },
- { 0x0f43, "\x0f\x42\x0f\xb7\0" },
- { 0x0f4d, "\x0f\x4c\x0f\xb7\0" },
- { 0x0f52, "\x0f\x51\x0f\xb7\0" },
- { 0x0f57, "\x0f\x56\x0f\xb7\0" },
- { 0x0f5c, "\x0f\x5b\x0f\xb7\0" },
- { 0x0f69, "\x0f\x40\x0f\xb5\0" },
- { 0x0f73, "\x0f\x71\x0f\x72\0" },
- { 0x0f75, "\x0f\x71\x0f\x74\0" },
- { 0x0f76, "\x0f\xb2\x0f\x80\0" },
- { 0x0f78, "\x0f\xb3\x0f\x80\0" },
- { 0x0f81, "\x0f\x71\x0f\x80\0" },
- { 0x0f93, "\x0f\x92\x0f\xb7\0" },
- { 0x0f9d, "\x0f\x9c\x0f\xb7\0" },
- { 0x0fa2, "\x0f\xa1\x0f\xb7\0" },
- { 0x0fa7, "\x0f\xa6\x0f\xb7\0" },
- { 0x0fac, "\x0f\xab\x0f\xb7\0" },
- { 0x0fb9, "\x0f\x90\x0f\xb5\0" },
- { 0x1e00, "\x00\x41\x03\x25\0" },
- { 0x1e01, "\x00\x61\x03\x25\0" },
- { 0x1e02, "\x00\x42\x03\x07\0" },
- { 0x1e03, "\x00\x62\x03\x07\0" },
- { 0x1e04, "\x00\x42\x03\x23\0" },
- { 0x1e05, "\x00\x62\x03\x23\0" },
- { 0x1e06, "\x00\x42\x03\x31\0" },
- { 0x1e07, "\x00\x62\x03\x31\0" },
- { 0x1e08, "\x00\x43\x03\x27\x03\x01\0" },
- { 0x1e09, "\x00\x63\x03\x27\x03\x01\0" },
- { 0x1e0a, "\x00\x44\x03\x07\0" },
- { 0x1e0b, "\x00\x64\x03\x07\0" },
- { 0x1e0c, "\x00\x44\x03\x23\0" },
- { 0x1e0d, "\x00\x64\x03\x23\0" },
- { 0x1e0e, "\x00\x44\x03\x31\0" },
- { 0x1e0f, "\x00\x64\x03\x31\0" },
- { 0x1e10, "\x00\x44\x03\x27\0" },
- { 0x1e11, "\x00\x64\x03\x27\0" },
- { 0x1e12, "\x00\x44\x03\x2d\0" },
- { 0x1e13, "\x00\x64\x03\x2d\0" },
- { 0x1e14, "\x00\x45\x03\x04\x03\x00\0" },
- { 0x1e15, "\x00\x65\x03\x04\x03\x00\0" },
- { 0x1e16, "\x00\x45\x03\x04\x03\x01\0" },
- { 0x1e17, "\x00\x65\x03\x04\x03\x01\0" },
- { 0x1e18, "\x00\x45\x03\x2d\0" },
- { 0x1e19, "\x00\x65\x03\x2d\0" },
- { 0x1e1a, "\x00\x45\x03\x30\0" },
- { 0x1e1b, "\x00\x65\x03\x30\0" },
- { 0x1e1c, "\x00\x45\x03\x27\x03\x06\0" },
- { 0x1e1d, "\x00\x65\x03\x27\x03\x06\0" },
- { 0x1e1e, "\x00\x46\x03\x07\0" },
- { 0x1e1f, "\x00\x66\x03\x07\0" },
- { 0x1e20, "\x00\x47\x03\x04\0" },
- { 0x1e21, "\x00\x67\x03\x04\0" },
- { 0x1e22, "\x00\x48\x03\x07\0" },
- { 0x1e23, "\x00\x68\x03\x07\0" },
- { 0x1e24, "\x00\x48\x03\x23\0" },
- { 0x1e25, "\x00\x68\x03\x23\0" },
- { 0x1e26, "\x00\x48\x03\x08\0" },
- { 0x1e27, "\x00\x68\x03\x08\0" },
- { 0x1e28, "\x00\x48\x03\x27\0" },
- { 0x1e29, "\x00\x68\x03\x27\0" },
- { 0x1e2a, "\x00\x48\x03\x2e\0" },
- { 0x1e2b, "\x00\x68\x03\x2e\0" },
- { 0x1e2c, "\x00\x49\x03\x30\0" },
- { 0x1e2d, "\x00\x69\x03\x30\0" },
- { 0x1e2e, "\x00\x49\x03\x08\x03\x01\0" },
- { 0x1e2f, "\x00\x69\x03\x08\x03\x01\0" },
- { 0x1e30, "\x00\x4b\x03\x01\0" },
- { 0x1e31, "\x00\x6b\x03\x01\0" },
- { 0x1e32, "\x00\x4b\x03\x23\0" },
- { 0x1e33, "\x00\x6b\x03\x23\0" },
- { 0x1e34, "\x00\x4b\x03\x31\0" },
- { 0x1e35, "\x00\x6b\x03\x31\0" },
- { 0x1e36, "\x00\x4c\x03\x23\0" },
- { 0x1e37, "\x00\x6c\x03\x23\0" },
- { 0x1e38, "\x00\x4c\x03\x23\x03\x04\0" },
- { 0x1e39, "\x00\x6c\x03\x23\x03\x04\0" },
- { 0x1e3a, "\x00\x4c\x03\x31\0" },
- { 0x1e3b, "\x00\x6c\x03\x31\0" },
- { 0x1e3c, "\x00\x4c\x03\x2d\0" },
- { 0x1e3d, "\x00\x6c\x03\x2d\0" },
- { 0x1e3e, "\x00\x4d\x03\x01\0" },
- { 0x1e3f, "\x00\x6d\x03\x01\0" },
- { 0x1e40, "\x00\x4d\x03\x07\0" },
- { 0x1e41, "\x00\x6d\x03\x07\0" },
- { 0x1e42, "\x00\x4d\x03\x23\0" },
- { 0x1e43, "\x00\x6d\x03\x23\0" },
- { 0x1e44, "\x00\x4e\x03\x07\0" },
- { 0x1e45, "\x00\x6e\x03\x07\0" },
- { 0x1e46, "\x00\x4e\x03\x23\0" },
- { 0x1e47, "\x00\x6e\x03\x23\0" },
- { 0x1e48, "\x00\x4e\x03\x31\0" },
- { 0x1e49, "\x00\x6e\x03\x31\0" },
- { 0x1e4a, "\x00\x4e\x03\x2d\0" },
- { 0x1e4b, "\x00\x6e\x03\x2d\0" },
- { 0x1e4c, "\x00\x4f\x03\x03\x03\x01\0" },
- { 0x1e4d, "\x00\x6f\x03\x03\x03\x01\0" },
- { 0x1e4e, "\x00\x4f\x03\x03\x03\x08\0" },
- { 0x1e4f, "\x00\x6f\x03\x03\x03\x08\0" },
- { 0x1e50, "\x00\x4f\x03\x04\x03\x00\0" },
- { 0x1e51, "\x00\x6f\x03\x04\x03\x00\0" },
- { 0x1e52, "\x00\x4f\x03\x04\x03\x01\0" },
- { 0x1e53, "\x00\x6f\x03\x04\x03\x01\0" },
- { 0x1e54, "\x00\x50\x03\x01\0" },
- { 0x1e55, "\x00\x70\x03\x01\0" },
- { 0x1e56, "\x00\x50\x03\x07\0" },
- { 0x1e57, "\x00\x70\x03\x07\0" },
- { 0x1e58, "\x00\x52\x03\x07\0" },
- { 0x1e59, "\x00\x72\x03\x07\0" },
- { 0x1e5a, "\x00\x52\x03\x23\0" },
- { 0x1e5b, "\x00\x72\x03\x23\0" },
- { 0x1e5c, "\x00\x52\x03\x23\x03\x04\0" },
- { 0x1e5d, "\x00\x72\x03\x23\x03\x04\0" },
- { 0x1e5e, "\x00\x52\x03\x31\0" },
- { 0x1e5f, "\x00\x72\x03\x31\0" },
- { 0x1e60, "\x00\x53\x03\x07\0" },
- { 0x1e61, "\x00\x73\x03\x07\0" },
- { 0x1e62, "\x00\x53\x03\x23\0" },
- { 0x1e63, "\x00\x73\x03\x23\0" },
- { 0x1e64, "\x00\x53\x03\x01\x03\x07\0" },
- { 0x1e65, "\x00\x73\x03\x01\x03\x07\0" },
- { 0x1e66, "\x00\x53\x03\x0c\x03\x07\0" },
- { 0x1e67, "\x00\x73\x03\x0c\x03\x07\0" },
- { 0x1e68, "\x00\x53\x03\x23\x03\x07\0" },
- { 0x1e69, "\x00\x73\x03\x23\x03\x07\0" },
- { 0x1e6a, "\x00\x54\x03\x07\0" },
- { 0x1e6b, "\x00\x74\x03\x07\0" },
- { 0x1e6c, "\x00\x54\x03\x23\0" },
- { 0x1e6d, "\x00\x74\x03\x23\0" },
- { 0x1e6e, "\x00\x54\x03\x31\0" },
- { 0x1e6f, "\x00\x74\x03\x31\0" },
- { 0x1e70, "\x00\x54\x03\x2d\0" },
- { 0x1e71, "\x00\x74\x03\x2d\0" },
- { 0x1e72, "\x00\x55\x03\x24\0" },
- { 0x1e73, "\x00\x75\x03\x24\0" },
- { 0x1e74, "\x00\x55\x03\x30\0" },
- { 0x1e75, "\x00\x75\x03\x30\0" },
- { 0x1e76, "\x00\x55\x03\x2d\0" },
- { 0x1e77, "\x00\x75\x03\x2d\0" },
- { 0x1e78, "\x00\x55\x03\x03\x03\x01\0" },
- { 0x1e79, "\x00\x75\x03\x03\x03\x01\0" },
- { 0x1e7a, "\x00\x55\x03\x04\x03\x08\0" },
- { 0x1e7b, "\x00\x75\x03\x04\x03\x08\0" },
- { 0x1e7c, "\x00\x56\x03\x03\0" },
- { 0x1e7d, "\x00\x76\x03\x03\0" },
- { 0x1e7e, "\x00\x56\x03\x23\0" },
- { 0x1e7f, "\x00\x76\x03\x23\0" },
- { 0x1e80, "\x00\x57\x03\x00\0" },
- { 0x1e81, "\x00\x77\x03\x00\0" },
- { 0x1e82, "\x00\x57\x03\x01\0" },
- { 0x1e83, "\x00\x77\x03\x01\0" },
- { 0x1e84, "\x00\x57\x03\x08\0" },
- { 0x1e85, "\x00\x77\x03\x08\0" },
- { 0x1e86, "\x00\x57\x03\x07\0" },
- { 0x1e87, "\x00\x77\x03\x07\0" },
- { 0x1e88, "\x00\x57\x03\x23\0" },
- { 0x1e89, "\x00\x77\x03\x23\0" },
- { 0x1e8a, "\x00\x58\x03\x07\0" },
- { 0x1e8b, "\x00\x78\x03\x07\0" },
- { 0x1e8c, "\x00\x58\x03\x08\0" },
- { 0x1e8d, "\x00\x78\x03\x08\0" },
- { 0x1e8e, "\x00\x59\x03\x07\0" },
- { 0x1e8f, "\x00\x79\x03\x07\0" },
- { 0x1e90, "\x00\x5a\x03\x02\0" },
- { 0x1e91, "\x00\x7a\x03\x02\0" },
- { 0x1e92, "\x00\x5a\x03\x23\0" },
- { 0x1e93, "\x00\x7a\x03\x23\0" },
- { 0x1e94, "\x00\x5a\x03\x31\0" },
- { 0x1e95, "\x00\x7a\x03\x31\0" },
- { 0x1e96, "\x00\x68\x03\x31\0" },
- { 0x1e97, "\x00\x74\x03\x08\0" },
- { 0x1e98, "\x00\x77\x03\x0a\0" },
- { 0x1e99, "\x00\x79\x03\x0a\0" },
- { 0x1e9b, "\x01\x7f\x03\x07\0" },
- { 0x1ea0, "\x00\x41\x03\x23\0" },
- { 0x1ea1, "\x00\x61\x03\x23\0" },
- { 0x1ea2, "\x00\x41\x03\x09\0" },
- { 0x1ea3, "\x00\x61\x03\x09\0" },
- { 0x1ea4, "\x00\x41\x03\x02\x03\x01\0" },
- { 0x1ea5, "\x00\x61\x03\x02\x03\x01\0" },
- { 0x1ea6, "\x00\x41\x03\x02\x03\x00\0" },
- { 0x1ea7, "\x00\x61\x03\x02\x03\x00\0" },
- { 0x1ea8, "\x00\x41\x03\x02\x03\x09\0" },
- { 0x1ea9, "\x00\x61\x03\x02\x03\x09\0" },
- { 0x1eaa, "\x00\x41\x03\x02\x03\x03\0" },
- { 0x1eab, "\x00\x61\x03\x02\x03\x03\0" },
- { 0x1eac, "\x00\x41\x03\x23\x03\x02\0" },
- { 0x1ead, "\x00\x61\x03\x23\x03\x02\0" },
- { 0x1eae, "\x00\x41\x03\x06\x03\x01\0" },
- { 0x1eaf, "\x00\x61\x03\x06\x03\x01\0" },
- { 0x1eb0, "\x00\x41\x03\x06\x03\x00\0" },
- { 0x1eb1, "\x00\x61\x03\x06\x03\x00\0" },
- { 0x1eb2, "\x00\x41\x03\x06\x03\x09\0" },
- { 0x1eb3, "\x00\x61\x03\x06\x03\x09\0" },
- { 0x1eb4, "\x00\x41\x03\x06\x03\x03\0" },
- { 0x1eb5, "\x00\x61\x03\x06\x03\x03\0" },
- { 0x1eb6, "\x00\x41\x03\x23\x03\x06\0" },
- { 0x1eb7, "\x00\x61\x03\x23\x03\x06\0" },
- { 0x1eb8, "\x00\x45\x03\x23\0" },
- { 0x1eb9, "\x00\x65\x03\x23\0" },
- { 0x1eba, "\x00\x45\x03\x09\0" },
- { 0x1ebb, "\x00\x65\x03\x09\0" },
- { 0x1ebc, "\x00\x45\x03\x03\0" },
- { 0x1ebd, "\x00\x65\x03\x03\0" },
- { 0x1ebe, "\x00\x45\x03\x02\x03\x01\0" },
- { 0x1ebf, "\x00\x65\x03\x02\x03\x01\0" },
- { 0x1ec0, "\x00\x45\x03\x02\x03\x00\0" },
- { 0x1ec1, "\x00\x65\x03\x02\x03\x00\0" },
- { 0x1ec2, "\x00\x45\x03\x02\x03\x09\0" },
- { 0x1ec3, "\x00\x65\x03\x02\x03\x09\0" },
- { 0x1ec4, "\x00\x45\x03\x02\x03\x03\0" },
- { 0x1ec5, "\x00\x65\x03\x02\x03\x03\0" },
- { 0x1ec6, "\x00\x45\x03\x23\x03\x02\0" },
- { 0x1ec7, "\x00\x65\x03\x23\x03\x02\0" },
- { 0x1ec8, "\x00\x49\x03\x09\0" },
- { 0x1ec9, "\x00\x69\x03\x09\0" },
- { 0x1eca, "\x00\x49\x03\x23\0" },
- { 0x1ecb, "\x00\x69\x03\x23\0" },
- { 0x1ecc, "\x00\x4f\x03\x23\0" },
- { 0x1ecd, "\x00\x6f\x03\x23\0" },
- { 0x1ece, "\x00\x4f\x03\x09\0" },
- { 0x1ecf, "\x00\x6f\x03\x09\0" },
- { 0x1ed0, "\x00\x4f\x03\x02\x03\x01\0" },
- { 0x1ed1, "\x00\x6f\x03\x02\x03\x01\0" },
- { 0x1ed2, "\x00\x4f\x03\x02\x03\x00\0" },
- { 0x1ed3, "\x00\x6f\x03\x02\x03\x00\0" },
- { 0x1ed4, "\x00\x4f\x03\x02\x03\x09\0" },
- { 0x1ed5, "\x00\x6f\x03\x02\x03\x09\0" },
- { 0x1ed6, "\x00\x4f\x03\x02\x03\x03\0" },
- { 0x1ed7, "\x00\x6f\x03\x02\x03\x03\0" },
- { 0x1ed8, "\x00\x4f\x03\x23\x03\x02\0" },
- { 0x1ed9, "\x00\x6f\x03\x23\x03\x02\0" },
- { 0x1eda, "\x00\x4f\x03\x1b\x03\x01\0" },
- { 0x1edb, "\x00\x6f\x03\x1b\x03\x01\0" },
- { 0x1edc, "\x00\x4f\x03\x1b\x03\x00\0" },
- { 0x1edd, "\x00\x6f\x03\x1b\x03\x00\0" },
- { 0x1ede, "\x00\x4f\x03\x1b\x03\x09\0" },
- { 0x1edf, "\x00\x6f\x03\x1b\x03\x09\0" },
- { 0x1ee0, "\x00\x4f\x03\x1b\x03\x03\0" },
- { 0x1ee1, "\x00\x6f\x03\x1b\x03\x03\0" },
- { 0x1ee2, "\x00\x4f\x03\x1b\x03\x23\0" },
- { 0x1ee3, "\x00\x6f\x03\x1b\x03\x23\0" },
- { 0x1ee4, "\x00\x55\x03\x23\0" },
- { 0x1ee5, "\x00\x75\x03\x23\0" },
- { 0x1ee6, "\x00\x55\x03\x09\0" },
- { 0x1ee7, "\x00\x75\x03\x09\0" },
- { 0x1ee8, "\x00\x55\x03\x1b\x03\x01\0" },
- { 0x1ee9, "\x00\x75\x03\x1b\x03\x01\0" },
- { 0x1eea, "\x00\x55\x03\x1b\x03\x00\0" },
- { 0x1eeb, "\x00\x75\x03\x1b\x03\x00\0" },
- { 0x1eec, "\x00\x55\x03\x1b\x03\x09\0" },
- { 0x1eed, "\x00\x75\x03\x1b\x03\x09\0" },
- { 0x1eee, "\x00\x55\x03\x1b\x03\x03\0" },
- { 0x1eef, "\x00\x75\x03\x1b\x03\x03\0" },
- { 0x1ef0, "\x00\x55\x03\x1b\x03\x23\0" },
- { 0x1ef1, "\x00\x75\x03\x1b\x03\x23\0" },
- { 0x1ef2, "\x00\x59\x03\x00\0" },
- { 0x1ef3, "\x00\x79\x03\x00\0" },
- { 0x1ef4, "\x00\x59\x03\x23\0" },
- { 0x1ef5, "\x00\x79\x03\x23\0" },
- { 0x1ef6, "\x00\x59\x03\x09\0" },
- { 0x1ef7, "\x00\x79\x03\x09\0" },
- { 0x1ef8, "\x00\x59\x03\x03\0" },
- { 0x1ef9, "\x00\x79\x03\x03\0" },
- { 0x1f00, "\x03\xb1\x03\x13\0" },
- { 0x1f01, "\x03\xb1\x03\x14\0" },
- { 0x1f02, "\x03\xb1\x03\x13\x03\x00\0" },
- { 0x1f03, "\x03\xb1\x03\x14\x03\x00\0" },
- { 0x1f04, "\x03\xb1\x03\x13\x03\x01\0" },
- { 0x1f05, "\x03\xb1\x03\x14\x03\x01\0" },
- { 0x1f06, "\x03\xb1\x03\x13\x03\x42\0" },
- { 0x1f07, "\x03\xb1\x03\x14\x03\x42\0" },
- { 0x1f08, "\x03\x91\x03\x13\0" },
- { 0x1f09, "\x03\x91\x03\x14\0" },
- { 0x1f0a, "\x03\x91\x03\x13\x03\x00\0" },
- { 0x1f0b, "\x03\x91\x03\x14\x03\x00\0" },
- { 0x1f0c, "\x03\x91\x03\x13\x03\x01\0" },
- { 0x1f0d, "\x03\x91\x03\x14\x03\x01\0" },
- { 0x1f0e, "\x03\x91\x03\x13\x03\x42\0" },
- { 0x1f0f, "\x03\x91\x03\x14\x03\x42\0" },
- { 0x1f10, "\x03\xb5\x03\x13\0" },
- { 0x1f11, "\x03\xb5\x03\x14\0" },
- { 0x1f12, "\x03\xb5\x03\x13\x03\x00\0" },
- { 0x1f13, "\x03\xb5\x03\x14\x03\x00\0" },
- { 0x1f14, "\x03\xb5\x03\x13\x03\x01\0" },
- { 0x1f15, "\x03\xb5\x03\x14\x03\x01\0" },
- { 0x1f18, "\x03\x95\x03\x13\0" },
- { 0x1f19, "\x03\x95\x03\x14\0" },
- { 0x1f1a, "\x03\x95\x03\x13\x03\x00\0" },
- { 0x1f1b, "\x03\x95\x03\x14\x03\x00\0" },
- { 0x1f1c, "\x03\x95\x03\x13\x03\x01\0" },
- { 0x1f1d, "\x03\x95\x03\x14\x03\x01\0" },
- { 0x1f20, "\x03\xb7\x03\x13\0" },
- { 0x1f21, "\x03\xb7\x03\x14\0" },
- { 0x1f22, "\x03\xb7\x03\x13\x03\x00\0" },
- { 0x1f23, "\x03\xb7\x03\x14\x03\x00\0" },
- { 0x1f24, "\x03\xb7\x03\x13\x03\x01\0" },
- { 0x1f25, "\x03\xb7\x03\x14\x03\x01\0" },
- { 0x1f26, "\x03\xb7\x03\x13\x03\x42\0" },
- { 0x1f27, "\x03\xb7\x03\x14\x03\x42\0" },
- { 0x1f28, "\x03\x97\x03\x13\0" },
- { 0x1f29, "\x03\x97\x03\x14\0" },
- { 0x1f2a, "\x03\x97\x03\x13\x03\x00\0" },
- { 0x1f2b, "\x03\x97\x03\x14\x03\x00\0" },
- { 0x1f2c, "\x03\x97\x03\x13\x03\x01\0" },
- { 0x1f2d, "\x03\x97\x03\x14\x03\x01\0" },
- { 0x1f2e, "\x03\x97\x03\x13\x03\x42\0" },
- { 0x1f2f, "\x03\x97\x03\x14\x03\x42\0" },
- { 0x1f30, "\x03\xb9\x03\x13\0" },
- { 0x1f31, "\x03\xb9\x03\x14\0" },
- { 0x1f32, "\x03\xb9\x03\x13\x03\x00\0" },
- { 0x1f33, "\x03\xb9\x03\x14\x03\x00\0" },
- { 0x1f34, "\x03\xb9\x03\x13\x03\x01\0" },
- { 0x1f35, "\x03\xb9\x03\x14\x03\x01\0" },
- { 0x1f36, "\x03\xb9\x03\x13\x03\x42\0" },
- { 0x1f37, "\x03\xb9\x03\x14\x03\x42\0" },
- { 0x1f38, "\x03\x99\x03\x13\0" },
- { 0x1f39, "\x03\x99\x03\x14\0" },
- { 0x1f3a, "\x03\x99\x03\x13\x03\x00\0" },
- { 0x1f3b, "\x03\x99\x03\x14\x03\x00\0" },
- { 0x1f3c, "\x03\x99\x03\x13\x03\x01\0" },
- { 0x1f3d, "\x03\x99\x03\x14\x03\x01\0" },
- { 0x1f3e, "\x03\x99\x03\x13\x03\x42\0" },
- { 0x1f3f, "\x03\x99\x03\x14\x03\x42\0" },
- { 0x1f40, "\x03\xbf\x03\x13\0" },
- { 0x1f41, "\x03\xbf\x03\x14\0" },
- { 0x1f42, "\x03\xbf\x03\x13\x03\x00\0" },
- { 0x1f43, "\x03\xbf\x03\x14\x03\x00\0" },
- { 0x1f44, "\x03\xbf\x03\x13\x03\x01\0" },
- { 0x1f45, "\x03\xbf\x03\x14\x03\x01\0" },
- { 0x1f48, "\x03\x9f\x03\x13\0" },
- { 0x1f49, "\x03\x9f\x03\x14\0" },
- { 0x1f4a, "\x03\x9f\x03\x13\x03\x00\0" },
- { 0x1f4b, "\x03\x9f\x03\x14\x03\x00\0" },
- { 0x1f4c, "\x03\x9f\x03\x13\x03\x01\0" },
- { 0x1f4d, "\x03\x9f\x03\x14\x03\x01\0" },
- { 0x1f50, "\x03\xc5\x03\x13\0" },
- { 0x1f51, "\x03\xc5\x03\x14\0" },
- { 0x1f52, "\x03\xc5\x03\x13\x03\x00\0" },
- { 0x1f53, "\x03\xc5\x03\x14\x03\x00\0" },
- { 0x1f54, "\x03\xc5\x03\x13\x03\x01\0" },
- { 0x1f55, "\x03\xc5\x03\x14\x03\x01\0" },
- { 0x1f56, "\x03\xc5\x03\x13\x03\x42\0" },
- { 0x1f57, "\x03\xc5\x03\x14\x03\x42\0" },
- { 0x1f59, "\x03\xa5\x03\x14\0" },
- { 0x1f5b, "\x03\xa5\x03\x14\x03\x00\0" },
- { 0x1f5d, "\x03\xa5\x03\x14\x03\x01\0" },
- { 0x1f5f, "\x03\xa5\x03\x14\x03\x42\0" },
- { 0x1f60, "\x03\xc9\x03\x13\0" },
- { 0x1f61, "\x03\xc9\x03\x14\0" },
- { 0x1f62, "\x03\xc9\x03\x13\x03\x00\0" },
- { 0x1f63, "\x03\xc9\x03\x14\x03\x00\0" },
- { 0x1f64, "\x03\xc9\x03\x13\x03\x01\0" },
- { 0x1f65, "\x03\xc9\x03\x14\x03\x01\0" },
- { 0x1f66, "\x03\xc9\x03\x13\x03\x42\0" },
- { 0x1f67, "\x03\xc9\x03\x14\x03\x42\0" },
- { 0x1f68, "\x03\xa9\x03\x13\0" },
- { 0x1f69, "\x03\xa9\x03\x14\0" },
- { 0x1f6a, "\x03\xa9\x03\x13\x03\x00\0" },
- { 0x1f6b, "\x03\xa9\x03\x14\x03\x00\0" },
- { 0x1f6c, "\x03\xa9\x03\x13\x03\x01\0" },
- { 0x1f6d, "\x03\xa9\x03\x14\x03\x01\0" },
- { 0x1f6e, "\x03\xa9\x03\x13\x03\x42\0" },
- { 0x1f6f, "\x03\xa9\x03\x14\x03\x42\0" },
- { 0x1f70, "\x03\xb1\x03\x00\0" },
- { 0x1f71, "\x03\xb1\x03\x01\0" },
- { 0x1f72, "\x03\xb5\x03\x00\0" },
- { 0x1f73, "\x03\xb5\x03\x01\0" },
- { 0x1f74, "\x03\xb7\x03\x00\0" },
- { 0x1f75, "\x03\xb7\x03\x01\0" },
- { 0x1f76, "\x03\xb9\x03\x00\0" },
- { 0x1f77, "\x03\xb9\x03\x01\0" },
- { 0x1f78, "\x03\xbf\x03\x00\0" },
- { 0x1f79, "\x03\xbf\x03\x01\0" },
- { 0x1f7a, "\x03\xc5\x03\x00\0" },
- { 0x1f7b, "\x03\xc5\x03\x01\0" },
- { 0x1f7c, "\x03\xc9\x03\x00\0" },
- { 0x1f7d, "\x03\xc9\x03\x01\0" },
- { 0x1f80, "\x03\xb1\x03\x13\x03\x45\0" },
- { 0x1f81, "\x03\xb1\x03\x14\x03\x45\0" },
- { 0x1f82, "\x03\xb1\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f83, "\x03\xb1\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f84, "\x03\xb1\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f85, "\x03\xb1\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f86, "\x03\xb1\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f87, "\x03\xb1\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f88, "\x03\x91\x03\x13\x03\x45\0" },
- { 0x1f89, "\x03\x91\x03\x14\x03\x45\0" },
- { 0x1f8a, "\x03\x91\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f8b, "\x03\x91\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f8c, "\x03\x91\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f8d, "\x03\x91\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f8e, "\x03\x91\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f8f, "\x03\x91\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f90, "\x03\xb7\x03\x13\x03\x45\0" },
- { 0x1f91, "\x03\xb7\x03\x14\x03\x45\0" },
- { 0x1f92, "\x03\xb7\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f93, "\x03\xb7\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f94, "\x03\xb7\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f95, "\x03\xb7\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f96, "\x03\xb7\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f97, "\x03\xb7\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f98, "\x03\x97\x03\x13\x03\x45\0" },
- { 0x1f99, "\x03\x97\x03\x14\x03\x45\0" },
- { 0x1f9a, "\x03\x97\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f9b, "\x03\x97\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f9c, "\x03\x97\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f9d, "\x03\x97\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f9e, "\x03\x97\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f9f, "\x03\x97\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa0, "\x03\xc9\x03\x13\x03\x45\0" },
- { 0x1fa1, "\x03\xc9\x03\x14\x03\x45\0" },
- { 0x1fa2, "\x03\xc9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fa3, "\x03\xc9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fa4, "\x03\xc9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fa5, "\x03\xc9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fa6, "\x03\xc9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1fa7, "\x03\xc9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa8, "\x03\xa9\x03\x13\x03\x45\0" },
- { 0x1fa9, "\x03\xa9\x03\x14\x03\x45\0" },
- { 0x1faa, "\x03\xa9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fab, "\x03\xa9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fac, "\x03\xa9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fad, "\x03\xa9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fae, "\x03\xa9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1faf, "\x03\xa9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fb0, "\x03\xb1\x03\x06\0" },
- { 0x1fb1, "\x03\xb1\x03\x04\0" },
- { 0x1fb2, "\x03\xb1\x03\x00\x03\x45\0" },
- { 0x1fb3, "\x03\xb1\x03\x45\0" },
- { 0x1fb4, "\x03\xb1\x03\x01\x03\x45\0" },
- { 0x1fb6, "\x03\xb1\x03\x42\0" },
- { 0x1fb7, "\x03\xb1\x03\x42\x03\x45\0" },
- { 0x1fb8, "\x03\x91\x03\x06\0" },
- { 0x1fb9, "\x03\x91\x03\x04\0" },
- { 0x1fba, "\x03\x91\x03\x00\0" },
- { 0x1fbb, "\x03\x91\x03\x01\0" },
- { 0x1fbc, "\x03\x91\x03\x45\0" },
- { 0x1fbe, "\x03\xb9\0" },
- { 0x1fc1, "\x00\xa8\x03\x42\0" },
- { 0x1fc2, "\x03\xb7\x03\x00\x03\x45\0" },
- { 0x1fc3, "\x03\xb7\x03\x45\0" },
- { 0x1fc4, "\x03\xb7\x03\x01\x03\x45\0" },
- { 0x1fc6, "\x03\xb7\x03\x42\0" },
- { 0x1fc7, "\x03\xb7\x03\x42\x03\x45\0" },
- { 0x1fc8, "\x03\x95\x03\x00\0" },
- { 0x1fc9, "\x03\x95\x03\x01\0" },
- { 0x1fca, "\x03\x97\x03\x00\0" },
- { 0x1fcb, "\x03\x97\x03\x01\0" },
- { 0x1fcc, "\x03\x97\x03\x45\0" },
- { 0x1fcd, "\x1f\xbf\x03\x00\0" },
- { 0x1fce, "\x1f\xbf\x03\x01\0" },
- { 0x1fcf, "\x1f\xbf\x03\x42\0" },
- { 0x1fd0, "\x03\xb9\x03\x06\0" },
- { 0x1fd1, "\x03\xb9\x03\x04\0" },
- { 0x1fd2, "\x03\xb9\x03\x08\x03\x00\0" },
- { 0x1fd3, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x1fd6, "\x03\xb9\x03\x42\0" },
- { 0x1fd7, "\x03\xb9\x03\x08\x03\x42\0" },
- { 0x1fd8, "\x03\x99\x03\x06\0" },
- { 0x1fd9, "\x03\x99\x03\x04\0" },
- { 0x1fda, "\x03\x99\x03\x00\0" },
- { 0x1fdb, "\x03\x99\x03\x01\0" },
- { 0x1fdd, "\x1f\xfe\x03\x00\0" },
- { 0x1fde, "\x1f\xfe\x03\x01\0" },
- { 0x1fdf, "\x1f\xfe\x03\x42\0" },
- { 0x1fe0, "\x03\xc5\x03\x06\0" },
- { 0x1fe1, "\x03\xc5\x03\x04\0" },
- { 0x1fe2, "\x03\xc5\x03\x08\x03\x00\0" },
- { 0x1fe3, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x1fe4, "\x03\xc1\x03\x13\0" },
- { 0x1fe5, "\x03\xc1\x03\x14\0" },
- { 0x1fe6, "\x03\xc5\x03\x42\0" },
- { 0x1fe7, "\x03\xc5\x03\x08\x03\x42\0" },
- { 0x1fe8, "\x03\xa5\x03\x06\0" },
- { 0x1fe9, "\x03\xa5\x03\x04\0" },
- { 0x1fea, "\x03\xa5\x03\x00\0" },
- { 0x1feb, "\x03\xa5\x03\x01\0" },
- { 0x1fec, "\x03\xa1\x03\x14\0" },
- { 0x1fed, "\x00\xa8\x03\x00\0" },
- { 0x1fee, "\x00\xa8\x03\x01\0" },
- { 0x1fef, "\x00\x60\0" },
- { 0x1ff2, "\x03\xc9\x03\x00\x03\x45\0" },
- { 0x1ff3, "\x03\xc9\x03\x45\0" },
- { 0x1ff4, "\x03\xc9\x03\x01\x03\x45\0" },
- { 0x1ff6, "\x03\xc9\x03\x42\0" },
- { 0x1ff7, "\x03\xc9\x03\x42\x03\x45\0" },
- { 0x1ff8, "\x03\x9f\x03\x00\0" },
- { 0x1ff9, "\x03\x9f\x03\x01\0" },
- { 0x1ffa, "\x03\xa9\x03\x00\0" },
- { 0x1ffb, "\x03\xa9\x03\x01\0" },
- { 0x1ffc, "\x03\xa9\x03\x45\0" },
- { 0x1ffd, "\x00\xb4\0" },
- { 0x2000, "\x20\x02\0" },
- { 0x2001, "\x20\x03\0" },
- { 0x2126, "\x03\xa9\0" },
- { 0x212a, "\x00\x4b\0" },
- { 0x212b, "\x00\x41\x03\x0a\0" },
- { 0x2204, "\x22\x03\x03\x38\0" },
- { 0x2209, "\x22\x08\x03\x38\0" },
- { 0x220c, "\x22\x0b\x03\x38\0" },
- { 0x2224, "\x22\x23\x03\x38\0" },
- { 0x2226, "\x22\x25\x03\x38\0" },
- { 0x2241, "\x00\x7e\x03\x38\0" },
- { 0x2244, "\x22\x43\x03\x38\0" },
- { 0x2247, "\x22\x45\x03\x38\0" },
- { 0x2249, "\x22\x48\x03\x38\0" },
- { 0x2260, "\x00\x3d\x03\x38\0" },
- { 0x2262, "\x22\x61\x03\x38\0" },
- { 0x226d, "\x22\x4d\x03\x38\0" },
- { 0x226e, "\x00\x3c\x03\x38\0" },
- { 0x226f, "\x00\x3e\x03\x38\0" },
- { 0x2270, "\x22\x64\x03\x38\0" },
- { 0x2271, "\x22\x65\x03\x38\0" },
- { 0x2274, "\x22\x72\x03\x38\0" },
- { 0x2275, "\x22\x73\x03\x38\0" },
- { 0x2278, "\x22\x76\x03\x38\0" },
- { 0x2279, "\x22\x77\x03\x38\0" },
- { 0x2280, "\x22\x7a\x03\x38\0" },
- { 0x2281, "\x22\x7b\x03\x38\0" },
- { 0x2284, "\x22\x82\x03\x38\0" },
- { 0x2285, "\x22\x83\x03\x38\0" },
- { 0x2288, "\x22\x86\x03\x38\0" },
- { 0x2289, "\x22\x87\x03\x38\0" },
- { 0x22ac, "\x22\xa2\x03\x38\0" },
- { 0x22ad, "\x22\xa8\x03\x38\0" },
- { 0x22ae, "\x22\xa9\x03\x38\0" },
- { 0x22af, "\x22\xab\x03\x38\0" },
- { 0x22e0, "\x22\x7c\x03\x38\0" },
- { 0x22e1, "\x22\x7d\x03\x38\0" },
- { 0x22e2, "\x22\x91\x03\x38\0" },
- { 0x22e3, "\x22\x92\x03\x38\0" },
- { 0x22ea, "\x22\xb2\x03\x38\0" },
- { 0x22eb, "\x22\xb3\x03\x38\0" },
- { 0x22ec, "\x22\xb4\x03\x38\0" },
- { 0x22ed, "\x22\xb5\x03\x38\0" },
- { 0x2329, "\x30\x08\0" },
- { 0x232a, "\x30\x09\0" },
- { 0x304c, "\x30\x4b\x30\x99\0" },
- { 0x304e, "\x30\x4d\x30\x99\0" },
- { 0x3050, "\x30\x4f\x30\x99\0" },
- { 0x3052, "\x30\x51\x30\x99\0" },
- { 0x3054, "\x30\x53\x30\x99\0" },
- { 0x3056, "\x30\x55\x30\x99\0" },
- { 0x3058, "\x30\x57\x30\x99\0" },
- { 0x305a, "\x30\x59\x30\x99\0" },
- { 0x305c, "\x30\x5b\x30\x99\0" },
- { 0x305e, "\x30\x5d\x30\x99\0" },
- { 0x3060, "\x30\x5f\x30\x99\0" },
- { 0x3062, "\x30\x61\x30\x99\0" },
- { 0x3065, "\x30\x64\x30\x99\0" },
- { 0x3067, "\x30\x66\x30\x99\0" },
- { 0x3069, "\x30\x68\x30\x99\0" },
- { 0x3070, "\x30\x6f\x30\x99\0" },
- { 0x3071, "\x30\x6f\x30\x9a\0" },
- { 0x3073, "\x30\x72\x30\x99\0" },
- { 0x3074, "\x30\x72\x30\x9a\0" },
- { 0x3076, "\x30\x75\x30\x99\0" },
- { 0x3077, "\x30\x75\x30\x9a\0" },
- { 0x3079, "\x30\x78\x30\x99\0" },
- { 0x307a, "\x30\x78\x30\x9a\0" },
- { 0x307c, "\x30\x7b\x30\x99\0" },
- { 0x307d, "\x30\x7b\x30\x9a\0" },
- { 0x3094, "\x30\x46\x30\x99\0" },
- { 0x309e, "\x30\x9d\x30\x99\0" },
- { 0x30ac, "\x30\xab\x30\x99\0" },
- { 0x30ae, "\x30\xad\x30\x99\0" },
- { 0x30b0, "\x30\xaf\x30\x99\0" },
- { 0x30b2, "\x30\xb1\x30\x99\0" },
- { 0x30b4, "\x30\xb3\x30\x99\0" },
- { 0x30b6, "\x30\xb5\x30\x99\0" },
- { 0x30b8, "\x30\xb7\x30\x99\0" },
- { 0x30ba, "\x30\xb9\x30\x99\0" },
- { 0x30bc, "\x30\xbb\x30\x99\0" },
- { 0x30be, "\x30\xbd\x30\x99\0" },
- { 0x30c0, "\x30\xbf\x30\x99\0" },
- { 0x30c2, "\x30\xc1\x30\x99\0" },
- { 0x30c5, "\x30\xc4\x30\x99\0" },
- { 0x30c7, "\x30\xc6\x30\x99\0" },
- { 0x30c9, "\x30\xc8\x30\x99\0" },
- { 0x30d0, "\x30\xcf\x30\x99\0" },
- { 0x30d1, "\x30\xcf\x30\x9a\0" },
- { 0x30d3, "\x30\xd2\x30\x99\0" },
- { 0x30d4, "\x30\xd2\x30\x9a\0" },
- { 0x30d6, "\x30\xd5\x30\x99\0" },
- { 0x30d7, "\x30\xd5\x30\x9a\0" },
- { 0x30d9, "\x30\xd8\x30\x99\0" },
- { 0x30da, "\x30\xd8\x30\x9a\0" },
- { 0x30dc, "\x30\xdb\x30\x99\0" },
- { 0x30dd, "\x30\xdb\x30\x9a\0" },
- { 0x30f4, "\x30\xa6\x30\x99\0" },
- { 0x30f7, "\x30\xef\x30\x99\0" },
- { 0x30f8, "\x30\xf0\x30\x99\0" },
- { 0x30f9, "\x30\xf1\x30\x99\0" },
- { 0x30fa, "\x30\xf2\x30\x99\0" },
- { 0x30fe, "\x30\xfd\x30\x99\0" },
- { 0xf900, "\x8c\x48\0" },
- { 0xf901, "\x66\xf4\0" },
- { 0xf902, "\x8e\xca\0" },
- { 0xf903, "\x8c\xc8\0" },
- { 0xf904, "\x6e\xd1\0" },
- { 0xf905, "\x4e\x32\0" },
- { 0xf906, "\x53\xe5\0" },
- { 0xf907, "\x9f\x9c\0" },
- { 0xf908, "\x9f\x9c\0" },
- { 0xf909, "\x59\x51\0" },
- { 0xf90a, "\x91\xd1\0" },
- { 0xf90b, "\x55\x87\0" },
- { 0xf90c, "\x59\x48\0" },
- { 0xf90d, "\x61\xf6\0" },
- { 0xf90e, "\x76\x69\0" },
- { 0xf90f, "\x7f\x85\0" },
- { 0xf910, "\x86\x3f\0" },
- { 0xf911, "\x87\xba\0" },
- { 0xf912, "\x88\xf8\0" },
- { 0xf913, "\x90\x8f\0" },
- { 0xf914, "\x6a\x02\0" },
- { 0xf915, "\x6d\x1b\0" },
- { 0xf916, "\x70\xd9\0" },
- { 0xf917, "\x73\xde\0" },
- { 0xf918, "\x84\x3d\0" },
- { 0xf919, "\x91\x6a\0" },
- { 0xf91a, "\x99\xf1\0" },
- { 0xf91b, "\x4e\x82\0" },
- { 0xf91c, "\x53\x75\0" },
- { 0xf91d, "\x6b\x04\0" },
- { 0xf91e, "\x72\x1b\0" },
- { 0xf91f, "\x86\x2d\0" },
- { 0xf920, "\x9e\x1e\0" },
- { 0xf921, "\x5d\x50\0" },
- { 0xf922, "\x6f\xeb\0" },
- { 0xf923, "\x85\xcd\0" },
- { 0xf924, "\x89\x64\0" },
- { 0xf925, "\x62\xc9\0" },
- { 0xf926, "\x81\xd8\0" },
- { 0xf927, "\x88\x1f\0" },
- { 0xf928, "\x5e\xca\0" },
- { 0xf929, "\x67\x17\0" },
- { 0xf92a, "\x6d\x6a\0" },
- { 0xf92b, "\x72\xfc\0" },
- { 0xf92c, "\x90\xce\0" },
- { 0xf92d, "\x4f\x86\0" },
- { 0xf92e, "\x51\xb7\0" },
- { 0xf92f, "\x52\xde\0" },
- { 0xf930, "\x64\xc4\0" },
- { 0xf931, "\x6a\xd3\0" },
- { 0xf932, "\x72\x10\0" },
- { 0xf933, "\x76\xe7\0" },
- { 0xf934, "\x80\x01\0" },
- { 0xf935, "\x86\x06\0" },
- { 0xf936, "\x86\x5c\0" },
- { 0xf937, "\x8d\xef\0" },
- { 0xf938, "\x97\x32\0" },
- { 0xf939, "\x9b\x6f\0" },
- { 0xf93a, "\x9d\xfa\0" },
- { 0xf93b, "\x78\x8c\0" },
- { 0xf93c, "\x79\x7f\0" },
- { 0xf93d, "\x7d\xa0\0" },
- { 0xf93e, "\x83\xc9\0" },
- { 0xf93f, "\x93\x04\0" },
- { 0xf940, "\x9e\x7f\0" },
- { 0xf941, "\x8a\xd6\0" },
- { 0xf942, "\x58\xdf\0" },
- { 0xf943, "\x5f\x04\0" },
- { 0xf944, "\x7c\x60\0" },
- { 0xf945, "\x80\x7e\0" },
- { 0xf946, "\x72\x62\0" },
- { 0xf947, "\x78\xca\0" },
- { 0xf948, "\x8c\xc2\0" },
- { 0xf949, "\x96\xf7\0" },
- { 0xf94a, "\x58\xd8\0" },
- { 0xf94b, "\x5c\x62\0" },
- { 0xf94c, "\x6a\x13\0" },
- { 0xf94d, "\x6d\xda\0" },
- { 0xf94e, "\x6f\x0f\0" },
- { 0xf94f, "\x7d\x2f\0" },
- { 0xf950, "\x7e\x37\0" },
- { 0xf951, "\x96\xfb\0" },
- { 0xf952, "\x52\xd2\0" },
- { 0xf953, "\x80\x8b\0" },
- { 0xf954, "\x51\xdc\0" },
- { 0xf955, "\x51\xcc\0" },
- { 0xf956, "\x7a\x1c\0" },
- { 0xf957, "\x7d\xbe\0" },
- { 0xf958, "\x83\xf1\0" },
- { 0xf959, "\x96\x75\0" },
- { 0xf95a, "\x8b\x80\0" },
- { 0xf95b, "\x62\xcf\0" },
- { 0xf95c, "\x6a\x02\0" },
- { 0xf95d, "\x8a\xfe\0" },
- { 0xf95e, "\x4e\x39\0" },
- { 0xf95f, "\x5b\xe7\0" },
- { 0xf960, "\x60\x12\0" },
- { 0xf961, "\x73\x87\0" },
- { 0xf962, "\x75\x70\0" },
- { 0xf963, "\x53\x17\0" },
- { 0xf964, "\x78\xfb\0" },
- { 0xf965, "\x4f\xbf\0" },
- { 0xf966, "\x5f\xa9\0" },
- { 0xf967, "\x4e\x0d\0" },
- { 0xf968, "\x6c\xcc\0" },
- { 0xf969, "\x65\x78\0" },
- { 0xf96a, "\x7d\x22\0" },
- { 0xf96b, "\x53\xc3\0" },
- { 0xf96c, "\x58\x5e\0" },
- { 0xf96d, "\x77\x01\0" },
- { 0xf96e, "\x84\x49\0" },
- { 0xf96f, "\x8a\xaa\0" },
- { 0xf970, "\x6b\xba\0" },
- { 0xf971, "\x8f\xb0\0" },
- { 0xf972, "\x6c\x88\0" },
- { 0xf973, "\x62\xfe\0" },
- { 0xf974, "\x82\xe5\0" },
- { 0xf975, "\x63\xa0\0" },
- { 0xf976, "\x75\x65\0" },
- { 0xf977, "\x4e\xae\0" },
- { 0xf978, "\x51\x69\0" },
- { 0xf979, "\x51\xc9\0" },
- { 0xf97a, "\x68\x81\0" },
- { 0xf97b, "\x7c\xe7\0" },
- { 0xf97c, "\x82\x6f\0" },
- { 0xf97d, "\x8a\xd2\0" },
- { 0xf97e, "\x91\xcf\0" },
- { 0xf97f, "\x52\xf5\0" },
- { 0xf980, "\x54\x42\0" },
- { 0xf981, "\x59\x73\0" },
- { 0xf982, "\x5e\xec\0" },
- { 0xf983, "\x65\xc5\0" },
- { 0xf984, "\x6f\xfe\0" },
- { 0xf985, "\x79\x2a\0" },
- { 0xf986, "\x95\xad\0" },
- { 0xf987, "\x9a\x6a\0" },
- { 0xf988, "\x9e\x97\0" },
- { 0xf989, "\x9e\xce\0" },
- { 0xf98a, "\x52\x9b\0" },
- { 0xf98b, "\x66\xc6\0" },
- { 0xf98c, "\x6b\x77\0" },
- { 0xf98d, "\x8f\x62\0" },
- { 0xf98e, "\x5e\x74\0" },
- { 0xf98f, "\x61\x90\0" },
- { 0xf990, "\x62\x00\0" },
- { 0xf991, "\x64\x9a\0" },
- { 0xf992, "\x6f\x23\0" },
- { 0xf993, "\x71\x49\0" },
- { 0xf994, "\x74\x89\0" },
- { 0xf995, "\x79\xca\0" },
- { 0xf996, "\x7d\xf4\0" },
- { 0xf997, "\x80\x6f\0" },
- { 0xf998, "\x8f\x26\0" },
- { 0xf999, "\x84\xee\0" },
- { 0xf99a, "\x90\x23\0" },
- { 0xf99b, "\x93\x4a\0" },
- { 0xf99c, "\x52\x17\0" },
- { 0xf99d, "\x52\xa3\0" },
- { 0xf99e, "\x54\xbd\0" },
- { 0xf99f, "\x70\xc8\0" },
- { 0xf9a0, "\x88\xc2\0" },
- { 0xf9a1, "\x8a\xaa\0" },
- { 0xf9a2, "\x5e\xc9\0" },
- { 0xf9a3, "\x5f\xf5\0" },
- { 0xf9a4, "\x63\x7b\0" },
- { 0xf9a5, "\x6b\xae\0" },
- { 0xf9a6, "\x7c\x3e\0" },
- { 0xf9a7, "\x73\x75\0" },
- { 0xf9a8, "\x4e\xe4\0" },
- { 0xf9a9, "\x56\xf9\0" },
- { 0xf9aa, "\x5b\xe7\0" },
- { 0xf9ab, "\x5d\xba\0" },
- { 0xf9ac, "\x60\x1c\0" },
- { 0xf9ad, "\x73\xb2\0" },
- { 0xf9ae, "\x74\x69\0" },
- { 0xf9af, "\x7f\x9a\0" },
- { 0xf9b0, "\x80\x46\0" },
- { 0xf9b1, "\x92\x34\0" },
- { 0xf9b2, "\x96\xf6\0" },
- { 0xf9b3, "\x97\x48\0" },
- { 0xf9b4, "\x98\x18\0" },
- { 0xf9b5, "\x4f\x8b\0" },
- { 0xf9b6, "\x79\xae\0" },
- { 0xf9b7, "\x91\xb4\0" },
- { 0xf9b8, "\x96\xb8\0" },
- { 0xf9b9, "\x60\xe1\0" },
- { 0xf9ba, "\x4e\x86\0" },
- { 0xf9bb, "\x50\xda\0" },
- { 0xf9bc, "\x5b\xee\0" },
- { 0xf9bd, "\x5c\x3f\0" },
- { 0xf9be, "\x65\x99\0" },
- { 0xf9bf, "\x6a\x02\0" },
- { 0xf9c0, "\x71\xce\0" },
- { 0xf9c1, "\x76\x42\0" },
- { 0xf9c2, "\x84\xfc\0" },
- { 0xf9c3, "\x90\x7c\0" },
- { 0xf9c4, "\x9f\x8d\0" },
- { 0xf9c5, "\x66\x88\0" },
- { 0xf9c6, "\x96\x2e\0" },
- { 0xf9c7, "\x52\x89\0" },
- { 0xf9c8, "\x67\x7b\0" },
- { 0xf9c9, "\x67\xf3\0" },
- { 0xf9ca, "\x6d\x41\0" },
- { 0xf9cb, "\x6e\x9c\0" },
- { 0xf9cc, "\x74\x09\0" },
- { 0xf9cd, "\x75\x59\0" },
- { 0xf9ce, "\x78\x6b\0" },
- { 0xf9cf, "\x7d\x10\0" },
- { 0xf9d0, "\x98\x5e\0" },
- { 0xf9d1, "\x51\x6d\0" },
- { 0xf9d2, "\x62\x2e\0" },
- { 0xf9d3, "\x96\x78\0" },
- { 0xf9d4, "\x50\x2b\0" },
- { 0xf9d5, "\x5d\x19\0" },
- { 0xf9d6, "\x6d\xea\0" },
- { 0xf9d7, "\x8f\x2a\0" },
- { 0xf9d8, "\x5f\x8b\0" },
- { 0xf9d9, "\x61\x44\0" },
- { 0xf9da, "\x68\x17\0" },
- { 0xf9db, "\x73\x87\0" },
- { 0xf9dc, "\x96\x86\0" },
- { 0xf9dd, "\x52\x29\0" },
- { 0xf9de, "\x54\x0f\0" },
- { 0xf9df, "\x5c\x65\0" },
- { 0xf9e0, "\x66\x13\0" },
- { 0xf9e1, "\x67\x4e\0" },
- { 0xf9e2, "\x68\xa8\0" },
- { 0xf9e3, "\x6c\xe5\0" },
- { 0xf9e4, "\x74\x06\0" },
- { 0xf9e5, "\x75\xe2\0" },
- { 0xf9e6, "\x7f\x79\0" },
- { 0xf9e7, "\x88\xcf\0" },
- { 0xf9e8, "\x88\xe1\0" },
- { 0xf9e9, "\x91\xcc\0" },
- { 0xf9ea, "\x96\xe2\0" },
- { 0xf9eb, "\x53\x3f\0" },
- { 0xf9ec, "\x6e\xba\0" },
- { 0xf9ed, "\x54\x1d\0" },
- { 0xf9ee, "\x71\xd0\0" },
- { 0xf9ef, "\x74\x98\0" },
- { 0xf9f0, "\x85\xfa\0" },
- { 0xf9f1, "\x96\xa3\0" },
- { 0xf9f2, "\x9c\x57\0" },
- { 0xf9f3, "\x9e\x9f\0" },
- { 0xf9f4, "\x67\x97\0" },
- { 0xf9f5, "\x6d\xcb\0" },
- { 0xf9f6, "\x81\xe8\0" },
- { 0xf9f7, "\x7a\xcb\0" },
- { 0xf9f8, "\x7b\x20\0" },
- { 0xf9f9, "\x7c\x92\0" },
- { 0xf9fa, "\x72\xc0\0" },
- { 0xf9fb, "\x70\x99\0" },
- { 0xf9fc, "\x8b\x58\0" },
- { 0xf9fd, "\x4e\xc0\0" },
- { 0xf9fe, "\x83\x36\0" },
- { 0xf9ff, "\x52\x3a\0" },
- { 0xfa00, "\x52\x07\0" },
- { 0xfa01, "\x5e\xa6\0" },
- { 0xfa02, "\x62\xd3\0" },
- { 0xfa03, "\x7c\xd6\0" },
- { 0xfa04, "\x5b\x85\0" },
- { 0xfa05, "\x6d\x1e\0" },
- { 0xfa06, "\x66\xb4\0" },
- { 0xfa07, "\x8f\x3b\0" },
- { 0xfa08, "\x88\x4c\0" },
- { 0xfa09, "\x96\x4d\0" },
- { 0xfa0a, "\x89\x8b\0" },
- { 0xfa0b, "\x5e\xd3\0" },
- { 0xfa0c, "\x51\x40\0" },
- { 0xfa0d, "\x55\xc0\0" },
- { 0xfa10, "\x58\x5a\0" },
- { 0xfa12, "\x66\x74\0" },
- { 0xfa15, "\x51\xde\0" },
- { 0xfa16, "\x73\x2a\0" },
- { 0xfa17, "\x76\xca\0" },
- { 0xfa18, "\x79\x3c\0" },
- { 0xfa19, "\x79\x5e\0" },
- { 0xfa1a, "\x79\x65\0" },
- { 0xfa1b, "\x79\x8f\0" },
- { 0xfa1c, "\x97\x56\0" },
- { 0xfa1d, "\x7c\xbe\0" },
- { 0xfa1e, "\x7f\xbd\0" },
- { 0xfa20, "\x86\x12\0" },
- { 0xfa22, "\x8a\xf8\0" },
- { 0xfa25, "\x90\x38\0" },
- { 0xfa26, "\x90\xfd\0" },
- { 0xfa2a, "\x98\xef\0" },
- { 0xfa2b, "\x98\xfc\0" },
- { 0xfa2c, "\x99\x28\0" },
- { 0xfa2d, "\x9d\xb4\0" },
- { 0xfb1f, "\x05\xf2\x05\xb7\0" },
- { 0xfb2a, "\x05\xe9\x05\xc1\0" },
- { 0xfb2b, "\x05\xe9\x05\xc2\0" },
- { 0xfb2c, "\x05\xe9\x05\xbc\x05\xc1\0" },
- { 0xfb2d, "\x05\xe9\x05\xbc\x05\xc2\0" },
- { 0xfb2e, "\x05\xd0\x05\xb7\0" },
- { 0xfb2f, "\x05\xd0\x05\xb8\0" },
- { 0xfb30, "\x05\xd0\x05\xbc\0" },
- { 0xfb31, "\x05\xd1\x05\xbc\0" },
- { 0xfb32, "\x05\xd2\x05\xbc\0" },
- { 0xfb33, "\x05\xd3\x05\xbc\0" },
- { 0xfb34, "\x05\xd4\x05\xbc\0" },
- { 0xfb35, "\x05\xd5\x05\xbc\0" },
- { 0xfb36, "\x05\xd6\x05\xbc\0" },
- { 0xfb38, "\x05\xd8\x05\xbc\0" },
- { 0xfb39, "\x05\xd9\x05\xbc\0" },
- { 0xfb3a, "\x05\xda\x05\xbc\0" },
- { 0xfb3b, "\x05\xdb\x05\xbc\0" },
- { 0xfb3c, "\x05\xdc\x05\xbc\0" },
- { 0xfb3e, "\x05\xde\x05\xbc\0" },
- { 0xfb40, "\x05\xe0\x05\xbc\0" },
- { 0xfb41, "\x05\xe1\x05\xbc\0" },
- { 0xfb43, "\x05\xe3\x05\xbc\0" },
- { 0xfb44, "\x05\xe4\x05\xbc\0" },
- { 0xfb46, "\x05\xe6\x05\xbc\0" },
- { 0xfb47, "\x05\xe7\x05\xbc\0" },
- { 0xfb48, "\x05\xe8\x05\xbc\0" },
- { 0xfb49, "\x05\xe9\x05\xbc\0" },
- { 0xfb4a, "\x05\xea\x05\xbc\0" },
- { 0xfb4b, "\x05\xd5\x05\xb9\0" },
- { 0xfb4c, "\x05\xd1\x05\xbf\0" },
- { 0xfb4d, "\x05\xdb\x05\xbf\0" },
- { 0xfb4e, "\x05\xe4\x05\xbf\0" }
-};
-
-/*
- * WARNING!
- *
- * NO BUFFER CHECKING AHEAD!
- *
- */
-
-static gint
-e_canonical_decomposition (gunichar ch, gunichar * buf)
-{
- gint len = 0;
-
- if (ch <= 0xffff)
- {
- int start = 0;
- int end = sizeof (e_decomp_table) / sizeof (e_decomp_table[0]);
- while (start != end)
- {
- int half = (start + end) / 2;
- if (ch == e_decomp_table[half].ch) {
- /* Found it. */
- int i;
- /* We store as a double-nul terminated string. */
- for (len = 0; (e_decomp_table[half].expansion[len] || e_decomp_table[half].expansion[len + 1]); len += 2) ;
-
- /* We've counted twice as many bytes as there are
- characters. */
- len /= 2;
-
- for (i = 0; i < len; i ++) {
- buf[i] = (e_decomp_table[half].expansion[2 * i] << 8) | e_decomp_table[half].expansion[2 * i + 1];
- }
- break;
- } else if (ch > e_decomp_table[half].ch) {
- if (start == half) break;
- start = half;
- } else {
- if (end == half) break;
- end = half;
- }
- }
- }
-
- if (len == 0)
- {
- /* Not in our table. */
- *buf = ch;
- len = 1;
- }
-
- /* Supposedly following the Unicode 2.1.9 table means that the
- decompositions come out in canonical order. I haven't tested
- this, but we rely on it here. */
- return len;
-}
-
-static gunichar
-e_stripped_char (gunichar ch)
-{
- gunichar decomp[MAX_DECOMP];
- GUnicodeType utype;
- gint dlen;
-
- utype = g_unichar_type (ch);
-
- switch (utype) {
- case G_UNICODE_CONTROL:
- case G_UNICODE_FORMAT:
- case G_UNICODE_UNASSIGNED:
- case G_UNICODE_COMBINING_MARK:
- /* Ignore those */
- return 0;
- break;
- default:
- /* Convert to lowercase, fall through */
- ch = g_unichar_tolower (ch);
- case G_UNICODE_LOWERCASE_LETTER:
- dlen = e_canonical_decomposition (ch, decomp);
- if (dlen > 0) return *decomp;
- break;
- }
-
- return 0;
-}
-
-gchar *
-e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- gchar *ret_val = NULL;
- gchar *combined_name;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- return ret_val;
- }
-
- combined_name = g_strdup_printf("_%s", prop_name);
- prop = xmlGetProp ((xmlNode *) parent, combined_name);
- if (prop != NULL) {
- ret_val = e_utf8_from_locale_string (gettext (prop));
- xmlFree (prop);
- }
- g_free(combined_name);
-
- return ret_val;
-}
diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h
deleted file mode 100644
index 0a3b3ccafe..0000000000
--- a/widgets/misc/e-unicode.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-unicode.h - utf-8 support functions for gal
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_UNICODE_H_
-#define _E_UNICODE_H_
-
-#include <sys/types.h>
-#include <glib.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwidget.h>
-#include <libxml/tree.h>
-#include <iconv.h>
-
-G_BEGIN_DECLS
-
-#define G_UTF8_IN_GAL
-
-/*
- * UTF-8 searching implementations
- *
- * e_utf8_strstrcase - case insensitive search
- * e_utf8_strstrcasedecomp - case insensitive and decompositing search (i.e. accented
- * letters are treated equal to their base letters, explicit accent marks (unicode
- * not ascii/iso ones) are ignored).
- */
-
-const gchar *e_utf8_strstrcase (const gchar *haystack,
- const gchar *needle);
-const gchar *e_utf8_strstrcasedecomp (const gchar *haystack,
- const gchar *needle);
-gchar *e_utf8_from_gtk_event_key (GtkWidget *widget,
- guint keyval,
- const gchar *string);
-gchar *e_utf8_from_iconv_string (iconv_t ic,
- const gchar *string);
-gchar *e_utf8_from_iconv_string_sized (iconv_t ic,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_iconv_string (iconv_t ic,
- const gchar *string);
-gchar *e_utf8_to_iconv_string_sized (iconv_t ic,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_charset_string (const gchar *charset,
- const gchar *string);
-gchar *e_utf8_from_charset_string_sized (const gchar *charset,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_charset_string (const gchar *charset,
- const gchar *string);
-gchar *e_utf8_to_charset_string_sized (const gchar *charset,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_locale_string (const gchar *string);
-gchar *e_utf8_from_locale_string_sized (const gchar *string,
- gint bytes);
-gchar *e_utf8_to_locale_string (const gchar *string);
-gchar *e_utf8_to_locale_string_sized (const gchar *string,
- gint bytes);
-gboolean e_utf8_is_ascii (const gchar *string);
-/*
- * These are simple wrappers that save us some typing
- */
-
-/* NB! This return newly allocated string, not const as gtk+ one */
-gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry);
-void e_utf8_gtk_entry_set_text (GtkEntry *entry,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_text (GtkEditable *editable);
-void e_utf8_gtk_editable_set_text (GtkEditable *editable,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable,
- gint start,
- gint end);
-void e_utf8_gtk_editable_insert_text (GtkEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
-GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu,
- const gchar *label);
-void e_utf8_gtk_clist_set_text (GtkCList *clist,
- gint row,
- gint col,
- const gchar *text);
-gint e_utf8_gtk_clist_append (GtkCList *clist,
- gchar *text[]);
-gchar *e_utf8_xml1_decode (const gchar *text);
-gchar *e_utf8_xml1_encode (const gchar *text);
-gint e_unichar_to_utf8 (gint c,
- gchar *outbuf);
-gchar *e_unicode_get_utf8 (const gchar *text,
- gunichar *out);
-guint32 gdk_keyval_to_unicode (guint keysym);
-gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-
-G_END_DECLS
-
-#endif
-
-
diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c
deleted file mode 100644
index 25b58d2e1d..0000000000
--- a/widgets/misc/e-url-entry.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-url-entry.c
- *
- * Copyright (C) 2002 JP Rosevear
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: JP Rosevear
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <libgnome/gnome-url.h>
-#include "art/connect_to_url-16.xpm"
-#include "e-url-entry.h"
-
-struct _EUrlEntryPrivate {
- GtkWidget *entry;
- GtkWidget *button;
-};
-
-static void class_init (EUrlEntryClass *klass);
-static void init (EUrlEntry *url_entry);
-static void destroy (GtkObject *obj);
-
-static void button_clicked_cb (GtkWidget *widget, gpointer data);
-
-static GtkHBoxClass *parent_class = NULL;
-
-
-GtkType
-e_url_entry_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0)
- {
- static const GtkTypeInfo info =
- {
- "EUrlEntry",
- sizeof (EUrlEntry),
- sizeof (EUrlEntryClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_hbox_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-class_init (EUrlEntryClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref(gtk_hbox_get_type ());
-
- object_class->destroy = destroy;
-}
-
-
-static void
-init (EUrlEntry *url_entry)
-{
- EUrlEntryPrivate *priv;
- GdkColormap *colormap;
- GdkPixmap *url_icon;
- GdkBitmap *url_mask;
- GtkWidget *pixmap;
-
- priv = g_new0 (EUrlEntryPrivate, 1);
- url_entry->priv = priv;
-
- priv->entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (url_entry), priv->entry, TRUE, TRUE, 0);
- priv->button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (url_entry), priv->button, FALSE, FALSE, 0);
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (priv->button));
- url_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap,
- &url_mask, NULL,
- connect_to_url_16_xpm);
-
- pixmap = gtk_pixmap_new (url_icon, url_mask);
- gtk_container_add (GTK_CONTAINER (priv->button), pixmap);
- gtk_widget_show (pixmap);
-
- gtk_widget_show (priv->button);
- gtk_widget_show (priv->entry);
-
- g_signal_connect((priv->button), "clicked",
- G_CALLBACK (button_clicked_cb), url_entry);
-}
-
-static void
-destroy (GtkObject *obj)
-{
- EUrlEntry *url_entry;
- EUrlEntryPrivate *priv;
-
- url_entry = E_URL_ENTRY (obj);
- priv = url_entry->priv;
-
- g_free (priv);
-}
-
-
-
-GtkWidget *
-e_url_entry_new (void)
-{
- return gtk_type_new (E_TYPE_URL_ENTRY);
-}
-
-
-GtkWidget *
-e_url_entry_get_entry (EUrlEntry *url_entry)
-{
- EUrlEntryPrivate *priv;
-
- g_return_val_if_fail (url_entry != NULL, NULL);
- g_return_val_if_fail (E_IS_URL_ENTRY (url_entry), NULL);
-
- priv = url_entry->priv;
-
- return priv->entry;
-}
-
-static void
-button_clicked_cb (GtkWidget *widget, gpointer data)
-{
- EUrlEntry *url_entry;
- EUrlEntryPrivate *priv;
- char *url;
-
- url_entry = E_URL_ENTRY (data);
- priv = url_entry->priv;
-
- url = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
- gnome_url_show (url, NULL);
- g_free (url);
-}
diff --git a/widgets/misc/e-url-entry.h b/widgets/misc/e-url-entry.h
deleted file mode 100644
index 3cf98d7b8c..0000000000
--- a/widgets/misc/e-url-entry.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-url-entry.h
- *
- * Copyright (C) 2002 JP Rosevear
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: JP Rosevear
- */
-
-#ifndef _E_URL_ENTRY_H_
-#define _E_URL_ENTRY_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_URL_ENTRY (e_url_entry_get_type ())
-#define E_URL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_URL_ENTRY, EUrlEntry))
-#define E_URL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_URL_ENTRY, EUrlEntryClass))
-#define E_IS_URL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_URL_ENTRY))
-#define E_IS_URL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_URL_ENTRY))
-
-
-typedef struct _EUrlEntry EUrlEntry;
-typedef struct _EUrlEntryPrivate EUrlEntryPrivate;
-typedef struct _EUrlEntryClass EUrlEntryClass;
-
-struct _EUrlEntry {
- GtkHBox parent;
-
- EUrlEntryPrivate *priv;
-};
-
-struct _EUrlEntryClass {
- GtkHBoxClass parent_class;
-};
-
-
-
-GtkType e_url_entry_get_type (void);
-GtkWidget *e_url_entry_new (void);
-GtkWidget *e_url_entry_get_entry (EUrlEntry *url_entry);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_URL_ENTRY_H_ */
diff --git a/widgets/misc/e-util-marshal.list b/widgets/misc/e-util-marshal.list
deleted file mode 100644
index f5d8f046b7..0000000000
--- a/widgets/misc/e-util-marshal.list
+++ /dev/null
@@ -1,2 +0,0 @@
-NONE:NONE
-NONE:INT
diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade
deleted file mode 100644
index 98286545b3..0000000000
--- a/widgets/misc/gal-categories.glade
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <widget class="GtkDialog" id="categories">
- <property name="visible">no</property>
- <property name="title" translatable="yes">categories</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">yes</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button4">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-categories">
- <property name="homogeneous">no</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">0</property>
- <property name="n-rows">5</property>
- <property name="n-columns">1</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkEntry" id="entry-categories">
- <property name="can_focus">yes</property>
- <property name="editable">yes</property>
- <property name="text" translatable="yes"></property>
- <property name="max-length">0</property>
- <property name="visibility">yes</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-header">
- <property name="label" translatable="yes">Item(s) belong to these _categories:</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-categories</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="label" translatable="yes">_Available Categories:</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-ecmld">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Edit Master Category List...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">4</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
-</glade-interface>
diff --git a/widgets/misc/pixmaps/.cvsignore b/widgets/misc/pixmaps/.cvsignore
deleted file mode 100644
index 3dda72986f..0000000000
--- a/widgets/misc/pixmaps/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile
diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm
deleted file mode 100644
index cf9d0aca33..0000000000
--- a/widgets/misc/pixmaps/cursor_cross.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_cross_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ....... ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" ......+++++...... ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" ......+++++....... ",
-" .....+++++....... ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" ........ ",
-" ....... ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm
deleted file mode 100644
index 61a6de4b88..0000000000
--- a/widgets/misc/pixmaps/cursor_hand_closed.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_hand_closed_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" ",
-" .. ",
-" ..++... ",
-" .+++++++.. ",
-" .+++++++++. ",
-" ...+++++++++. ",
-" .++.+++++++++. ",
-" .++++++++++++. ",
-" .+++++++++++. ",
-" .++++++++++. ",
-" .+++++++++. ",
-" .+++++++. ",
-" .++++++. ",
-" .++++++. ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm
deleted file mode 100644
index 048acc8054..0000000000
--- a/widgets/misc/pixmaps/cursor_hand_open.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_hand_open_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" .. ",
-" .. .++... ",
-" .++..++.++. ",
-" .++..++.++. . ",
-" .++.++.++..+. ",
-" .++.++.++.++. ",
-" .. .+++++++.++. ",
-" .++..++++++++++. ",
-" .+++.+++++++++. ",
-" .++++++++++++. ",
-" .+++++++++++. ",
-" .++++++++++. ",
-" .+++++++++. ",
-" .+++++++. ",
-" .++++++. ",
-" .++++++. ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm
deleted file mode 100644
index 1caf9e3e2a..0000000000
--- a/widgets/misc/pixmaps/cursor_zoom_in.xpm
+++ /dev/null
@@ -1,37 +0,0 @@
-/* XPM */
-static char * cursor_zoom_in_xpm[] = {
-"32 32 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ...... ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . ... . ",
-" . ... . ",
-" . ....... . ",
-" . ....... . ",
-" . ... . ",
-" . ... .. ",
-" .. . . ",
-" .. . . . ",
-" ........ . . ",
-" ..... . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . ",
-" . . ",
-" .. ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm
deleted file mode 100644
index af1b698521..0000000000
--- a/widgets/misc/pixmaps/cursor_zoom_out.xpm
+++ /dev/null
@@ -1,37 +0,0 @@
-/* XPM */
-static char * cursor_zoom_out_xpm[] = {
-"32 32 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ...... ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . . ",
-" . . ",
-" . ....... . ",
-" . ....... . ",
-" . . ",
-" . .. ",
-" .. . . ",
-" .. . . . ",
-" ........ . . ",
-" ..... . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . ",
-" . . ",
-" .. ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c
deleted file mode 100644
index f6e4efe3ab..0000000000
--- a/widgets/misc/test-calendar.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * test-calendar - tests the ECalendar widget.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkdnd.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-ui-init.h>
-
-#include "e-calendar.h"
-
-/* Drag and Drop stuff. */
-enum {
- TARGET_SHORTCUT
-};
-static GtkTargetEntry target_table[] = {
- { "E-SHORTCUT", 0, TARGET_SHORTCUT }
-};
-static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
-
-
-static void on_date_range_changed (ECalendarItem *calitem);
-static void on_selection_changed (ECalendarItem *calitem);
-static void get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gpointer data);
-
-static void
-delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data)
-{
- gtk_main_quit ();
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *app;
- GtkWidget *cal;
- GtkWidget *vbox;
- ECalendarItem *calitem;
-
- gnome_init ("test-calendar", "0.0", argc, argv);
-
- app = gnome_app_new ("Test", "Test");
- gtk_window_set_default_size (GTK_WINDOW (app), 400, 400);
- gtk_window_set_policy (GTK_WINDOW (app), FALSE, TRUE, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (app), 8);
-
- g_signal_connect((app), "delete_event",
- G_CALLBACK (delete_event_cb), NULL);
-
- cal = e_calendar_new ();
- e_calendar_set_minimum_size (E_CALENDAR (cal), 1, 1);
- calitem = E_CALENDAR (cal)->calitem;
- gtk_widget_show (cal);
- e_calendar_item_set_style_callback (calitem, get_day_style,
- NULL, NULL);
-
- g_signal_connect((calitem), "date_range_changed",
- G_CALLBACK (on_date_range_changed), NULL);
- g_signal_connect((calitem), "selection_changed",
- G_CALLBACK (on_selection_changed), NULL);
-
-
- gtk_drag_dest_set (cal,
- GTK_DEST_DEFAULT_ALL,
- target_table, n_targets,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), cal, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- gnome_app_set_contents (GNOME_APP (app), vbox);
- gtk_widget_show (app);
-
- gtk_main ();
-
- return 0;
-}
-
-
-static void
-on_date_range_changed (ECalendarItem *calitem)
-{
- gint start_year, start_month, start_day;
- gint end_year, end_month, end_day;
-
- e_calendar_item_get_date_range (calitem,
- &start_year, &start_month, &start_day,
- &end_year, &end_month, &end_day);
-
- g_print ("Date range changed (D/M/Y): %i/%i/%i - %i/%i/%i\n",
- start_day, start_month + 1, start_year,
- end_day, end_month + 1, end_year);
-
- /* These days should appear bold. Remember month is 0 to 11. */
- e_calendar_item_mark_day (calitem, 2000, 7, 26, /* 26th Aug 2000. */
- E_CALENDAR_ITEM_MARK_BOLD);
- e_calendar_item_mark_day (calitem, 2000, 8, 13, /* 13th Sep 2000. */
- E_CALENDAR_ITEM_MARK_BOLD);
-}
-
-
-static void
-on_selection_changed (ECalendarItem *calitem)
-{
- GDate start_date, end_date;
-
- e_calendar_item_get_selection (calitem, &start_date, &end_date);
-
- g_print ("Selection changed (D/M/Y): %i/%i/%i - %i/%i/%i\n",
- g_date_day (&start_date),
- g_date_month (&start_date),
- g_date_year (&start_date),
- g_date_day (&end_date),
- g_date_month (&end_date),
- g_date_year (&end_date));
-}
-
-
-static void
-get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gpointer data)
-{
- *bg_color = NULL;
- *fg_color = NULL;
- *box_color = NULL;
- *bold = FALSE;
-
-#if 1
-
- if (day_style == 1)
- *bold = TRUE;
-
- if (today)
- *box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
-
- if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
-
- if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG];
- }
-
-#else
-
- if (day_style == 1)
- *bold = TRUE;
-
- if (today)
- *box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
-
- if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
-
- if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
- }
-
-#endif
-}
diff --git a/widgets/misc/test-charset-picker.c b/widgets/misc/test-charset-picker.c
deleted file mode 100644
index 889bba2600..0000000000
--- a/widgets/misc/test-charset-picker.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <gnome.h>
-#include "e-charset-picker.h"
-
-int
-main (int argc, char **argv)
-{
- char *charset;
-
- gnome_init ("test-charset-picker", "1.0", argc, argv);
-
- charset = e_charset_picker_dialog ("test-charset-picker",
- "Pick a charset, any charset",
- NULL, NULL);
- if (charset)
- printf ("You picked: %s\n", charset);
-
- return 0;
-}
diff --git a/widgets/misc/test-color.c b/widgets/misc/test-color.c
deleted file mode 100644
index 364e0644de..0000000000
--- a/widgets/misc/test-color.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * test-color.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gal/util/e-i18n.h>
-#include <gnome.h>
-#include "widget-color-combo.h"
-#include "color-palette.h"
-#include "e-colors.h"
-#include "pixmaps/cursor_hand_open.xpm"
-
-/* To compile (from src/widgets):
-
-gcc -I.. -I../.. -L. -Wall -o tester tester.c ../color.c `gnome-config --cflags --libs gnome gnomeui` -lwidgets
-
-*/
-
-gint
-main ( gint argc, gchar* argv[] )
-{
- GtkWidget * dialog;
- GtkWidget * T;
- ColorGroup *cg;
-
- gnome_program_init ("tester", "1.0",
- LIBGNOMEUI_MODULE,
- argc, argv, NULL);
-
- dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
-
- cg = color_group_fetch ("fore_color_group", dialog);
- T = color_palette_new ("Color Palette", NULL, cg);
-
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- cg = color_group_fetch ("fore_color_group", dialog);
- T = color_combo_new (
- gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm),
- _("Automatic"), &e_black, cg);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- cg = color_group_fetch ("back_color_group", dialog);
- T = color_combo_new (
- gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm),
- _("Automatic"), &e_black, cg);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) );
- return 0;
-}
diff --git a/widgets/misc/test-dateedit.c b/widgets/misc/test-dateedit.c
deleted file mode 100644
index c96e881369..0000000000
--- a/widgets/misc/test-dateedit.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * test-dateedit - tests the EDateEdit widget.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkwindow.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-app.h>
-#include "e-dateedit.h"
-
-static void delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- GtkWidget *app);
-static void on_get_date_clicked (GtkWidget *button,
- EDateEdit *dedit);
-static void on_toggle_24_hour_clicked (GtkWidget *button,
- EDateEdit *dedit);
-static void on_changed (EDateEdit *dedit,
- gchar *name);
-#if 0
-static void on_date_changed (EDateEdit *dedit,
- gchar *name);
-static void on_time_changed (EDateEdit *dedit,
- gchar *name);
-#endif
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *app;
- EDateEdit *dedit;
- GtkWidget *table, *button;
-
- gnome_program_init ("test-dateedit", "0.0", LIBGNOMEUI_MODULE, argc, argv, NULL);
-
- puts ("here");
-
- app = gnome_app_new ("Test", "Test");
- gtk_window_set_default_size (GTK_WINDOW (app), 300, 200);
- gtk_window_set_policy (GTK_WINDOW (app), FALSE, TRUE, TRUE);
- gtk_container_set_border_width (GTK_CONTAINER (app), 8);
-
- g_signal_connect((app), "delete_event",
- G_CALLBACK (delete_event_cb), app);
-
- table = gtk_table_new (3, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_widget_show (table);
- gnome_app_set_contents (GNOME_APP (app), table);
-
- /* EDateEdit 1. */
- dedit = E_DATE_EDIT (e_date_edit_new ());
- gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit,
- 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 0, 0);
- gtk_widget_show ((GtkWidget*) (dedit));
-
-#if 0
- g_signal_connect((dedit), "date_changed",
- G_CALLBACK (on_date_changed), "1");
- g_signal_connect((dedit), "time_changed",
- G_CALLBACK (on_time_changed), "1");
-#else
- g_signal_connect((dedit), "changed",
- G_CALLBACK (on_changed), "1");
-#endif
-
- button = gtk_button_new_with_label ("Print Date");
- gtk_table_attach (GTK_TABLE (table), button,
- 1, 2, 0, 1, 0, 0, 0, 0);
- gtk_widget_show (button);
- g_signal_connect((button), "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
-
- /* EDateEdit 2. */
- dedit = E_DATE_EDIT (e_date_edit_new ());
- gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit,
- 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 0, 0);
- gtk_widget_show ((GtkWidget*) (dedit));
- e_date_edit_set_week_start_day (dedit, 1);
- e_date_edit_set_show_week_numbers (dedit, TRUE);
- e_date_edit_set_use_24_hour_format (dedit, FALSE);
- e_date_edit_set_time_popup_range (dedit, 8, 18);
- e_date_edit_set_show_time (dedit, FALSE);
-
-#if 0
- g_signal_connect((dedit), "date_changed",
- G_CALLBACK (on_date_changed), "2");
- g_signal_connect((dedit), "time_changed",
- G_CALLBACK (on_time_changed), "2");
-#else
- g_signal_connect((dedit), "changed",
- G_CALLBACK (on_changed), "2");
-#endif
-
- button = gtk_button_new_with_label ("Print Date");
- gtk_table_attach (GTK_TABLE (table), button,
- 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_widget_show (button);
- g_signal_connect((button), "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
-
- /* EDateEdit 3. */
- dedit = E_DATE_EDIT (e_date_edit_new ());
- gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit,
- 0, 1, 2, 3, GTK_FILL, GTK_EXPAND, 0, 0);
- gtk_widget_show ((GtkWidget*) (dedit));
- e_date_edit_set_week_start_day (dedit, 1);
- e_date_edit_set_show_week_numbers (dedit, TRUE);
- e_date_edit_set_use_24_hour_format (dedit, FALSE);
- e_date_edit_set_time_popup_range (dedit, 8, 18);
- e_date_edit_set_allow_no_date_set (dedit, TRUE);
-
-#if 0
- g_signal_connect((dedit), "date_changed",
- G_CALLBACK (on_date_changed), "3");
- g_signal_connect((dedit), "time_changed",
- G_CALLBACK (on_time_changed), "3");
-#else
- g_signal_connect((dedit), "changed",
- G_CALLBACK (on_changed), "3");
-#endif
-
- button = gtk_button_new_with_label ("Print Date");
- gtk_table_attach (GTK_TABLE (table), button,
- 1, 2, 2, 3, 0, 0, 0, 0);
- gtk_widget_show (button);
- g_signal_connect((button), "clicked",
- G_CALLBACK (on_get_date_clicked), dedit);
-
- button = gtk_button_new_with_label ("Toggle 24-hour");
- gtk_table_attach (GTK_TABLE (table), button,
- 2, 3, 2, 3, 0, 0, 0, 0);
- gtk_widget_show (button);
- g_signal_connect((button), "clicked",
- G_CALLBACK (on_toggle_24_hour_clicked),
- dedit);
-
- gtk_widget_show (app);
-
- gtk_main ();
-
- return 0;
-}
-
-
-static void
-delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- GtkWidget *app)
-{
- gtk_widget_destroy (app);
-
- gtk_main_quit ();
-}
-
-
-static void
-on_get_date_clicked (GtkWidget *button,
- EDateEdit *dedit)
-{
- time_t t;
-
- t = e_date_edit_get_time (dedit);
- if (t == -1)
- g_print ("Time: None\n");
- else
- g_print ("Time: %s", ctime (&t));
-
- if (!e_date_edit_date_is_valid (dedit))
- g_print (" Date invalid\n");
-
- if (!e_date_edit_time_is_valid (dedit))
- g_print (" Time invalid\n");
-}
-
-
-static void
-on_toggle_24_hour_clicked (GtkWidget *button,
- EDateEdit *dedit)
-{
- e_date_edit_set_use_24_hour_format (dedit, !e_date_edit_get_use_24_hour_format (dedit));
-}
-
-
-#if 0
-static void
-on_date_changed (EDateEdit *dedit,
- gchar *name)
-{
- gint year, month, day;
-
- if (e_date_edit_date_is_valid (dedit)) {
- if (e_date_edit_get_date (dedit, &year, &month, &day)) {
- g_print ("Date %s changed to: %i/%i/%i (M/D/Y)\n",
- name, month, day, year);
- } else {
- g_print ("Date %s changed to: None\n", name);
- }
- } else {
- g_print ("Date %s changed to: Not Valid\n", name);
- }
-}
-
-
-static void
-on_time_changed (EDateEdit *dedit,
- gchar *name)
-{
- gint hour, minute;
-
- if (e_date_edit_time_is_valid (dedit)) {
- if (e_date_edit_get_time_of_day (dedit, &hour, &minute)) {
- g_print ("Time %s changed to: %02i:%02i\n", name,
- hour, minute);
- } else {
- g_print ("Time %s changed to: None\n", name);
- }
- } else {
- g_print ("Time %s changed to: Not Valid\n", name);
- }
-}
-#endif
-
-
-static void
-on_changed (EDateEdit *dedit,
- gchar *name)
-{
- gint year, month, day, hour, minute;
-
- g_print ("Date %s changed ", name);
-
- if (e_date_edit_date_is_valid (dedit)) {
- if (e_date_edit_get_date (dedit, &year, &month, &day)) {
- g_print ("M/D/Y: %i/%i/%i", month, day, year);
- } else {
- g_print ("None");
- }
- } else {
- g_print ("Date Invalid");
- }
-
- if (e_date_edit_time_is_valid (dedit)) {
- if (e_date_edit_get_time_of_day (dedit, &hour, &minute)) {
- g_print (" %02i:%02i\n", hour, minute);
- } else {
- g_print (" None\n");
- }
- } else {
- g_print (" Time Invalid\n");
- }
-}
-
-
diff --git a/widgets/misc/test-dropdown-button.c b/widgets/misc/test-dropdown-button.c
deleted file mode 100644
index 349176d05c..0000000000
--- a/widgets/misc/test-dropdown-button.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-dropdown-menu.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <glib.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkstock.h>
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-stock-icons.h>
-
-#include "e-dropdown-button.h"
-
-
-/* (The following is shameless stolen from `testgnome.c'. */
-
-static void
-item_activated (GtkWidget *widget,
- void *data)
-{
- printf ("%s activated.\n", (char *) data);
-}
-
-static GnomeUIInfo ui_info[] = {
- { GNOME_APP_UI_ITEM, "_New", "Create a new file", item_activated, "file/new", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW, 'n', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "_Open...", "Open an existing file", item_activated, "file/open", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN, 'o', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "_Save", "Save the current file", item_activated, "file/save", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 's', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "Save _as...", "Save the current file with a new name", item_activated, "file/save as", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE_AS, 0, 0, NULL },
-
- GNOMEUIINFO_SEPARATOR,
-
- { GNOME_APP_UI_ITEM, "_Print...", "Print the current file", item_activated, "file/print", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PRINT, 'p', GDK_CONTROL_MASK, NULL },
-
- GNOMEUIINFO_SEPARATOR,
-
- { GNOME_APP_UI_ITEM, "_Close", "Close the current file", item_activated, "file/close", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE, 0, 0, NULL },
- { GNOME_APP_UI_ITEM, "E_xit", "Exit the program", item_activated, "file/exit", NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 'q', GDK_CONTROL_MASK, NULL },
- GNOMEUIINFO_END
-};
-
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window;
- GtkWidget *menu;
- GtkWidget *dropdown_button;
-
- gnome_init ("test-dropdown-button", "0.0", argc, argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 1, 1);
-
- menu = gtk_menu_new ();
-
- gnome_app_fill_menu (GTK_MENU_SHELL (menu), ui_info, NULL, TRUE, 0);
-
- dropdown_button = e_dropdown_button_new ("Me_nu", GTK_MENU (menu));
- gtk_container_add (GTK_CONTAINER (window), dropdown_button);
-
- gtk_widget_show (window);
- gtk_widget_show (dropdown_button);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/misc/test-multi-config-dialog.c b/widgets/misc/test-multi-config-dialog.c
deleted file mode 100644
index 1a56af9a30..0000000000
--- a/widgets/misc/test-multi-config-dialog.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* test-multi-config-dialog.c
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- */
-
-#include "e-multi-config-dialog.c"
-
-#include <gnome.h>
-
-
-#define NUM_PAGES 10
-
-
-static void
-add_pages (EMultiConfigDialog *multi_config_dialog)
-{
- int i;
-
- for (i = 0; i < NUM_PAGES; i ++) {
- GtkWidget *widget;
- GtkWidget *page;
- char *string;
- char *title;
- char *description;
-
- string = g_strdup_printf ("This is page %d", i);
- description = g_strdup_printf ("Description of page %d", i);
- title = g_strdup_printf ("Title of page %d", i);
-
- widget = gtk_label_new (string);
- gtk_widget_show (widget);
-
- page = e_config_page_new ();
- gtk_container_add (GTK_CONTAINER (page), widget);
-
- e_multi_config_dialog_add_page (multi_config_dialog, title, description, NULL,
- E_CONFIG_PAGE (page));
-
- g_free (string);
- g_free (title);
- g_free (description);
- }
-}
-
-static int
-delete_event_callback (GtkWidget *widget,
- GdkEventAny *event,
- void *data)
-{
- gtk_main_quit ();
-
- return TRUE;
-}
-
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *dialog;
-
- gnome_init ("test-multi-config-dialog", "0.0", argc, argv);
-
- dialog = e_multi_config_dialog_new ();
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
- g_signal_connect((dialog), "delete_event",
- G_CALLBACK (delete_event_callback), NULL);
-
- add_pages (E_MULTI_CONFIG_DIALOG (dialog));
-
- gtk_widget_show (dialog);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/misc/test-title-bar.c b/widgets/misc/test-title-bar.c
deleted file mode 100644
index 80944f5b01..0000000000
--- a/widgets/misc/test-title-bar.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-title-bar.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkbox.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include "e-title-bar.h"
-
-static void
-delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data)
-{
- gtk_main_quit ();
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *app;
- GtkWidget *title_bar;
- GtkWidget *label;
- GtkWidget *vbox;
-
- gnome_init ("test-title-bar", "0.0", argc, argv);
-
- app = gnome_app_new ("Test", "Test");
- gtk_window_set_default_size (GTK_WINDOW (app), 400, 400);
- gtk_window_set_policy (GTK_WINDOW (app), FALSE, TRUE, FALSE);
-
- g_signal_connect((app), "delete_event", G_CALLBACK (delete_event_cb), NULL);
-
- title_bar = e_title_bar_new ("This is a very annoyingly long title bar");
- gtk_widget_show (title_bar);
-
- label = gtk_label_new ("boo");
- gtk_widget_show (label);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), title_bar, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- gnome_app_set_contents (GNOME_APP (app), vbox);
- gtk_widget_show (app);
-
- gtk_main ();
-
- return 0;
-}