[Epiphany] Megapatch



This patch includes my other previous ones, cuz it didn't really make 
sense to try to cut them out.

what it does
------------------------
1. Unified Delete and rename menu items per conversation with calum.
2. Move rename and delete into the file menu
3. Add text editting menu entries to the edit menu
4. Topics context menu
5. use an hpane for the bme window
6.  use delete key to delete topics

dave
Index: data/ui/epiphany-bookmark-editor-ui.xml.in
===================================================================
RCS file: /cvs/gnome/epiphany/data/ui/epiphany-bookmark-editor-ui.xml.in,v
retrieving revision 1.6
diff -u -p -r1.6 epiphany-bookmark-editor-ui.xml.in
--- data/ui/epiphany-bookmark-editor-ui.xml.in	24 Mar 2003 14:08:24 -0000	1.6
+++ data/ui/epiphany-bookmark-editor-ui.xml.in	25 Mar 2003 20:37:15 -0000
@@ -6,17 +6,19 @@
 	<separator name="FileSep1"/>
         <menuitem name="FileOpenInWindow" verb="OpenInWindow"/>
 	<menuitem name="FileOpenInTab" verb="OpenInTab"/>
-	<separator name="FileSep3"/>
+	<separator name="FileSep2"/>
+	<menuitem name="FileRename" verb="Rename"/>
+	<menuitem name="FileDelete" verb="Delete"/>
 	<menuitem name="FileProperties" verb="Properties"/>
+	<separator name="FileSep3"/>
 	<menuitem name="FileClose" verb="Close"/>
 </submenu>
 
 <submenu name="EditMenu" verb="Edit">
-	<menuitem name="EditRenameBookmark" verb="RenameBookmark"/>
-	<menuitem name="EditRenameTopic" verb="RenameTopic"/>
-	<separator name="FileSep1"/>
-	<menuitem name="FileRemoveBookmark" verb="RemoveBookmark"/>
-	<menuitem name="FileRemoveTopic" verb="RemoveTopic"/>
+	<menuitem name="EditCut" verb="Cut"/>
+	<menuitem name="EditCopy" verb="Copy"/>
+	<menuitem name="EditPaste" verb="Paste"/>
+	<menuitem name="EditSelectAll" verb="SelectAll"/>
 </submenu>
 
 </menu>
@@ -27,11 +29,16 @@
 	<menuitem name="OpenInWindowBMK" verb="OpenInWindow"/>
 	<menuitem name="OpenInTabBMK" verb="OpenInTab"/>
 	<separator name="BookmarksPopupSep1"/>
-	<menuitem name="RemoveBMK" verb="RemoveBookmark"/>
-	<menuitem name="RenameBMK" verb="RenameBookmark"/>
+	<menuitem name="RenameBMK" verb="Rename"/>
+	<menuitem name="DeleteBMK" verb="Delete"/>
 	<separator name="BookmarksPopupSep2"/>
 	<menuitem name="BMKProperties" verb="Properties"/>
 </popup>
-	
+
+<popup name="EphyBookmarkKeywordPopup" verb="FakeToplevel">
+	<menuitem name="RenameTPC" verb="Rename"/>
+	<menuitem name="DeleteTPC" verb="Delete"/>
+</popup>
+
 </popups>
 </Root>
Index: src/bookmarks/ephy-bookmarks-editor.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.c,v
retrieving revision 1.29
diff -u -p -r1.29 ephy-bookmarks-editor.c
--- src/bookmarks/ephy-bookmarks-editor.c	24 Mar 2003 20:56:19 -0000	1.29
+++ src/bookmarks/ephy-bookmarks-editor.c	25 Mar 2003 20:37:22 -0000
@@ -20,7 +20,7 @@
 #include <gtk/gtktable.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtkstock.h>
-#include <gtk/gtkhbox.h>
+#include <gtk/gtkhpaned.h>
 #include <gtk/gtkvbox.h>
 #include <gdk/gdkkeysyms.h>
 #include <libgnome/gnome-i18n.h>
@@ -58,19 +58,23 @@ static void cmd_open_bookmarks_in_tabs  
 					   EphyBookmarksEditor *editor);
 static void cmd_open_bookmarks_in_browser (EggAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_remove_bookmarks          (EggAction *action,
+static void cmd_delete          (EggAction *action,
 				           EphyBookmarksEditor *editor);
 static void cmd_bookmark_properties	  (EggAction *action,
 					   EphyBookmarksEditor *editor);
 static void cmd_add_topic		  (EggAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_remove_topic		  (EggAction *action,
+static void cmd_rename		(EggAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_rename_bookmark		  (EggAction *action,
+static void cmd_close			  (EggAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_rename_topic		  (EggAction *action,
+static void cmd_cut			(EggAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_close			  (EggAction *action,
+static void cmd_copy			(EggAction *action,
+					   EphyBookmarksEditor *editor);
+static void cmd_paste		(EggAction *action,
+					   EphyBookmarksEditor *editor);
+static void cmd_select_all		(EggAction *action,
 					   EphyBookmarksEditor *editor);
 
 struct EphyBookmarksEditorPrivate
@@ -115,17 +119,23 @@ static EggActionGroupEntry ephy_bookmark
 	{ "OpenInTab", N_("Open In New _Tab"), NULL, "<shift><control>O",
 	  NULL, G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
 
-	{ "RenameBookmark", N_("_Rename Bookmark"), NULL, NULL,
-	  NULL, G_CALLBACK (cmd_rename_bookmark), NULL },
+	{ "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+	 NULL, G_CALLBACK (cmd_cut), NULL },
+	
+	{ "Copy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+	 NULL, G_CALLBACK (cmd_copy), NULL },
+
+	{ "Paste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+	 NULL, G_CALLBACK (cmd_paste), NULL },
 
-	{ "RenameTopic", N_("R_ename Topic"), NULL, NULL,
-	  NULL, G_CALLBACK (cmd_rename_topic), NULL },
+	{ "SelectAll", N_("Select _All"), NULL, "<control>A",
+	 NULL, G_CALLBACK (cmd_select_all), NULL },
 
-	{ "RemoveBookmark", N_("_Delete Bookmark"), GTK_STOCK_DELETE, NULL,
-	  NULL, G_CALLBACK (cmd_remove_bookmarks), NULL },
+	{ "Rename", N_("_Rename"), NULL, "F2",
+	  NULL, G_CALLBACK (cmd_rename), NULL },
 
-	{ "RemoveTopic", N_("D_elete Topic"), NULL, NULL,
-          NULL, G_CALLBACK (cmd_remove_topic), NULL },
+	{ "Delete", N_("_Delete"), GTK_STOCK_DELETE, NULL,
+	  NULL, G_CALLBACK (cmd_delete), NULL },
 
 	{ "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, "<alt>Return",
 	  NULL, G_CALLBACK (cmd_bookmark_properties), NULL },
@@ -148,21 +158,6 @@ cmd_add_topic (EggAction *action,
 }
 
 static void
-cmd_remove_topic (EggAction *action,
-		  EphyBookmarksEditor *editor)
-{
-	GList *selection;
-
-	selection = ephy_node_view_get_selection (editor->priv->key_view);
-	if (selection)
-	{
-		EphyNode *node = EPHY_NODE (selection->data);
-		ephy_bookmarks_remove_keyword (editor->priv->bookmarks, node);
-		g_list_free (selection);
-	}
-}
-
-static void
 cmd_close (EggAction *action,
 	   EphyBookmarksEditor *editor)
 {
@@ -170,17 +165,17 @@ cmd_close (EggAction *action,
 }
 
 static void
-cmd_rename_topic (EggAction *action,
-		  EphyBookmarksEditor *editor)
-{
-	ephy_node_view_edit (editor->priv->key_view);
-}
-
-static void
-cmd_rename_bookmark (EggAction *action,
+cmd_rename (EggAction *action,
 		     EphyBookmarksEditor *editor)
-{
-	ephy_node_view_edit (editor->priv->bm_view);
+{	
+	if (ephy_node_view_has_focus (editor->priv->bm_view))
+	{
+		ephy_node_view_edit (editor->priv->bm_view);
+	}
+	else if (ephy_node_view_has_focus (editor->priv->key_view))
+	{
+		ephy_node_view_edit (editor->priv->key_view);
+	}
 }
 
 static GtkWidget *
@@ -255,10 +250,27 @@ cmd_open_bookmarks_in_browser (EggAction
 }
 
 static void
-cmd_remove_bookmarks (EggAction *action,
+cmd_delete (EggAction *action,
 		      EphyBookmarksEditor *editor)
 {
-	ephy_node_view_remove (editor->priv->bm_view);
+	if (ephy_node_view_has_focus (editor->priv->bm_view))
+	{
+		ephy_node_view_remove (editor->priv->bm_view);
+	}
+
+	else if (ephy_node_view_has_focus (editor->priv->key_view))
+	{
+		GList *selection;
+
+		selection = ephy_node_view_get_selection (editor->priv->key_view);
+	
+		if (selection)
+		{
+			EphyNode *node = EPHY_NODE (selection->data);
+			ephy_bookmarks_remove_keyword (editor->priv->bookmarks, node);
+			g_list_free (selection);
+		}
+	}
 }
 
 static void
@@ -284,6 +296,61 @@ cmd_bookmark_properties (EggAction *acti
 	}
 }
 
+static void
+cmd_cut (EggAction *action,
+		    EphyBookmarksEditor *editor)
+{
+	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+	if (GTK_IS_EDITABLE (widget))
+	{
+		gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
+	}
+}
+
+static void
+cmd_copy (EggAction *action,
+		    EphyBookmarksEditor *editor)
+{
+	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+	if (GTK_IS_EDITABLE (widget))
+	{
+		gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
+	}
+}
+
+static void
+cmd_paste (EggAction *action,
+		    EphyBookmarksEditor *editor)
+{
+	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+	if (GTK_IS_EDITABLE (widget))
+	{
+		gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
+	}
+}
+
+static void
+cmd_select_all (EggAction *action,
+		    EphyBookmarksEditor *editor)
+{
+	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+	if (GTK_IS_EDITABLE (widget))
+	{
+		gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
+	}
+	
+	else if (GTK_IS_TREE_VIEW (widget)) 
+	{
+		GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+		gtk_tree_selection_select_all (sel);
+	}
+}
+
+
 GType
 ephy_bookmarks_editor_get_type (void)
 {
@@ -466,6 +533,32 @@ bookmarks_filter (EphyBookmarksEditor *e
 }
 
 static void
+keyword_node_key_pressed_cb (GtkWidget *view,
+				      GdkEventKey *event,
+				      EphyBookmarksEditor *editor)
+{
+	GList *selection;
+
+	switch (event->keyval)
+	{
+	case GDK_Delete:
+		
+		selection = ephy_node_view_get_selection (editor->priv->key_view);
+	
+		if (selection)
+		{
+			EphyNode *node = EPHY_NODE (selection->data);
+			ephy_bookmarks_remove_keyword (editor->priv->bookmarks, node);
+			g_list_free (selection);
+		}
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void
 keyword_node_selected_cb (EphyNodeView *view,
 			  EphyNode *node,
 			  EphyBookmarksEditor *editor)
@@ -484,6 +577,18 @@ keyword_node_selected_cb (EphyNodeView *
 }
 
 static void
+keyword_node_show_popup_cb (GtkWidget *view,
+				     EphyBookmarksEditor *editor)
+{
+	GtkWidget *widget;
+
+	widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+					    "/popups/EphyBookmarkKeywordPopup");
+	gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
+			gtk_get_current_event_time ());
+}
+
+static void
 search_entry_changed_cb (GtkWidget *entry, EphyBookmarksEditor *editor)
 {
 	char *search_text;
@@ -560,7 +665,7 @@ delete_event_cb (EphyBookmarksEditor *ed
 static void
 ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
 {
-	GtkWidget *hbox, *vbox;
+	GtkWidget *hpane, *vbox;
 	EphyNodeView *bm_view, *key_view;
 	EphyNode *node;
 	long selected_id;
@@ -607,10 +712,10 @@ ephy_bookmarks_editor_construct (EphyBoo
 	editor->priv->ui_merge = ui_merge;
 	editor->priv->action_group = action_group;
 
-	hbox = gtk_hbox_new (FALSE, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
-	gtk_container_add (GTK_CONTAINER (editor->priv->menu_dock), hbox);
-	gtk_widget_show (hbox);
+	hpane = gtk_hpaned_new ();
+	gtk_container_set_border_width (GTK_CONTAINER (hpane), 6);
+	gtk_container_add (GTK_CONTAINER (editor->priv->menu_dock), hpane);
+	gtk_widget_show (hpane);
 
 	g_assert (editor->priv->bookmarks);
 
@@ -622,18 +727,25 @@ ephy_bookmarks_editor_construct (EphyBoo
 	ephy_node_view_set_browse_mode (key_view);
 	ephy_node_view_add_column (key_view, _("Topics"),
 			           EPHY_TREE_MODEL_NODE_COL_KEYWORD, TRUE, TRUE);
-	gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (key_view), FALSE, TRUE, 0);
+	gtk_paned_pack1 (GTK_PANED (hpane), GTK_WIDGET (key_view), TRUE, TRUE);
 	gtk_widget_set_size_request (GTK_WIDGET (key_view), 130, -1);
 	gtk_widget_show (GTK_WIDGET (key_view));
 	editor->priv->key_view = key_view;
 	g_signal_connect (G_OBJECT (key_view),
+			  "key_press_event",
+			  G_CALLBACK (keyword_node_key_pressed_cb),
+			  editor);
+	g_signal_connect (G_OBJECT (key_view),
 			  "node_selected",
 			  G_CALLBACK (keyword_node_selected_cb),
 			  editor);
-
+	g_signal_connect (G_OBJECT (key_view),
+			  "show_popup",
+			  G_CALLBACK (keyword_node_show_popup_cb),
+			  editor);
+	
 	vbox = gtk_vbox_new (FALSE, 6);
-	gtk_box_pack_start (GTK_BOX (hbox),
-			    vbox, TRUE, TRUE, 0);
+	gtk_paned_pack2(GTK_PANED (hpane), vbox, TRUE, TRUE);
 	gtk_widget_show (vbox);
 
 	gtk_box_pack_start (GTK_BOX (vbox),
Index: src/bookmarks/ephy-node-view.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-node-view.c,v
retrieving revision 1.11
diff -u -p -r1.11 ephy-node-view.c
--- src/bookmarks/ephy-node-view.c	24 Mar 2003 21:48:06 -0000	1.11
+++ src/bookmarks/ephy-node-view.c	25 Mar 2003 20:37:26 -0000
@@ -22,6 +22,7 @@
 #include <gtk/gtktreeviewcolumn.h>
 #include <gtk/gtkcellrenderertext.h>
 #include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtkwindow.h>
 #include <libgnome/gnome-i18n.h>
 
 #include "eggtreemodelfilter.h"
@@ -658,6 +659,23 @@ ephy_node_view_get_selection (EphyNodeVi
 					     (void **) &list);
 
 	return list;
+}
+
+gboolean
+ephy_node_view_has_focus (EphyNodeView *view)
+{
+	GtkWidget *window;
+	GtkWidget *focused_widget;
+	
+	window = gtk_widget_get_toplevel (view->priv->treeview);
+	focused_widget = gtk_window_get_focus (GTK_WINDOW(window));
+	
+	if (view->priv->treeview  == focused_widget)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
 }
 
 void
Index: src/bookmarks/ephy-node-view.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-node-view.h,v
retrieving revision 1.4
diff -u -p -r1.4 ephy-node-view.h
--- src/bookmarks/ephy-node-view.h	23 Mar 2003 12:30:41 -0000	1.4
+++ src/bookmarks/ephy-node-view.h	25 Mar 2003 20:37:27 -0000
@@ -74,6 +74,8 @@ void	      ephy_node_view_remove		      
 
 GList        *ephy_node_view_get_selection            (EphyNodeView *view);
 
+gboolean ephy_node_view_has_focus 			(EphyNodeView *view);
+
 void	      ephy_node_view_set_browse_mode	      (EphyNodeView *view);
 
 void	      ephy_node_view_select_node              (EphyNodeView *view,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]