diff options
-rw-r--r-- | calendar/ChangeLog | 27 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 47 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.glade | 18 | ||||
-rw-r--r-- | calendar/gui/e-meeting-list-view.c | 23 | ||||
-rw-r--r-- | calendar/gui/e-meeting-list-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.c | 22 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.h | 1 | ||||
-rw-r--r-- | calendar/gui/e-select-names-editable.c | 14 | ||||
-rw-r--r-- | calendar/gui/e-select-names-renderer.c | 4 |
9 files changed, 129 insertions, 29 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 6b78a30a2d..6829698209 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,30 @@ +2003-12-24 JP Rosevear <jpr@ximian.com> + + * gui/e-select-names-renderer.c (esnr_start_editing): fix the + signal name + + * gui/dialogs/meeting-page.glade: add Add Attendee button + + * gui/dialogs/meeting-page.c (get_widgets): extract add button + (add_clicked_cb): edit the attendee after we add it + (init_widgets): listen for add clicked + (meeting_page_construct): the add button is in the glade file now + + * gui/e-select-names-editable.c (esne_start_editing): activate the + control + (e_select_names_editable_get_address): handle null dest + (e_select_names_editable_get_name): ditto + + * gui/e-meeting-store.h: add proto + + * gui/e-meeting-store.c (e_meeting_store_find_attendee_path): + create the path to a given attendee + + * gui/e-meeting-list-view.h: add proto + + * gui/e-meeting-list-view.c (e_meeting_list_view_edit): start + editing the address of a particular + 2003-12-22 Rodrigo Moya <rodrigo@ximian.com> * gui/gnome-cal.[ch] (gnome_calendar_add_event_source, diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index fe4ade9363..d8b951e263 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -74,6 +74,7 @@ struct _MeetingPagePrivate { GtkWidget *existing_organizer_table; GtkWidget *existing_organizer; GtkWidget *existing_organizer_btn; + GtkWidget *add; GtkWidget *invite; /* ListView stuff */ @@ -481,11 +482,15 @@ get_widgets (MeetingPage *mpage) priv->existing_organizer_table = GW ("existing-organizer-table"); priv->existing_organizer = GW ("existing-organizer"); priv->existing_organizer_btn = GW ("existing-organizer-button"); + + /* Buttons */ + priv->add = GW ("add-attendee"); priv->invite = GW ("invite"); #undef GW return (priv->invite + && priv->add && priv->organizer_table && priv->organizer && priv->existing_organizer_table @@ -542,6 +547,15 @@ change_clicked_cb (GtkWidget *widget, gpointer data) priv->existing = FALSE; } +static void +add_clicked_cb (GtkButton *btn, MeetingPage *mpage) +{ + EMeetingAttendee *attendee; + + attendee = e_meeting_store_add_attendee_with_defaults (mpage->priv->model); + e_meeting_list_view_edit (mpage->priv->list_view, attendee); +} + /* Function called to invite more people */ static void invite_cb (GtkWidget *widget, gpointer data) @@ -564,15 +578,17 @@ init_widgets (MeetingPage *mpage) priv = mpage->priv; /* Organizer */ - g_signal_connect((GTK_COMBO (priv->organizer)->entry), "changed", - G_CALLBACK (org_changed_cb), mpage); + g_signal_connect (GTK_COMBO (priv->organizer)->entry, "changed", + G_CALLBACK (org_changed_cb), mpage); - g_signal_connect((priv->existing_organizer_btn), "clicked", - G_CALLBACK (change_clicked_cb), mpage); + g_signal_connect (priv->existing_organizer_btn, "clicked", + G_CALLBACK (change_clicked_cb), mpage); + + /* Add attendee button */ + g_signal_connect (priv->add, "clicked", G_CALLBACK (add_clicked_cb), mpage); /* Invite button */ - g_signal_connect((priv->invite), "clicked", - G_CALLBACK (invite_cb), mpage); + g_signal_connect(priv->invite, "clicked", G_CALLBACK (invite_cb), mpage); } static void @@ -671,12 +687,6 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da return TRUE; } #endif - -static void -add_btn_clicked_cb (GtkButton *btn, MeetingPage *mpage) -{ - e_meeting_store_add_attendee_with_defaults (mpage->priv->model); -} /** * meeting_page_construct: @@ -696,21 +706,19 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems, EIterator *it; EAccount *def_account; GList *address_strings = NULL, *l; - GtkWidget *sw, *btn; + GtkWidget *sw; priv = mpage->priv; priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/meeting-page.glade", NULL, NULL); if (!priv->xml) { - g_message ("meeting_page_construct(): " - "Could not load the Glade XML file!"); + g_message (G_STRLOC ": Could not load the Glade XML file!"); return NULL; } if (!get_widgets (mpage)) { - g_message ("meeting_page_construct(): " - "Could not find all widgets in the XML file!"); + g_message (G_STRLOC ": Could not find all widgets in the XML file!"); return NULL; } @@ -758,11 +766,6 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems, g_object_ref (ems); priv->model = ems; - btn = gtk_button_new_with_label ("Add Attendee"); - g_signal_connect(btn, "clicked", G_CALLBACK (add_btn_clicked_cb), mpage); - gtk_widget_show (btn); - gtk_box_pack_start (GTK_BOX (priv->main), btn, FALSE, FALSE, 6); - priv->list_view = e_meeting_list_view_new (priv->model); #if 0 diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index 3b72c37b47..808359ed81 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -2,6 +2,7 @@ <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> +<requires lib="gnome"/> <widget class="GtkWindow" id="meeting-toplevel"> <property name="title" translatable="yes">window1</property> @@ -216,7 +217,18 @@ </child> <child> - <placeholder/> + <widget class="GtkButton" id="add-attendee"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Add A_ttendee</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> </child> <child> @@ -234,6 +246,10 @@ <property name="pack_type">GTK_PACK_END</property> </packing> </child> + + <child> + <placeholder/> + </child> </widget> </child> </widget> diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index 5613f6adea..55d73a7f80 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -304,6 +304,29 @@ e_meeting_list_view_column_set_visible (EMeetingListView *view, const gchar *col } } +void +e_meeting_list_view_edit (EMeetingListView *emlv, EMeetingAttendee *attendee) +{ + EMeetingListViewPrivate *priv; + GtkTreePath *path; + GtkTreeViewColumn *focus_col; + + priv = emlv->priv; + + g_return_if_fail (emlv != NULL); + g_return_if_fail (E_IS_MEETING_LIST_VIEW (emlv)); + g_return_if_fail (attendee != NULL); + + path = e_meeting_store_find_attendee_path (priv->store, attendee); + focus_col = gtk_tree_view_get_column (GTK_TREE_VIEW (emlv), 0); + + if (path) { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (emlv), path, focus_col, TRUE); + + gtk_tree_path_free (path); + } +} + static void process_section (EMeetingListView *view, EABDestination **cards, icalparameter_role role) { diff --git a/calendar/gui/e-meeting-list-view.h b/calendar/gui/e-meeting-list-view.h index dd539b9652..6fc433b82c 100644 --- a/calendar/gui/e-meeting-list-view.h +++ b/calendar/gui/e-meeting-list-view.h @@ -55,6 +55,8 @@ EMeetingListView *e_meeting_list_view_new (EMeetingStore *store); void e_meeting_list_view_column_set_visible (EMeetingListView *emlv, const gchar *col_name, gboolean visible); +void e_meeting_list_view_edit (EMeetingListView *emlv, EMeetingAttendee *attendee); + void e_meeting_list_view_invite_others_dialog (EMeetingListView *emlv); G_END_DECLS diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 01ac267fe1..93af7cc280 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -860,6 +860,28 @@ e_meeting_store_find_attendee_at_row (EMeetingStore *store, gint row) return g_ptr_array_index (store->priv->attendees, row); } +GtkTreePath * +e_meeting_store_find_attendee_path (EMeetingStore *store, EMeetingAttendee *attendee) +{ + GtkTreePath *path; + gint row = -1, i; + + for (i = 0; i < store->priv->attendees->len; i++) { + if (attendee == g_ptr_array_index (store->priv->attendees, i)) { + row = i; + break; + } + } + + if (row == -1) + return NULL; + + path = gtk_tree_path_new (); + gtk_tree_path_append_index (path, row); + + return path; +} + gint e_meeting_store_count_actual_attendees (EMeetingStore *store) { diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h index 8454c380b0..4bdcec40fa 100644 --- a/calendar/gui/e-meeting-store.h +++ b/calendar/gui/e-meeting-store.h @@ -86,6 +86,7 @@ void e_meeting_store_remove_all_attendees (EMeetingStore *im); EMeetingAttendee *e_meeting_store_find_attendee (EMeetingStore *im, const gchar *address, gint *row); EMeetingAttendee *e_meeting_store_find_attendee_at_row (EMeetingStore *im, gint row); +GtkTreePath *e_meeting_store_find_attendee_path (EMeetingStore *store, EMeetingAttendee *attendee); gint e_meeting_store_count_actual_attendees (EMeetingStore *im); const GPtrArray *e_meeting_store_get_attendees (EMeetingStore *im); diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c index cf2cd1d661..40b980d3ad 100644 --- a/calendar/gui/e-select-names-editable.c +++ b/calendar/gui/e-select-names-editable.c @@ -44,7 +44,11 @@ static void esne_start_editing (GtkCellEditable *cell_editable, GdkEvent *event) { ESelectNamesEditable *esne = E_SELECT_NAMES_EDITABLE (cell_editable); + BonoboControlFrame *cf; + /* Grab the focus */ + cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (cell_editable)); + bonobo_control_frame_control_activate (cf); } static void @@ -189,13 +193,14 @@ e_select_names_editable_get_address (ESelectNamesEditable *esne) { EABDestination **dest; gchar *dest_str; - gchar *result; + gchar *result = NULL; g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL); dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL); dest = eab_destination_importv (dest_str); - result = g_strdup (eab_destination_get_email (*dest)); + if (dest) + result = g_strdup (eab_destination_get_email (*dest)); eab_destination_freev (dest); return result; @@ -206,13 +211,14 @@ e_select_names_editable_get_name (ESelectNamesEditable *esne) { EABDestination **dest; gchar *dest_str; - gchar *result; + gchar *result = NULL; g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL); dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL); dest = eab_destination_importv (dest_str); - result = g_strdup (eab_destination_get_name (*dest)); + if (dest) + result = g_strdup (eab_destination_get_name (*dest)); eab_destination_freev (dest); return result; diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index fbda387d23..0571e3a29a 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -71,7 +71,7 @@ esnr_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, c ESelectNamesRenderer *sn_cell = E_SELECT_NAMES_RENDERER (cell); GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell); ESelectNamesEditable *editable; - + if (!text_cell->editable) return NULL; @@ -79,7 +79,7 @@ esnr_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, c e_select_names_editable_set_address (editable, sn_cell->priv->address); gtk_widget_show (GTK_WIDGET (editable)); - g_signal_connect (editable, "editing-done", G_CALLBACK (esnr_editing_done), sn_cell); + g_signal_connect (editable, "editing_done", G_CALLBACK (esnr_editing_done), sn_cell); sn_cell->priv->editable = g_object_ref (editable); sn_cell->priv->path = g_strdup (path); |