diff options
author | Larry Ewing <lewing@ximian.com> | 2004-06-05 10:54:15 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2004-06-05 10:54:15 +0800 |
commit | 6ade4de1835e31879ae3db39d46d5bd510162b95 (patch) | |
tree | 1f0eea2c1de899517d8b89c98f985c60a17d215d /addressbook | |
parent | 13dc2a27272b049cf2612c5742923ad3739aa2e2 (diff) | |
download | gsoc2013-evolution-6ade4de1835e31879ae3db39d46d5bd510162b95.tar.gz gsoc2013-evolution-6ade4de1835e31879ae3db39d46d5bd510162b95.tar.zst gsoc2013-evolution-6ade4de1835e31879ae3db39d46d5bd510162b95.zip |
remove bonobo menus and cruft add ok/cancel buttons.
2004-06-04 Larry Ewing <lewing@ximian.com>
* gui/contact-list-editor/e-contact-list-editor.c: remove bonobo
menus and cruft add ok/cancel buttons.
* gui/contact-list-editor/e-contact-list-editor.h: add buttons for
ok/cancel.
* gui/contact-list-editor/contact-list-editor.glade: add fields for
ok/cancel reparent to GtkDialog, other minor adjustments.
svn path=/trunk/; revision=26224
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 11 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/contact-list-editor.glade | 65 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/e-contact-list-editor.c | 184 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/e-contact-list-editor.h | 2 |
4 files changed, 83 insertions, 179 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 0bfdfb1dc3..01b7603d05 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2004-06-04 Larry Ewing <lewing@ximian.com> + + * gui/contact-list-editor/e-contact-list-editor.c: remove bonobo + menus and cruft add ok/cancel buttons. + + * gui/contact-list-editor/e-contact-list-editor.h: add buttons for + ok/cancel. + + * gui/contact-list-editor/contact-list-editor.glade: add fields for + ok/cancel reparent to GtkDialog, other minor adjustments. + 2004-06-04 JP Rosevear <jpr@novell.com> Fixes #55945 diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.glade b/addressbook/gui/contact-list-editor/contact-list-editor.glade index a1deb05bf3..5f0b8bfaf5 100644 --- a/addressbook/gui/contact-list-editor/contact-list-editor.glade +++ b/addressbook/gui/contact-list-editor/contact-list-editor.glade @@ -2,24 +2,59 @@ <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> -<requires lib="gnome"/> -<requires lib="bonobo"/> -<widget class="GnomeApp" id="contact list editor"> - <property name="title" translatable="yes">contact-list-editor</property> +<widget class="GtkDialog" id="contact list editor"> + <property name="visible">True</property> + <property name="title" translatable="yes">dialog1</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> - <property name="default_width">426</property> - <property name="default_height">304</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> - <property name="enable_layout_config">True</property> + <property name="has_separator">True</property> - <child internal-child="dock"> - <widget class="BonoboDock" id="dock1"> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> - <property name="allow_floating">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="cancel-button"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="response_id">-6</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="ok-button"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> <child> <widget class="GtkVBox" id="vbox8"> @@ -363,13 +398,13 @@ </packing> </child> </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> </child> </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> </child> </widget> diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index e2c62925b6..e5a0da68ec 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -29,10 +29,8 @@ #include <libgnomeui/gnome-window-icon.h> #include <gtk/gtkentry.h> #include <gtk/gtktogglebutton.h> +#include <gtk/gtkdialog.h> -#include <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-window.h> #include <gal/e-table/e-table-scrolled.h> #include <libgnomevfs/gnome-vfs-ops.h> @@ -63,7 +61,6 @@ static gboolean e_contact_list_editor_is_valid (EABEditor *editor); static gboolean e_contact_list_editor_is_changed (EABEditor *editor); static GtkWindow* e_contact_list_editor_get_window (EABEditor *editor); -static void create_ui (EContactListEditor *ce); static void set_editable (EContactListEditor *editor); static void command_state_changed (EContactListEditor *editor); static void extract_info(EContactListEditor *editor); @@ -76,6 +73,9 @@ static void list_image_changed_cb (GtkWidget *w, EContactListEditor *editor); static void visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor); static void source_selected (GtkWidget *source_option_menu, ESource *source, EContactListEditor *editor); +static void close_cb (GtkWidget *widget, EContactListEditor *editor); +static void save_and_close_cb (GtkWidget *widget, EContactListEditor *editor); + static gint app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data); static gboolean table_drag_drop_cb (ETable *table, int row, int col, GdkDragContext *context, gint x, gint y, guint time, EContactListEditor *editor); @@ -185,8 +185,6 @@ static void e_contact_list_editor_init (EContactListEditor *editor) { GladeXML *gui; - GtkWidget *bonobo_win; - BonoboUIContainer *container; GList *icon_list; editor->contact = NULL; @@ -219,40 +217,8 @@ e_contact_list_editor_init (EContactListEditor *editor) editor->visible_addrs_checkbutton = glade_xml_get_widget (gui, "visible-addrs-checkbutton"); editor->source_menu = glade_xml_get_widget (gui, "source-option-menu-source"); - /* Construct the app */ - bonobo_win = bonobo_window_new ("contact-list-editor", _("Contact List Editor")); - - /* FIXME: The sucking bit */ - { - GtkWidget *contents; - - contents = bonobo_dock_get_client_area (gnome_app_get_dock (GNOME_APP (editor->app))); - - if (!contents) { - g_message ("contact_list_editor_construct(): Could not get contents"); - return; - } - gtk_widget_ref (contents); - gtk_container_remove (GTK_CONTAINER (contents->parent), contents); - bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents); - gtk_widget_destroy (editor->app); - editor->app = bonobo_win; - } - - /* Build the menu and toolbar */ - - container = bonobo_window_get_ui_container (BONOBO_WINDOW (editor->app)); - - editor->uic = bonobo_ui_component_new_default (); - if (!editor->uic) { - g_message ("e_contact_list_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - bonobo_ui_component_set_container (editor->uic, - bonobo_object_corba_objref ( - BONOBO_OBJECT (container)), NULL); - - create_ui (editor); + editor->ok_button = glade_xml_get_widget (gui, "ok-button"); + editor->cancel_button = glade_xml_get_widget (gui, "cancel-button"); /* connect signals */ g_signal_connect (editor->add_button, @@ -276,6 +242,12 @@ e_contact_list_editor_init (EContactListEditor *editor) g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)), "table_drag_data_received", G_CALLBACK(table_drag_data_received_cb), editor); + g_signal_connect (editor->ok_button, + "clicked", G_CALLBACK(save_and_close_cb), editor); + g_signal_connect (editor->cancel_button, + "clicked", G_CALLBACK(close_cb), editor); + + g_signal_connect (editor->list_image, "changed", G_CALLBACK(list_image_changed_cb), editor); @@ -285,10 +257,11 @@ e_contact_list_editor_init (EContactListEditor *editor) command_state_changed (editor); /* Connect to the deletion of the dialog */ - g_signal_connect (editor->app, "delete_event", G_CALLBACK (app_delete_event_cb), editor); + gtk_dialog_set_has_separator (GTK_DIALOG (editor->app), FALSE); + /* set the icon */ icon_list = e_icon_factory_get_icon_list ("stock_contact-list"); if (icon_list) { @@ -296,6 +269,8 @@ e_contact_list_editor_init (EContactListEditor *editor) g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); g_list_free (icon_list); } + + gtk_widget_show_all (editor->app); } static void @@ -470,10 +445,8 @@ e_contact_list_editor_get_window (EABEditor *editor) } static void -file_close_cb (GtkWidget *widget, gpointer data) +close_cb (GtkWidget *widget, EContactListEditor *cle) { - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - if (!eab_editor_prompt_to_save_changes (EAB_EDITOR (cle), GTK_WINDOW (cle->app))) return; @@ -481,47 +454,8 @@ file_close_cb (GtkWidget *widget, gpointer data) } static void -file_save_cb (GtkWidget *widget, gpointer data) +save_and_close_cb (GtkWidget *widget, EContactListEditor *cle) { - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - save_contact (cle, FALSE); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - eab_contact_save(_("Save List as VCard"), cle->contact, GTK_WINDOW (cle->app)); -} - -static void -file_send_as_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - eab_send_contact(cle->contact, 0, EAB_DISPOSITION_AS_ATTACHMENT); -} - -static void -file_send_to_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - eab_send_contact(cle->contact, 0, EAB_DISPOSITION_AS_TO); -} - -static void -tb_save_and_close_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); save_contact (cle, TRUE); } @@ -542,72 +476,6 @@ list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) } static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - EContact *contact = cle->contact; - - g_object_ref (contact); - - if (eab_editor_confirm_delete (GTK_WINDOW(cle->app))) { - - extract_info (cle); - - if (!cle->is_new_list) { - gtk_widget_set_sensitive (cle->app, FALSE); - cle->in_async_call = TRUE; - - g_object_ref (cle); /* hold reference for callback */ - e_book_async_remove_contact (cle->book, contact, (EBookCallback)list_deleted_cb, cle); - } - } - - g_object_unref (contact); -} - -static -BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveClose", tb_save_and_close_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorDelete", delete_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveAs", file_save_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSendAs", file_send_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSendTo", file_send_to_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorClose", file_close_cb), - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps[] = { - E_PIXMAP ("/commands/ContactListEditorSave", "stock_save", E_ICON_SIZE_MENU), - E_PIXMAP ("/commands/ContactListEditorSaveClose", "stock_save", E_ICON_SIZE_MENU), - E_PIXMAP ("/commands/ContactListEditorSaveAs", "stock_save_as", E_ICON_SIZE_MENU), - - E_PIXMAP ("/commands/ContactListEditorDelete", "stock_delete", E_ICON_SIZE_MENU), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - E_PIXMAP ("/commands/ContactListEditorPrint", "stock_print", E_ICON_SIZE_MENU), - E_PIXMAP ("/commands/ContactListEditorPrintEnvelope", "stock_print", E_ICON_SIZE_MENU), -#endif - E_PIXMAP ("/Toolbar/ContactListEditorSaveClose", "stock_save", E_ICON_SIZE_LARGE_TOOLBAR), - E_PIXMAP ("/Toolbar/ContactListEditorDelete", "stock_delete", E_ICON_SIZE_LARGE_TOOLBAR), - E_PIXMAP ("/Toolbar/ContactListEditorPrint", "stock_print", E_ICON_SIZE_LARGE_TOOLBAR), - - E_PIXMAP_END -}; - -static void -create_ui (EContactListEditor *ce) -{ - bonobo_ui_component_add_verb_list_with_data ( - ce->uic, verbs, ce); - - bonobo_ui_util_set_ui (ce->uic, PREFIX, - EVOLUTION_UIDIR "/evolution-contact-list-editor.xml", - "evolution-contact-list-editor", NULL); - - e_pixmaps_update (ce->uic, pixmaps); -} - -static void contact_list_editor_destroy_notify (gpointer data, GObject *where_the_object_was) { @@ -987,20 +855,8 @@ command_state_changed (EContactListEditor *editor) { gboolean valid = eab_editor_is_valid (EAB_EDITOR (editor)); - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorSaveClose", - "sensitive", - editor->changed && valid && editor->editable ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorSave", - "sensitive", - editor->changed && valid && editor->editable ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorDelete", - "sensitive", - editor->editable && !editor->is_new_list ? "1" : "0", NULL); + /* FIXME set the ok button to ok */ + gtk_widget_set_sensitive (editor->ok_button, valid); } static void diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h index 601cb23fe2..26de00e6f8 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h @@ -68,6 +68,8 @@ struct _EContactListEditor GtkWidget *visible_addrs_checkbutton; GtkWidget *list_image; GtkWidget *source_menu; + GtkWidget *ok_button; + GtkWidget *cancel_button; /* Whether we are editing a new contact or an existing one */ guint is_new_list : 1; |