[pan2/testing] BUGFIX : http://permalink.gmane.org/gmane.comp.gnome.apps.pan.devel/1314
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing] BUGFIX : http://permalink.gmane.org/gmane.comp.gnome.apps.pan.devel/1314
- Date: Sun, 4 Dec 2011 07:48:35 +0000 (UTC)
commit afaef238e312c38883d24265fc627ae71434a482
Author: Heinrich MÃller <henmull src gnome org>
Date: Sun Dec 4 08:48:16 2011 +0100
BUGFIX : http://permalink.gmane.org/gmane.comp.gnome.apps.pan.devel/1314
pan/gui/body-pane.cc | 3 +++
pan/gui/post-ui.cc | 29 +++++++++++++++++++++++------
pan/gui/post-ui.h | 13 +++++++++++--
3 files changed, 37 insertions(+), 8 deletions(-)
---
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 37712cf..3819aee 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -499,6 +499,9 @@ namespace
gboolean handled (false);
g_return_val_if_fail (GTK_IS_TEXT_VIEW(w), false);
+
+// if (event->keyval==GDK_KEY_Enter) return false;
+
const bool up = event->keyval==GDK_KEY_Up || event->keyval==GDK_KEY_KP_Up;
const bool down = event->keyval==GDK_KEY_Down || event->keyval==GDK_KEY_KP_Down;
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index dab61bb..d1b4f6a 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -26,6 +26,7 @@ extern "C" {
#include <gmime/gmime.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+ #include <gdk/gdkkeysyms.h>
#include <sys/time.h>
#ifdef HAVE_GTKSPELL
#include <gtkspell/gtkspell.h>
@@ -147,10 +148,7 @@ PostUI:: update_filequeue_label (GtkTreeSelection *selection)
tasks_t tasks(get_selected_files());
if (tasks.empty())
- {
_upload_queue.get_all_tasks(tasks);
- }
-
char str[512];
long kb(0);
@@ -387,7 +385,7 @@ namespace
{
{ "remove-files", "Delete",
- N_("Remove from Queue"), "Delete",
+ N_("Remove from Queue"), NULL,
N_("Remove from Queue"),
G_CALLBACK(do_remove_files) },
@@ -2869,7 +2867,7 @@ gboolean
PostUI::draft_save_cb(gpointer ptr)
{
PostUI *data = static_cast<PostUI*>(ptr);
- if (!data) return true;
+ if (!data) return false;
GMimeMessage * msg = data->new_message_from_ui (DRAFTING);
std::string& draft_filename (get_draft_filename ());
char * filename = g_build_filename (draft_filename.c_str(), "autosave", NULL);
@@ -2890,6 +2888,22 @@ PostUI::draft_save_cb(gpointer ptr)
return false;
}
+gboolean
+PostUI :: on_keyboard_key_pressed_cb (GtkWidget * w, GdkEventKey * event, gpointer ptr)
+{
+ PostUI *data = static_cast<PostUI*>(ptr);
+ if (!data) return false;
+ if (event->type == GDK_KEY_PRESS)
+ {
+ if (event->keyval == GDK_KEY_Delete)
+ {
+ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(data->_notebook)) == PostUI::PAGE_QUEUE)
+ data->remove_files();
+ }
+ }
+ return false;
+}
+
PostUI :: PostUI (GtkWindow * parent,
Data & data,
Queue & queue,
@@ -2972,12 +2986,15 @@ PostUI :: PostUI (GtkWindow * parent,
gtk_widget_show_all (vbox);
gtk_container_add (GTK_CONTAINER(_root), vbox);
- GtkWidget * notebook = gtk_notebook_new ();
+ GtkWidget * notebook = _notebook = gtk_notebook_new ();
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), create_main_tab(), gtk_label_new_with_mnemonic(_("_Message")));
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), create_extras_tab(), gtk_label_new_with_mnemonic(_("More _Headers")));
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), create_filequeue_tab(), gtk_label_new_with_mnemonic(_("File _Queue")));
pan_box_pack_start_defaults (GTK_BOX(vbox), notebook);
+ /* button press handler for "delete" */
+ g_signal_connect (vbox, "key-press-event", G_CALLBACK(on_keyboard_key_pressed_cb), this);
+
// remember this message, but don't put it in the text view yet.
// we have to wait for it to be realized first so that wrapping
// will work correctly.
diff --git a/pan/gui/post-ui.h b/pan/gui/post-ui.h
index 103ef9d..d6d6792 100644
--- a/pan/gui/post-ui.h
+++ b/pan/gui/post-ui.h
@@ -191,8 +191,6 @@ namespace pan
void update_filequeue_label (GtkTreeSelection *selection=0);
GtkWidget* create_parts_tab ();
-// GtkWidget* create_log_tab ();
-// void update_filequeue_tab();
private:
std::string utf8ize (const StringView&) const;
@@ -253,6 +251,17 @@ namespace pan
guint _draft_autosave_idle_tag;
static gboolean draft_save_cb(gpointer ptr);
+ /* override of "delete" */
+ enum pages
+ {
+ PAGE_MAIN = 0,
+ PAGE_EXTRAS = 1,
+ PAGE_QUEUE = 2
+ };
+ GtkWidget * _notebook;
+ int delete_override;
+ static gboolean on_keyboard_key_pressed_cb (GtkWidget *, GdkEventKey *, gpointer);
+
public:
void set_draft_autosave_timeout(guint seconds)
{ _draft_autosave_timeout = seconds;}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]