diff options
37 files changed, 147 insertions, 1874 deletions
diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c deleted file mode 100644 index f0faf7899c..0000000000 --- a/addressbook/gui/widgets/test-reflow.c +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Author: Chris Lahey <clahey@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"TITLE:Head Geek -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@ximian.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - - -#include "config.h" - -#include <gtk/gtk.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <libgnomeui/gnome-init.h> -#include <misc/e-canvas.h> -#include <misc/e-reflow.h> -#include <misc/e-scroll-frame.h> - -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollframe; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - g_signal_connect( canvas, "reflow", - G_CALLBACK ( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - ECard *card = e_card_new (TEST_VCARD); - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - "card", card, - NULL); - e_reflow_add_item(E_REFLOW(reflow), item, NULL); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), - gtk_layout_get_vadjustment(GTK_LAYOUT(canvas))); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - - gtk_container_add (GTK_CONTAINER (scrollframe), canvas); - - gnome_app_set_contents( GNOME_APP( app ), scrollframe ); - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - g_signal_connect( canvas, "size_allocate", - G_CALLBACK ( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index ee09c0dde4..7f54b6bf2d 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -26,9 +26,6 @@ #include <stdio.h> #include <string.h> #include <glib/gi18n.h> -#if 0 -# include <libgnomeui/gnome-winhints.h> -#endif #include <glade/glade.h> #include <libedataserver/e-time-utils.h> #include <libecal/e-cal-time-util.h> diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 531cc115cd..0328743a77 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -55,10 +55,6 @@ #include "e-util/e-popup.h" #include "e-util/e-error.h" -#if !GTK_CHECK_VERSION(2,16,0) -#define gtk_status_icon_set_tooltip_text gtk_status_icon_set_tooltip -#endif - #define d(x) /* The dialog with alarm nofications */ diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in index 98e31ac775..6e5e057c14 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in @@ -550,6 +550,18 @@ </locale> </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/month_scroll_by_week</key> + <applyto>/apps/evolution/calendar/display/month_scroll_by_week</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Scroll Month View by a week</short> + <long>Whether to scroll a Month View by a week, not by a month.</long> + </locale> + </schema> + <!-- Date navigator --> <schema> diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h index 15edb32c8e..4e7ec7c254 100644 --- a/calendar/gui/calendar-config-keys.h +++ b/calendar/gui/calendar-config-keys.h @@ -38,7 +38,7 @@ G_BEGIN_DECLS #define CALENDAR_CONFIG_DAY_END_HOUR CALENDAR_CONFIG_PREFIX "/display/day_end_hour" #define CALENDAR_CONFIG_DAY_END_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_end_minute" #define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions" -#define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions" +#define CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK CALENDAR_CONFIG_PREFIX "/display/month_scroll_by_week" #define CALENDAR_CONFIG_MARCUS_BAINS_LINE CALENDAR_CONFIG_PREFIX "/display/marcus_bains_line" #define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_dayview" #define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_timebar" diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 3f62cd9e9f..11c3c8f33d 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -437,6 +437,35 @@ calendar_config_add_notification_time_divisions (GConfClientNotifyFunc func, gpo return id; } +/* Scroll in a month view by a week, not by a month */ +gboolean +calendar_config_get_month_scroll_by_week (void) +{ + calendar_config_init (); + + return gconf_client_get_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, NULL); +} + +void +calendar_config_set_month_scroll_by_week (gboolean value) +{ + calendar_config_init (); + + gconf_client_set_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, value, NULL); +} + +guint +calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data) +{ + guint id; + + calendar_config_init (); + + id = gconf_client_notify_add (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, func, data, NULL, NULL); + + return id; +} + /* Whether we show the Marcus Bains Line (current time), and in what colors. */ void calendar_config_get_marcus_bains (gboolean *show_line, const char **dayview_color, const char **timebar_color) diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 97e4fe13d7..09a9a7d53b 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -247,15 +247,9 @@ guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc gboolean calendar_config_get_ba_reminder (int *interval, CalUnits *units); void calendar_config_set_ba_reminder (gboolean *enabled, int *interval, CalUnits *units); -GSList *calendar_config_get_day_second_zones (void); -void calendar_config_free_day_second_zones (GSList *zones); -void calendar_config_set_day_second_zone (const char *location); -char * calendar_config_get_day_second_zone (void); -void calendar_config_select_day_second_zone (void); -guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, gpointer data); - -/* Birthdays & Anniversaries reminder settings */ -gboolean calendar_config_get_ba_reminder (int *interval, CalUnits *units); -void calendar_config_set_ba_reminder (gboolean *enabled, int *interval, CalUnits *units); +/* Scroll in a month view by a week, not by a month */ +gboolean calendar_config_get_month_scroll_by_week (void); +void calendar_config_set_month_scroll_by_week (gboolean value); +guint calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data); #endif /* _CALENDAR_CONFIG_H_ */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 6d50a406b3..cdef86eb5a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -326,6 +326,12 @@ dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) } static void +month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle)); +} + +static void hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { gboolean hide; @@ -521,6 +527,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->compress_weekend), "toggled", G_CALLBACK (compress_weekend_toggled), prefs); g_signal_connect (G_OBJECT (prefs->dnav_show_week_no), "toggled", G_CALLBACK (dnav_show_week_no_toggled), prefs); g_signal_connect (G_OBJECT (prefs->dview_show_week_no), "toggled", G_CALLBACK (dview_show_week_no_toggled), prefs); + g_signal_connect (G_OBJECT (prefs->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", G_CALLBACK (hide_completed_tasks_toggled), prefs); @@ -695,6 +702,9 @@ show_config (CalendarPrefsDialog *prefs) /* Day/Work Week view - Show Week Number. */ e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ()); + /* Month View - Scroll by a week */ + e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ()); + /* Task list */ show_task_list_config (prefs); @@ -825,6 +835,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, prefs->compress_weekend = glade_xml_get_widget (gui, "compress_weekend"); prefs->dnav_show_week_no = glade_xml_get_widget (gui, "dnav_show_week_no"); prefs->dview_show_week_no = glade_xml_get_widget (gui, "dview_show_week_no"); + prefs->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week"); prefs->tasks_due_today_color = glade_xml_get_widget (gui, "tasks_due_today_color"); prefs->tasks_overdue_color = glade_xml_get_widget (gui, "tasks_overdue_color"); prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 867abdbb22..a279ad1107 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1368,6 +1368,25 @@ Days</property> <property name="fill">False</property> </packing> </child> + + <child> + <widget class="GtkCheckButton" id="month_scroll_by_week"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Sc_roll Month View by a week</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 84c1873e9a..ba1bf607ea 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -85,6 +85,7 @@ struct _CalendarPrefsDialog { GtkWidget *compress_weekend; GtkWidget *dnav_show_week_no; GtkWidget *dview_show_week_no; + GtkWidget *month_scroll_by_week; GtkWidget *tasks_due_today_color; GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 724206a072..b182f9cc78 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -31,7 +31,6 @@ #include <libedataserver/e-source.h> #include <libedataserver/e-source-list.h> #include <glib/gi18n.h> -#include <libgnomeui/libgnomeui.h> #include <libecal/e-cal.h> #include "calendar-setup.h" #include "../e-cal-config.h" diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 6eecb856b0..a4320273ac 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -34,7 +34,9 @@ #include <unistd.h> #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <widgets/misc/e-gui-utils.h> +#include <gtk/gtk.h> +#include <gdk/gdkkeysyms.h> +#include <misc/e-gui-utils.h> #include <table/e-cell-checkbox.h> #include <table/e-cell-toggle.h> #include <table/e-cell-text.h> diff --git a/calendar/gui/e-comp-editor-registry.c b/calendar/gui/e-comp-editor-registry.c index 9855d12462..31b46372b2 100644 --- a/calendar/gui/e-comp-editor-registry.c +++ b/calendar/gui/e-comp-editor-registry.c @@ -24,7 +24,6 @@ #include <config.h> #endif -#include <gnome.h> #include "e-comp-editor-registry.h" struct _ECompEditorRegistryPrivate { diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 53955c5bbe..2120d024d0 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -505,6 +505,8 @@ e_week_view_init (EWeekView *week_view) week_view->spans = NULL; week_view->multi_week_view = FALSE; + week_view->month_scroll_by_week = FALSE; + week_view->scroll_by_week_notif_id = 0; week_view->update_base_date = TRUE; week_view->weeks_shown = 6; week_view->rows = 6; @@ -704,6 +706,11 @@ e_week_view_destroy (GtkObject *object) week_view->resize_width_cursor = NULL; } + if (week_view->scroll_by_week_notif_id) { + calendar_config_remove_notification (week_view->scroll_by_week_notif_id); + week_view->scroll_by_week_notif_id = 0; + } + GTK_OBJECT_CLASS (e_week_view_parent_class)->destroy (object); } @@ -1644,6 +1651,19 @@ e_week_view_recalc_day_starts (EWeekView *week_view, } } +static void +month_scrol_by_week_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) +{ + EWeekView *week_view = user_data; + + g_return_if_fail (week_view != NULL); + g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + + if (week_view->multi_week_view && week_view->month_scroll_by_week != calendar_config_get_month_scroll_by_week ()) { + week_view->multi_week_view = FALSE; + e_week_view_set_multi_week_view (week_view, TRUE); + } +} gboolean e_week_view_get_multi_week_view (EWeekView *week_view) @@ -1670,11 +1690,26 @@ e_week_view_set_multi_week_view (EWeekView *week_view, if (multi_week_view) { gtk_widget_show (week_view->titles_canvas); - page_increment = 4; - page_size = 5; + week_view->month_scroll_by_week = calendar_config_get_month_scroll_by_week (); + + if (!week_view->scroll_by_week_notif_id) + week_view->scroll_by_week_notif_id = calendar_config_add_notification_month_scroll_by_week (month_scrol_by_week_changed_cb, week_view); + + if (week_view->month_scroll_by_week) { + page_increment = 1; + page_size = 1; + } else { + page_increment = 4; + page_size = 5; + } } else { gtk_widget_hide (week_view->titles_canvas); page_increment = page_size = 1; + + if (week_view->scroll_by_week_notif_id) { + calendar_config_remove_notification (week_view->scroll_by_week_notif_id); + week_view->scroll_by_week_notif_id = 0; + } } adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment; @@ -1732,8 +1767,13 @@ e_week_view_set_weeks_shown (EWeekView *week_view, week_view->weeks_shown = weeks_shown; if (week_view->multi_week_view) { - page_increment = 4; - page_size = 5; + if (week_view->month_scroll_by_week) { + page_increment = 1; + page_size = 1; + } else { + page_increment = 4; + page_size = 5; + } adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment; adjustment->page_increment = page_increment; diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index 132857c712..2458efcdd1 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -203,6 +203,10 @@ struct _EWeekView one week is shown, with a different layout. */ gboolean multi_week_view; + /* TRUE when requires scrolling by a week in a multi_week_view */ + gboolean month_scroll_by_week; + guint scroll_by_week_notif_id; + gboolean update_base_date; /* How many weeks we are showing. This is only relevant if diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 7e685dcf91..2217cd5b0e 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -628,7 +628,7 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_ /* FIXME We should be using the same day of the week enum every where */ display_start = (E_WEEK_VIEW (priv->views[view_type])->display_start_day + 1) % 7; - if (!priv->range_selected) + if (!priv->range_selected && (!E_WEEK_VIEW (priv->views[view_type])->multi_week_view || !E_WEEK_VIEW (priv->views[view_type])->month_scroll_by_week)) *start_time = time_month_begin_with_zone (*start_time, priv->zone); *start_time = time_week_begin_with_zone (*start_time, display_start, priv->zone); *end_time = time_add_week_with_zone (*start_time, shown, priv->zone); diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui index 6522679398..2d5b7acef6 100644 --- a/composer/evolution-composer.ui +++ b/composer/evolution-composer.ui @@ -14,6 +14,9 @@ <placeholder name='external-editor-holder'/> <separator/> <separator/> + <placeholder name='external-editor-holder'/> + <separator/> + <separator/> <menuitem action='print-preview'/> <menuitem action='print'/> <separator/> diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index 400dd85898..5d4a911c9a 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -31,7 +31,8 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <libgnomeui/libgnomeui.h> +#include <libgnomeui/gnome-druid.h> +#include <libgnomeui/gnome-druid-page-standard.h> #include "shell/es-menu.h" #include "mail/em-config.h" #include "mail/em-account-editor.h" diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c index 39ed4de4a9..99d7f8d41f 100644 --- a/plugins/backup-restore/backup.c +++ b/plugins/backup-restore/backup.c @@ -29,7 +29,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libgnome/gnome-util.h> #include <libebook/e-book.h> #include <libecal/e-cal.h> @@ -439,6 +438,8 @@ main (int argc, char **argv) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); + g_thread_init (NULL); + gtk_init_with_args ( &argc, &argv, NULL, options, GETTEXT_PACKAGE, &error); if (error != NULL) { diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index 35e3ae6c68..2f60b34bff 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -26,9 +26,9 @@ #include <string.h> #include <glib.h> -#include <gnome.h> #include <gtk/gtk.h> -#include <libgnomeui/libgnomeui.h> +#include <libgnomeui/gnome-druid.h> +#include <libgnomeui/gnome-druid-page-edge.h> #include <glib/gi18n.h> #include <gconf/gconf-client.h> #include <e-util/e-config.h> diff --git a/plugins/groupwise-features/junk-settings.c b/plugins/groupwise-features/junk-settings.c index 460883a61a..bff2abc35a 100644 --- a/plugins/groupwise-features/junk-settings.c +++ b/plugins/groupwise-features/junk-settings.c @@ -26,8 +26,6 @@ #include <glade/glade.h> #include "junk-settings.h" #include <gtk/gtk.h> -#include <libgnomeui/gnome-ui-init.h> -#include <libgnome/gnome-init.h> #include <glib/gi18n.h> #include <e-util/e-error.h> #include <e-util/e-util-private.h> diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index a7eed9b963..8bf212ee24 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -31,8 +31,6 @@ #include <libedataserverui/e-contact-store.h> -#include <libgnomeui/gnome-ui-init.h> -#include <libgnome/gnome-init.h> #include <e-util/e-error.h> #include <e-util/e-util-private.h> #include <e-gw-container.h> diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index cdea5a7265..0b811d0787 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -48,7 +48,6 @@ #include <e-gw-container.h> #include <e-gw-connection.h> #include <glade/glade.h> -#include <libgnomeui/libgnomeui.h> #include "share-folder.h" #define d(x) diff --git a/plugins/groupwise-features/share-folder.c b/plugins/groupwise-features/share-folder.c index 87d6564f0e..d16c205758 100644 --- a/plugins/groupwise-features/share-folder.c +++ b/plugins/groupwise-features/share-folder.c @@ -27,8 +27,6 @@ #include "share-folder.h" #include <glib/gi18n-lib.h> #include <libedataserverui/e-contact-store.h> -#include <libgnomeui/gnome-ui-init.h> -#include <libgnome/gnome-init.h> #include <e-util/e-error.h> #include <e-util/e-util-private.h> #include <e-gw-container.h> diff --git a/plugins/ipod-sync/sync.c b/plugins/ipod-sync/sync.c index 1da7ecd983..a444af1bd9 100644 --- a/plugins/ipod-sync/sync.c +++ b/plugins/ipod-sync/sync.c @@ -20,8 +20,9 @@ #include "config.h" #include "evolution-ipod-sync.h" -#include <gnome.h> +#include <gtk/gtk.h> +#include <glib/gi18n-lib.h> #include <libebook/e-book.h> #include <libebook/e-contact.h> #include <libecal/e-cal.h> diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 89f9daaccb..5bb65cef18 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -29,7 +29,7 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> #include <gconf/gconf-client.h> -#include <libgnome/libgnome.h> +#include <libgnome/gnome-sound.h> #ifdef HAVE_DBUS #include <dbus/dbus-glib.h> @@ -54,10 +54,6 @@ #define GCONF_KEY_ENABLED_STATUS GCONF_KEY_ROOT "status-enabled" #define GCONF_KEY_ENABLED_SOUND GCONF_KEY_ROOT "sound-enabled" -#if !GTK_CHECK_VERSION(2,16,0) -#define gtk_status_icon_set_tooltip_text gtk_status_icon_set_tooltip -#endif - static gboolean enabled = FALSE; static GtkWidget *get_cfg_widget (void); static GStaticMutex mlock = G_STATIC_MUTEX_INIT; diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c index 6289a63489..34d5961d4b 100644 --- a/plugins/startup-wizard/startup-wizard.c +++ b/plugins/startup-wizard/startup-wizard.c @@ -20,10 +20,13 @@ * */ +#include <unistd.h> #include <gconf/gconf-client.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libgnomeui/libgnomeui.h> +#include <libgnomeui/gnome-druid.h> +#include <libgnomeui/gnome-druid-page-edge.h> +#include <libgnomeui/gnome-druid-page-standard.h> #include "e-util/e-error.h" #include "e-util/e-import.h" #include "shell/es-event.h" diff --git a/widgets/misc/test-charset-picker.c b/widgets/misc/test-charset-picker.c deleted file mode 100644 index 5b49e2d0f7..0000000000 --- a/widgets/misc/test-charset-picker.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#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-error.c b/widgets/misc/test-error.c index 84abd76ce3..c8b442b23a 100644 --- a/widgets/misc/test-error.c +++ b/widgets/misc/test-error.c @@ -25,14 +25,12 @@ #include <config.h> #endif -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-ui-init.h> #include "e-error.h" int main (int argc, char **argv) { - gnome_init ("test-error", "0.0", argc, argv); + gtk_init (&argc, &argv); argc--; switch (argc) { diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 592cd1eee5..c342c6ca7e 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -22,9 +22,8 @@ #include <config.h> -#include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include <libgnome/libgnome.h> +#include <gdk/gdkkeysyms.h> #include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "text/e-text.h" diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c deleted file mode 100644 index 817785076e..0000000000 --- a/widgets/table/e-table-size-test.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include "gal/e-util/e-cursors.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-checkbox.h" -#include "e-table.h" - -#include "table-test.h" - -/* - * One way in which we make it simpler to build an ETableModel is through - * the ETableSimple class. Instead of creating your own ETableModel - * class, you simply create a new object of the ETableSimple class. You - * give it a bunch of functions that act as callbacks. - * - * You also get to pass a void * to ETableSimple and it gets passed to - * your callbacks. This would be for having multiple models of the same - * type. This is just an example though, so we statically define all the - * data and ignore the void *data parameter. - * - * In our example we will be creating a table model with 6 columns and 10 - * rows. This corresponds to having 6 different types of information and - * 10 different sets of data in our database. - * - * The headers will be hard coded, as will be the example data. - * - */ - -/* - * There are two different meanings to the word "column". The first is - * the model column. A model column corresponds to a specific type of - * data. This is very much like the usage in a database table where a - * column is a field in the database. - * - * The second type of column is a view column. A view column - * corresponds to a visually displayed column. Each view column - * corresponds to a specific model column, though a model column may - * have any number of view columns associated with it, from zero to - * greater than one. - * - * Also, a view column doesn't necessarily depend on only one model - * column. In some cases, the view column renderer can be given a - * reference to another column to get extra information about its - * display. -*/ - -#define ROWS 5000 -#define COLS 4 - -#define IMPORTANCE_COLUMN 4 -#define COLOR_COLUMN 5 - -/* - * Here we define the initial layout of the table. This is an xml - * format that allows you to change the initial ordering of the - * columns or to do sorting or grouping initially. This specification - * shows all 5 columns, but moves the importance column nearer to the - * front. It also sorts by the "Full Name" column (ascending.) - * Sorting and grouping take the model column as their arguments - * (sorting is specified by the "column" argument to the leaf elemnt. - */ - -#define INITIAL_SPEC "<ETableSpecification> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 4 </column> \ - <column> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \ -</ETableSpecification>" - -char *headers [COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -/* - * Virtual Column list: - * 0 Email - * 1 Full Name - * 2 Address - * 3 Phone - */ - -/* - * ETableSimple callbacks - * These are the callbacks that define the behavior of our custom model. - */ - -/* - * Since our model is a constant size, we can just return its size in - * the column and row count fields. - */ - -/* This function returns the number of columns in our ETableModel. */ -static int -my_col_count (ETableModel *etc, void *data) -{ - return COLS; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -my_row_count (ETableModel *etc, void *data) -{ - return ROWS; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -my_value_at (ETableModel *etc, int col, int row, void *data) -{ - static guchar t[] = {'A', 0xc3, 0x84, 0xc3, 0x95, 0xc3, 0x94, 0xc3, 0xb5, 0x00}; - -#if 0 - if (col == 1) return "toshok@ximian.com"; -#else - if (col == 1) return t; -#endif - else if (col == 2) return "Chris Toshok"; - else if (col == 3) return "43 Vicksburg, SF"; - else if (col == 4) return "415-867-5309"; - else return NULL; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -my_is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return FALSE; -} - -/* This function duplicates the value passed to it. */ -static void * -my_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup (value); -} - -/* This function frees the value passed to it. */ -static void -my_free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free (value); -} - -/* This function creates an empty value. */ -static void * -my_initialize_value (ETableModel *etc, int col, void *data) -{ - return g_strdup (""); -} - -/* This function reports if a value is empty. */ -static gboolean -my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - return !(value && *(char *)value); -} - -/* This function reports if a value is empty. */ -static char * -my_value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -/* We create a window containing our new table. */ -static void -create_table (void) -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ETableHeader *e_table_header; - ETableModel *e_table_model = NULL; - int i; - - /* Next we create our model. This uses the functions we defined - earlier. */ - e_table_model = e_table_simple_new ( - my_col_count, my_row_count, my_value_at, - my_set_value_at, my_is_cell_editable, - my_duplicate_value, my_free_value, - my_initialize_value, my_value_is_empty, - my_value_to_string, - NULL); - /* - * Next we create a header. The ETableHeader is used in two - * different way. The first is the full_header. This is the - * list of possible columns in the view. The second use is - * completely internal. Many of the ETableHeader functions are - * for that purpose. The only functions we really need are - * e_table_header_new and e_table_header_add_col. - * - * First we create the header. - */ - e_table_header = e_table_header_new (); - - /* - * Next we have to build renderers for all of the columns. - * Since all our columns are text columns, we can simply use - * the same renderer over and over again. If we had different - * types of columns, we could use a different renderer for - * each column. - */ - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - /* - * Next we create a column object for each view column and add - * them to the header. We don't create a column object for - * the importance column since it will not be shown. - */ - for (i = 0; i < COLS; i++) { - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 1.0, 20, cell_left_just, - e_str_compare, TRUE); - /* Add it to the header. */ - e_table_header_add_column (e_table_header, ecol, i); - } - - /* - * Here we create a window for our new table. This window - * will get shown and the person will be able to test their - * item. - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - /* This frame is simply to get a bevel around our table. */ - frame = gtk_frame_new (NULL); - - /* - * Here we create the table. We give it the three pieces of - * the table we've created, the header, the model, and the - * initial layout. It does the rest. - */ - e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC); - - /* Build the gtk widget hierarchy. */ - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - /* Size the initial window. */ - gtk_widget_set_size_request (window, 300, 200); - - /* Show it all. */ - gtk_widget_show_all (window); -} - -/* This is the main function which just initializes gnome and call our create_table function */ - -int -main (int argc, char *argv []) -{ - gnome_init ("TableExample", "TableExample", argc, argv); - e_cursors_init (); - - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); - - create_table (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} - diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c deleted file mode 100644 index 3f42c86743..0000000000 --- a/widgets/table/table-test.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza <miguel@gnu.org> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> -#include <fcntl.h> - -#include <gnome.h> - -#include "misc/e-cursors.h" - -#include "table-test.h" - -int -main (int argc, char *argv []) -{ - - if (isatty (0)){ - int fd; - - close (0); - fd = open ("sample.table", O_RDONLY); - if (fd == -1){ - fprintf (stderr, "Could not find sample.table, try feeding a table on stdin"); - exit (1); - } - dup2 (fd, 0); - } - - gnome_init ("TableTest", "TableTest", argc, argv); - e_cursors_init (); - - -/* table_browser_test (); */ -/* multi_cols_test (); */ -/* check_test (); */ - - e_table_test (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c deleted file mode 100644 index 86561d3362..0000000000 --- a/widgets/table/test-check.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> - -#include <gnome.h> - -#include "misc/e-cursors.h" -#include "misc/e-canvas-utils.h" -#include "misc/e-canvas.h" -#include "e-util/e-util.h" - -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-checkbox.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "Buy food" }, - { 1, "Breathe " }, - { 0, "Cancel gdb session with shrink" }, - { 1, "Make screenshots" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) { - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) { - return (void *) value; - } else { - return g_strdup (value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0) { - g_free (value); - } -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return NULL; - else - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -check_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header; - ETableCol *col_0, *col_1; - ECell *cell_left_just, *cell_image_check; - GdkPixbuf *pixbuf; - GnomeCanvasItem *item; - - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); - - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - cell_image_check = e_cell_checkbox_new (); - pixbuf = gdk_pixbuf_new_from_file ("clip.png"); - col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 0.0, 18, cell_image_check, e_int_compare, TRUE); - g_object_unref (pixbuf); - e_table_header_add_column (e_table_header, col_0, 0); - - col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, e_str_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 1); - e_table_col_set_arrow (col_1, E_TABLE_COL_ARROW_DOWN); - - /* - * GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - g_signal_connect (canvas, "size_allocate", - G_CALLBACK (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - "cursor_mode", E_TABLE_CURSOR_SIMPLE, - NULL); - e_canvas_item_move_absolute (item, 0, 30); -} - diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c deleted file mode 100644 index 7c3ac25705..0000000000 --- a/widgets/table/test-cols.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> - -#include <gnome.h> - -#include "misc/e-canvas-utils.h" -#include "misc/e-canvas.h" -#include "misc/e-cursors.h" -#include "e-util/e-util.h" - -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-toggle.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "You are not" }, - { 1, "A beautiful and unique " }, - { 0, "Snowflake" }, - { 2, "You are not your wallet" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0){ - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *)value; - } else { - return g_strdup (value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free (value); - } -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return NULL; - else - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -multi_cols_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header, *e_table_header_multiple; - ETableCol *col_0, *col_1; - ECell *cell_left_just, *cell_image_toggle; - GnomeCanvasItem *item; - - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); - - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - { - GdkPixbuf **images = g_new (GdkPixbuf *, 3); - int i; - - images [0] = gdk_pixbuf_new_from_file ("image1.png"); - images [1] = gdk_pixbuf_new_from_file ("image2.png"); - images [2] = gdk_pixbuf_new_from_file ("image3.png"); - - cell_image_toggle = e_cell_toggle_new (0, 3, images); - - for (i = 0; i < 3; i++) - g_object_unref (images [i]); - - g_free (images); - } - - col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, e_str_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 0); - - col_0 = e_table_col_new (0, "A", 0.0, 48, cell_image_toggle, e_int_compare, TRUE); - e_table_header_add_column (e_table_header, col_0, 1); - - /* - * Second test - */ - e_table_header_multiple = e_table_header_new (); - e_table_header_add_column (e_table_header_multiple, col_0, 0); - e_table_header_add_column (e_table_header_multiple, col_1, 1); - e_table_header_add_column (e_table_header_multiple, col_1, 2); - - /* - * GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - g_signal_connect (canvas, "size_allocate", - G_CALLBACK (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "cursor_mode", E_TABLE_CURSOR_SIMPLE, -#if 0 - "spreadsheet", TRUE, -#endif - NULL); - - e_canvas_item_move_absolute (item, 0, 30); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header_multiple, - NULL); - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header_multiple, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - "cursor_mode", E_TABLE_CURSOR_SIMPLE, - NULL); - e_canvas_item_move_absolute (item, 300, 30); -} - - - - - diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c deleted file mode 100644 index 5d6c99e1d3..0000000000 --- a/widgets/table/test-table.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza <miguel@gnu.org> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> - -#include <gnome.h> - -#include "misc/e-cursors.h" -#include "misc/e-canvas.h" - -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-table.h" -#include "e-table-config.h" - -#include "table-test.h" - -char buffer [1024]; -char **column_labels; -char ***table_data; -int cols = 0; -int lines = 0; -int lines_alloc = 0; - -static void -parse_headers (void) -{ - char *p, *s; - int in_value = 0, i; - - fgets (buffer, sizeof (buffer)-1, stdin); - - for (p = buffer; *p; p++){ - if (*p == ' ' || *p == '\t'){ - if (in_value){ - cols++; - in_value = 0; - } - } else - in_value = 1; - } - if (in_value) - cols++; - - if (!cols){ - fprintf (stderr, "No columns in first row\n"); - exit (1); - } - - column_labels = g_new0 (char *, cols); - - p = buffer; - for (i = 0; (s = strtok (p, " \t")) != NULL; i++){ - column_labels [i] = g_strdup (s); - if (strchr (column_labels [i], '\n')) - *strchr (column_labels [i], '\n') = 0; - p = NULL; - } - - printf ("%d headers:\n", cols); - for (i = 0; i < cols; i++){ - printf ("header %d: %s\n", i, column_labels [i]); - } -} - -static char ** -load_line (char *buffer, int cols) -{ - char **line = g_new0 (char *, cols); - char *p; - int i; - - for (i = 0; i < cols; i++){ - p = strtok (buffer, " \t\n"); - if (p == NULL){ - for (; i < cols; i++) - line [i] = g_strdup (""); - return line; - } else - line [i] = g_strdup (p); - buffer = NULL; - } - return line; -} - -static void -append_line (char **line) -{ - if (lines <= lines_alloc){ - lines_alloc = lines + 50; - table_data = g_renew (char **, table_data, lines_alloc); - } - table_data [lines] = line; - lines++; -} - -static void -load_data (void) -{ - int i; - - { - static int loaded; - - if (loaded) - return; - - loaded = TRUE; - } - - - parse_headers (); - - while (fgets (buffer, sizeof (buffer)-1, stdin) != NULL){ - char **line; - - if (buffer [0] == '\n') - continue; - line = load_line (buffer, cols); - append_line (line); - } - - for (i = 0; i < lines; i++){ - int j; - - printf ("Line %d: ", i); - for (j = 0; j < cols; j++) - printf ("[%s] ", table_data [i][j]); - printf ("\n"); - } -} - -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return cols; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return lines; -} - -static void -append_row (ETableModel *etm, ETableModel *model, int row, void *data) -{ - abort (); -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < cols); - g_assert (row < lines); - - fprintf (stderr, "value_at[%d,%d]\n", col, row); - - return (void *) table_data [row][col]; -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < cols); - g_assert (row < lines); - - g_free (table_data [row][col]); - table_data [row][col] = g_strdup (val); - - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static gboolean -has_save_id (ETableModel *etm, void *data) -{ - return FALSE; -} - -static char * -get_save_id (ETableModel *etm, int row, void *data) -{ - abort (); -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup (value); -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free (value); -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -#ifdef BIT_ROT -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -table_browser_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header; - ECell *cell_left_just; - GnomeCanvasItem *group; - int i; - int priority = 20; - - load_data (); - - /* - * Data model - */ - e_table_model = e_table_simple_new ( - col_count, row_count, append_row, - - value_at, set_value_at, is_cell_editable, - - has_save_id, get_save_id, - - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - cell_left_just = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 1.0, 20, cell_left_just, - e_str_compare, TRUE, - priority); - - e_table_header_add_column (e_table_header, ecol, i); - } - - /* - * Setup GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - g_signal_connect (canvas, "size_allocate", - G_CALLBACK (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - group = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - gnome_canvas_group_get_type (), - "x", 30.0, - "y", 30.0, - NULL); - - gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (group), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - NULL); -} -#endif - -static void -save_spec (GtkWidget *button, ETable *e_table) -{ -#ifdef BIT_ROT - e_table_save_specification (e_table, "e-table-test.xml"); -#endif -} - -#ifdef BIT_ROT -static void -row_selection_test (ETable *table, int row, gboolean selected) -{ - if (selected) - g_print ("Row %d selected\n", row); - else - g_print ("Row %d unselected\n", row); -} -#endif - -static void -toggle_grid (void *nothing, ETable *etable) -{ - static gboolean shown; - - g_object_get (etable, "drawgrid", &shown, NULL); - g_object_set (etable, "drawgrid", !shown, NULL); -} - -static void -do_e_table_demo (const char *state) -{ - GtkWidget *e_table, *window, *frame, *vbox, *button, *bhide; - ECell *cell_left_just; - ETableHeader *full_header; - int i; - GString *spec; - - /* - * Data model - */ - static ETableModel *e_table_model = NULL; - - if (e_table_model == NULL) - e_table_model = - e_table_simple_new (col_count, row_count, append_row, - value_at, set_value_at, is_cell_editable, - has_save_id, get_save_id, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - full_header = e_table_header_new (); - cell_left_just = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - - spec = g_string_new ("\ -<ETableSpecification \ -cursor-mode=\"line\" \ -selection-mode=\"browse\" \ -draw-focus=\"true\">"); - for (i = 0; i < cols; i++) { - char *colspec = - g_strdup_printf ("\ - <ETableColumn model_col=\"%d\" \ -_title=\"%s\" \ -minimum_width=\"20\" \ -resizable=\"true\" \ -cell=\"string\" \ -compare=\"string\"/>\n", i, column_labels[i]); - g_string_append (spec, colspec); - g_free (colspec); - } - g_string_append (spec, "</ETableSpecification>"); - e_table = e_table_new (e_table_model, NULL, spec->str, state); - - /* This makes value_at not called just to determine row height. */ - g_object_set (e_table, - "uniform_row_height", 1, - NULL); - - g_string_free (spec, TRUE); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - frame = gtk_frame_new (NULL); -#ifdef BIT_ROT - g_signal_connect (e_table, "row_selection", - G_CALLBACK(row_selection_test), NULL); -#endif - - vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), e_table, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (frame), vbox); - gtk_container_add (GTK_CONTAINER (window), frame); - -#if 0 - /* - * gadgets - */ - button = gtk_button_new_with_label ("Save spec"); - g_signal_connect (button, "clicked", - G_CALLBACK (save_spec), e_table); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - bhide = gtk_button_new_with_label ("Toggle Grid"); - g_signal_connect (bhide, "clicked", - G_CALLBACk (toggle_grid), e_table); - gtk_box_pack_start (GTK_BOX (vbox), bhide, FALSE, FALSE, 0); -#endif - - gtk_widget_set_size_request (window, 400, 200); - gtk_widget_show_all (window); - -#ifdef BIT_ROT - if (getenv ("TEST")){ - e_table_do_gui_config (NULL, E_TABLE(e_table)); - } -#endif -} - -void -e_table_test (void) -{ - load_data (); - - if (1){/*getenv ("DO")){*/ - do_e_table_demo ("\ -<ETableState>\n\ - <column source=\"0\"/>\n\ - <column source=\"1\"/>\n\ - <column source=\"2\"/>\n\ - <column source=\"3\"/>\n\ - <column source=\"4\"/>\n\ - <grouping></grouping>\n\ -</ETableState>"); -#if 0 - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <group column=\"4\" ascending=\"false\"> <leaf column=\"2\" ascending=\"true\"/> </group> </group> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>"); -#endif - } -} diff --git a/widgets/text/e-text-model-test.c b/widgets/text/e-text-model-test.c deleted file mode 100644 index 0f1f216cfb..0000000000 --- a/widgets/text/e-text-model-test.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <gnome.h> - -#include "e-util/e-util.h" -#include "misc/e-canvas.h" - -#include "e-text-model.h" -#include "e-text-model-uri.h" -#include "e-text.h" - -#if 0 -static void -describe_model (ETextModel *model) -{ - gint i, N; - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - N = e_text_model_object_count (model); - - g_print ("text: %s\n", e_text_model_get_text (model)); - g_print ("objs: %d\n", N); - - for (i=0; i<N; ++i) { - gchar *s = e_text_model_strdup_nth_object (model, i); - g_print ("obj%d: %s\n", i, s); - g_free (s); - } -} -#endif - -int -main (int argc, gchar **argv) -{ - GtkWidget *win[2], *canvas[2]; - GnomeCanvasItem *item[2]; - ETextModel *model; - gint i; - - gnome_init ("ETextModelTest", "0.0", argc, argv); - - model = e_text_model_uri_new (); - - e_text_model_set_text (model, "My favorite website is http://www.ximian.com. My next favorite www.assbarn.com."); - - /* describe_model (model); */ - - for (i=0; i<2; ++i) { - win[i] = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); - canvas[i] = e_canvas_new (); - gtk_widget_pop_colormap (); - - item[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas[i])), - e_text_get_type (), - "model", model, - "font", "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", - "anchor", GTK_ANCHOR_NORTH, - "line_wrap", TRUE, - "width", 150.0, - "editable", TRUE, - NULL); - - gtk_container_add (GTK_CONTAINER (win[i]), canvas[i]); - gtk_widget_show_all (win[i]); - } - - gtk_main (); - - return 0; -} diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c deleted file mode 100644 index adba386ad1..0000000000 --- a/widgets/text/e-text-test.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * e-text-test.c - E-Text item test program - * - * 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) version 3. - * - * 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 the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Iain Holmes <ih@csd.abdn.ac.uk> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright 2000: Iain Holmes <ih@csd.abdn.ac.uk> - * - */ - -#include <gnome.h> - -#include "misc/e-canvas.h" -#include "misc/e-unicode.h" - -#include "e-text.h" - -GnomeCanvasItem *rect; - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, GnomeCanvasItem *item) -{ - double height; - gnome_canvas_item_set( item, - "width", (double) allocation->width, - NULL ); - g_object_get(item, - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, height ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); -} - -static void -reflow (GtkWidget *canvas, GnomeCanvasItem *item) -{ - double height; - g_object_get(item, - "height", &height, - NULL); - height = MAX(height, canvas->allocation.height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, canvas->allocation.width, height ); - gnome_canvas_item_set( rect, - "x2", (double) canvas->allocation.width, - "y2", (double) height, - NULL ); -} - -static void -quit_cb (gpointer data, GObject *where_object_was) -{ - gtk_main_quit (); -} - -static void -change_text_cb (GtkEntry *entry, - EText *text) -{ - gchar *str; - - str = e_utf8_gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "text", str, - NULL); -} - -static void -change_font_cb (GtkEntry *entry, - EText *text) -{ - gchar *font; - - font = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "font", font, - NULL); -} - -int -main (int argc, - char **argv) -{ - GtkWidget *window, *canvas, *scroller, *vbox, *text, *font; - GtkWidget *frame; - GnomeCanvasItem *item; - - gnome_init ("ETextTest", "0.0.1", argc, argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "EText Test"); - g_object_weak_ref (G_OBJECT (window), - quit_cb, NULL); - - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); - canvas = e_canvas_new (); - gtk_widget_pop_colormap (); - scroller = gtk_scrolled_window_new (NULL, NULL); - vbox = gtk_vbox_new (FALSE, 2); - - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_box_pack_start (GTK_BOX (vbox), scroller, TRUE, TRUE, 2); - gtk_container_add (GTK_CONTAINER (scroller), canvas); - - frame = gtk_frame_new ("Text"); - text = gtk_entry_new (); - gtk_entry_set_text(GTK_ENTRY(text), "Hello World! This is a really long string to test out the ellipsis stuff."); - gtk_container_add (GTK_CONTAINER (frame), text); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - frame = gtk_frame_new ("Font"); - font = gtk_entry_new (); - gtk_entry_set_text(GTK_ENTRY(font), "fixed"); - gtk_container_add (GTK_CONTAINER (frame), font); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "text", "Hello World! This is a really long string to test out the ellipsis stuff.", - "font", "fixed", - "fill_color", "black", - "anchor", GTK_ANCHOR_NW, - "clip", TRUE, - "use_ellipsis", TRUE, - "editable", TRUE, - "line_wrap", TRUE, - "max_lines", 2, - "width", 150.0, - NULL); - - g_signal_connect (text, "activate", - G_CALLBACK (change_text_cb), item); - g_signal_connect (font, "activate", - G_CALLBACK (change_font_cb), item); - - g_signal_connect (canvas , "size_allocate", - G_CALLBACK (allocate_callback), - item ); - g_signal_connect (canvas , "reflow", - G_CALLBACK (reflow), - item ); - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0); - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} |