diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-03-16 00:40:40 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-03-16 19:17:19 +0800 |
commit | 3a84dfc206e7e31b431130e4e8272cc0522eedab (patch) | |
tree | 84082321b2c60ed543184357feb62983df8c22f4 | |
parent | 0e1edc0339c271acada9588f59adc5933d16f4ec (diff) | |
download | gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar.gz gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar.bz2 gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar.lz gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar.xz gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.tar.zst gsoc2013-empathy-3a84dfc206e7e31b431130e4e8272cc0522eedab.zip |
Change the 'Delete logs' button to a menu entry
And make the confirmation dialog let you select one specific
account, or 'All of them'.
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 79 | ||||
-rw-r--r-- | libempathy-gtk/empathy-log-window.ui | 445 |
2 files changed, 296 insertions, 228 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index c6646397d..2f66fb0bc 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -66,7 +66,6 @@ typedef struct { GtkWidget *button_next; GtkWidget *hbox_chats; - GtkWidget *delete_button; GtkWidget *account_chooser_chats; GtkWidget *entry_chats; GtkWidget *calendar_chats; @@ -121,7 +120,7 @@ static void log_window_entry_chats_changed_cb (GtkWidget *en EmpathyLogWindow *window); static void log_window_entry_chats_activate_cb (GtkWidget *entry, EmpathyLogWindow *window); -static void log_window_delete_button_clicked_cb (GtkButton *button, +static void log_window_delete_menu_clicked_cb (GtkMenuItem *menuitem, EmpathyLogWindow *window); enum { @@ -220,6 +219,7 @@ empathy_log_window_show (TpAccount *account, gchar *filename; EmpathyLogWindow *window; EmpathyThemeManager *theme_mgr; + GtkWidget *menu_delete; if (log_window != NULL) { gtk_window_present (GTK_WINDOW (log_window->window)); @@ -241,6 +241,7 @@ empathy_log_window_show (TpAccount *account, "libempathy-gtk"); gui = empathy_builder_get_file (filename, "log_window", &window->window, + "menu_delete", &menu_delete, "notebook", &window->notebook, "entry_find", &window->entry_find, "button_find", &window->button_find, @@ -265,6 +266,7 @@ empathy_log_window_show (TpAccount *account, "button_find", "clicked", log_window_button_find_clicked_cb, "entry_chats", "changed", log_window_entry_chats_changed_cb, "entry_chats", "activate", log_window_entry_chats_activate_cb, + "menu_delete", "activate", log_window_delete_menu_clicked_cb, NULL); g_object_unref (gui); @@ -302,16 +304,6 @@ empathy_log_window_show (TpAccount *account, window->account_chooser_chats, FALSE, TRUE, 0); - /* Delete button */ - window->delete_button = gtk_button_new_from_stock (GTK_STOCK_DELETE); - g_signal_connect (window->delete_button, "clicked", - G_CALLBACK(log_window_delete_button_clicked_cb), - window); - - gtk_box_pack_start (GTK_BOX (window->hbox_chats), - window->delete_button, - FALSE, TRUE, 0); - g_signal_connect (window->account_chooser_chats, "changed", G_CALLBACK (log_window_chats_accounts_changed_cb), window); @@ -1405,41 +1397,53 @@ log_window_logger_clear_account_cb (TpProxy *proxy, } static void -log_window_delete_button_clicked_cb (GtkButton *button, - EmpathyLogWindow *window) +log_window_delete_menu_clicked_cb (GtkMenuItem *menuitem, + EmpathyLogWindow *window) { - GtkWidget *dialog; - EmpathyAccountChooser *account_chooser; - TpAccount *account; + GtkWidget *dialog, *content_area, *hbox, *label, *account_chooser; gint response_id; TpDBusDaemon *bus; TpProxy *logger; GError *error = NULL; - account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats); - account = empathy_account_chooser_get_account (account_chooser); + account_chooser = empathy_account_chooser_new (); + empathy_account_chooser_set_has_all_option (EMPATHY_ACCOUNT_CHOOSER (account_chooser), + TRUE); - dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_WARNING, + dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (window->window), + GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, - _("Delete all previous conversations on <b>%s</b>?"), - tp_account_get_display_name (account)); + _("Are you sure you want to delete all logs of previous conversations?")); gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - _("Delete previous conversations"), GTK_RESPONSE_APPLY, - NULL); + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + _("Clear All"), GTK_RESPONSE_APPLY, + NULL); + + content_area = gtk_message_dialog_get_message_area ( + GTK_MESSAGE_DIALOG (dialog)); + + hbox = gtk_hbox_new (FALSE, 6); + label = gtk_label_new (_("Delete from:")); + gtk_box_pack_start (GTK_BOX (hbox), label, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), account_chooser, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (content_area), hbox, + FALSE, FALSE, 0); + + gtk_widget_show_all (hbox); response_id = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); if (response_id != GTK_RESPONSE_APPLY) - return; + goto out; bus = tp_dbus_daemon_dup (&error); if (error != NULL) { g_warning ("Could not delete logs: %s", error->message); g_error_free (error); - return; + goto out; } logger = g_object_new (TP_TYPE_PROXY, @@ -1451,12 +1455,25 @@ log_window_delete_button_clicked_cb (GtkButton *button, tp_proxy_add_interface_by_id (logger, EMP_IFACE_QUARK_LOGGER); - DEBUG ("Deleting logs for %s", tp_proxy_get_object_path (account)); + if (empathy_account_chooser_has_all_selected (EMPATHY_ACCOUNT_CHOOSER (account_chooser))) { + DEBUG ("Deleting logs for all the accounts"); - emp_cli_logger_call_clear_account (logger, -1, - tp_proxy_get_object_path (account), + emp_cli_logger_call_clear (logger, -1, log_window_logger_clear_account_cb, window, NULL, G_OBJECT (window->window)); + } else { + TpAccount *account = empathy_account_chooser_get_account ( + EMPATHY_ACCOUNT_CHOOSER (account_chooser)); + + DEBUG ("Deleting logs for %s", tp_proxy_get_object_path (account)); + + emp_cli_logger_call_clear_account (logger, -1, + tp_proxy_get_object_path (account), + log_window_logger_clear_account_cb, + window, NULL, G_OBJECT (window->window)); + } g_object_unref (logger); + out: + gtk_widget_destroy (dialog); } diff --git a/libempathy-gtk/empathy-log-window.ui b/libempathy-gtk/empathy-log-window.ui index 5f50c859a..ab06231f9 100644 --- a/libempathy-gtk/empathy-log-window.ui +++ b/libempathy-gtk/empathy-log-window.ui @@ -1,6 +1,6 @@ <?xml version="1.0"?> <interface> - <!-- interface-requires gtk+ 2.12 --> + <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy toplevel-contextual --> <object class="GtkWindow" id="log_window"> <property name="title" translatable="yes">Previous Conversations</property> @@ -9,292 +9,349 @@ <property name="default_height">450</property> <property name="icon_name">document-open-recent</property> <child> - <object class="GtkNotebook" id="notebook"> + <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="border_width">2</property> + <property name="orientation">vertical</property> <child> - <object class="GtkVBox" id="vbox192"> + <object class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">6</property> <child> - <object class="GtkHBox" id="hbox144"> + <object class="GtkMenuItem" id="menuitem2"> <property name="visible">True</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel" id="label628"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Searching *for* something">_For:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry_find</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="entry_find"> + <property name="label" translatable="yes">_Edit</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="menu2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="activates_default">True</property> + <child> + <object class="GtkImageMenuItem" id="menu_delete"> + <property name="label" translatable="yes">Delete All History...</property> + <property name="visible">True</property> + <property name="image">image3</property> + <property name="use_stock">False</property> + </object> + </child> </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button_find"> - <property name="label">gtk-find</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <property name="focus_on_click">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkNotebook" id="notebook"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="border_width">2</property> <child> - <object class="GtkVPaned" id="vpaned1"> + <object class="GtkVBox" id="vbox192"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="position">120</property> + <property name="border_width">12</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="GtkScrolledWindow" id="scrolledwindow14"> + <object class="GtkHBox" id="hbox144"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label628"> + <property name="visible">True</property> + <property name="label" translatable="yes" comments="Searching *for* something">_For:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entry_find</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> <child> - <object class="GtkTreeView" id="treeview_find"> + <object class="GtkEntry" id="entry_find"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="enable_search">False</property> + <property name="invisible_char">●</property> + <property name="activates_default">True</property> </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button_find"> + <property name="label">gtk-find</property> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + <property name="focus_on_click">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> </child> </object> <packing> - <property name="resize">False</property> - <property name="shrink">True</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkVBox" id="vbox215"> + <object class="GtkVPaned" id="vpaned1"> <property name="visible">True</property> - <property name="spacing">6</property> + <property name="can_focus">True</property> + <property name="orientation">vertical</property> + <property name="position">120</property> + <property name="position_set">True</property> <child> - <object class="GtkScrolledWindow" id="scrolledwindow_find"> + <object class="GtkScrolledWindow" id="scrolledwindow14"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">automatic</property> <property name="shadow_type">in</property> <child> - <placeholder/> + <object class="GtkTreeView" id="treeview_find"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="enable_search">False</property> + </object> </child> </object> <packing> - <property name="position">0</property> + <property name="resize">False</property> + <property name="shrink">True</property> </packing> </child> <child> - <object class="GtkHBox" id="hbox171"> + <object class="GtkVBox" id="vbox215"> <property name="visible">True</property> - <property name="spacing">12</property> - <child> - <placeholder/> - </child> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="GtkButton" id="button_next"> - <property name="label" translatable="yes">Find Next</property> + <object class="GtkScrolledWindow" id="scrolledwindow_find"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="image">image1</property> - <property name="focus_on_click">False</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <placeholder/> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">2</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="button_previous"> - <property name="label" translatable="yes">Find Previous</property> + <object class="GtkHBox" id="hbox171"> <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="image">image2</property> - <property name="focus_on_click">False</property> + <property name="spacing">12</property> + <child> + <placeholder/> + </child> + <child> + <object class="GtkButton" id="button_next"> + <property name="label" translatable="yes">Find Next</property> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image1</property> + <property name="focus_on_click">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button_previous"> + <property name="label" translatable="yes">Find Previous</property> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image2</property> + <property name="focus_on_click">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> + <property name="resize">True</property> + <property name="shrink">True</property> </packing> </child> </object> <packing> - <property name="resize">True</property> - <property name="shrink">True</property> + <property name="position">120</property> </packing> </child> </object> - <packing> - <property name="position">1</property> - </packing> </child> - </object> - </child> - <child type="tab"> - <object class="GtkLabel" id="label595"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Tab Label">Search</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table7"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="column_spacing">6</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkHBox" id="hbox_chats"> + <child type="tab"> + <object class="GtkLabel" id="label595"> <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <placeholder/> - </child> + <property name="label" translatable="yes" comments="Tab Label">Search</property> </object> <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> + <property name="tab_fill">False</property> </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow_chats"> + <object class="GtkTable" id="table7"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="shadow_type">in</property> + <property name="border_width">12</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="column_spacing">6</property> + <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox191"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow13"> - <property name="width_request">150</property> + <object class="GtkHBox" id="hbox_chats"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> + <property name="spacing">6</property> <child> - <object class="GtkTreeView" id="treeview_chats"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - </object> + <placeholder/> </child> </object> <packing> - <property name="position">0</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <object class="GtkCalendar" id="calendar_chats"> + <object class="GtkScrolledWindow" id="scrolledwindow_chats"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <placeholder/> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> </packing> </child> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox143"> - <property name="visible">True</property> - <property name="spacing">6</property> <child> - <object class="GtkImage" id="image247"> + <object class="GtkVBox" id="vbox191"> <property name="visible">True</property> - <property name="stock">gtk-find</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow13"> + <property name="width_request">150</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">automatic</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="treeview_chats"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + </object> + </child> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCalendar" id="calendar_chats"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="year">2011</property> + <property name="month">2</property> + <property name="day">15</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> </packing> </child> <child> - <object class="GtkEntry" id="entry_chats"> + <object class="GtkHBox" id="hbox143"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="activates_default">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkImage" id="image247"> + <property name="visible">True</property> + <property name="stock">gtk-find</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entry_chats"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="activates_default">True</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> </object> <packing> - <property name="position">1</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> </packing> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> + <property name="position">1</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label596"> + <property name="visible">True</property> + <property name="label" translatable="yes" comments="Tab Label">Conversations</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> </packing> </child> </object> @@ -302,16 +359,6 @@ <property name="position">1</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label596"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Tab Label">Conversations</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> </object> </child> </object> @@ -323,4 +370,8 @@ <property name="visible">True</property> <property name="stock">gtk-go-back</property> </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="stock">gtk-missing-image</property> + </object> </interface> |