]> spindle.queued.net Git - midori/commitdiff
Add common context menu items and cleanup.
authorChristian Dywan <christian@twotoasts.de>
Wed, 19 Mar 2008 13:46:08 +0000 (14:46 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 19 Mar 2008 13:46:08 +0000 (14:46 +0100)
Add the actions UndoTabClose, BookmarkNew, SaveAs, SourceView and Print
to the context menu. Also add UndoTabClose to the Go menu, remove
STOCK_SOURCE_VIEW and remove ui.h which is obsolete.

src/global.h
src/main.c
src/midori-browser.c
src/midori-webview.c
src/ui.h [deleted file]

index e81bc630d796d07635cca55fa6aa519084d6841e..971f265128ca0b109ce09c15ce5bf262a0f61ce9 100644 (file)
@@ -40,7 +40,6 @@ MidoriWebSettings* webSettings;
 #define STOCK_NEWSFEED           "gtk-index" // "newsfeed"
 #define STOCK_PLUGINS            GTK_STOCK_CONVERT // "plugin"
 #define STOCK_POPUPS_BLOCKED     "popup-hidden"
-#define STOCK_SOURCE_VIEW        "stock_view-html-source" // "view-source"
 #define STOCK_TAB_CLOSE          GTK_STOCK_CLOSE // "tab-close"
 #define STOCK_WINDOW_CLOSE       GTK_STOCK_CLOSE // "window-close"
 
index 2fdf18541a33606b80bd9e99f8659092f31f0d41..ff7f45ed7e790c1d1a1aceeab0d9229d607f7fd2 100644 (file)
@@ -47,7 +47,6 @@ static void stock_items_init(void)
         { STOCK_NEWSFEED,       "Newsfeed", 0, 0, NULL },
         { STOCK_PLUGINS,        "_Plugins", 0, 0, NULL },
         { STOCK_POPUPS_BLOCKED, "Blocked Popups", 0, 0, NULL },
-        { STOCK_SOURCE_VIEW,    "View Source", 0, 0, NULL },
         { STOCK_TAB_CLOSE,      "C_lose Tab", 0, 0, NULL },
         { STOCK_TAB_NEW,        "New _Tab", 0, 0, NULL },
         { STOCK_WINDOW_CLOSE,   "_Close Window", 0, 0, NULL },
index fafc3acba628b053b0102853d804ee105cd6fe70..71ca474920dd9241047dd592332508c58f3820d3 100644 (file)
@@ -396,13 +396,24 @@ midori_web_view_populate_popup_cb (GtkWidget*     web_view,
 
     if (!uri && !webkit_web_view_has_selection (WEBKIT_WEB_VIEW (web_view)))
     {
-        // TODO: menu items
-        // UndoTabClose
-        // sep
-        // BookmarkNew
-        // SaveAs
-        // SourceView
-        // Print
+        GtkAction* action = _action_by_name (browser, "UndoTabClose");
+        GtkWidget* menuitem = gtk_action_create_menu_item (action);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        menuitem = gtk_separator_menu_item_new ();
+        gtk_widget_show (menuitem);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        action = _action_by_name (browser, "BookmarkNew");
+        menuitem = gtk_action_create_menu_item (action);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        action = _action_by_name (browser, "SaveAs");
+        menuitem = gtk_action_create_menu_item (action);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        action = _action_by_name (browser, "SourceView");
+        menuitem = gtk_action_create_menu_item (action);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+        action = _action_by_name (browser, "Print");
+        menuitem = gtk_action_create_menu_item (action);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
     }
 }
 
@@ -1920,10 +1931,10 @@ static const GtkActionEntry entries[] = {
  { "ZoomNormal", GTK_STOCK_ZOOM_100,
    NULL, "<Ctrl>0",
    "hm?", NULL/*G_CALLBACK (_action_zoom_normal_activate)*/ },
- { "SourceView", STOCK_SOURCE_VIEW,
-   NULL, "",
+ { "SourceView", NULL,
+   "View Source", "",
    "hm?", /*G_CALLBACK (_action_source_view_activate)*/ },
- { "SelectionSourceView", STOCK_SOURCE_VIEW,
+ { "SelectionSourceView", NULL,
    "View Selection Source", "",
    "hm?", NULL/*G_CALLBACK (_action_selection_source_view_activate)*/ },
  { "Fullscreen", GTK_STOCK_FULLSCREEN,
@@ -2151,6 +2162,7 @@ static const gchar* ui_markup =
      "<separator/>"
      "<menuitem action='TrashEmpty'/>"
     "</menu>"
+    "<menuitem action='UndoTabClose'/>"
     "<separator/>"
     "<menuitem action='Find'/>"
     "<menuitem action='FindNext'/>"
@@ -2669,7 +2681,9 @@ midori_browser_set_property (GObject*      object,
     case PROP_SETTINGS:
         katze_object_assign (priv->settings, g_value_get_object (value));
         g_object_ref (priv->settings);
-        // FIXME: Assign settings to each web view
+        gtk_container_foreach (GTK_CONTAINER (priv->notebook),
+                               (GtkCallback*) midori_web_view_set_settings,
+                               priv->settings);
         break;
     case PROP_TRASH:
         ; // FIXME: Disconnect handlers
index 4b2e250cf391ea4b7953b9365fd97f8b43184087..c61ad92c0540dec3086b37af080c828be8d8e5b5 100644 (file)
@@ -458,7 +458,6 @@ midori_web_view_menu_new_tab_activate_cb (GtkWidget*     widget,
                                           MidoriWebView* web_view)
 {
     const gchar* uri = g_object_get_data (G_OBJECT (widget), "uri");
-    g_print ("selected: %s\n", uri);
     g_signal_emit (web_view, signals[NEW_TAB], 0, uri);
 }
 
@@ -503,7 +502,7 @@ webkit_web_view_populate_popup_cb (GtkWidget*     web_view,
                 G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), web_view);
             gtk_widget_show (menuitem);
         }
-        // FIXME: We are leaking 'text' which is not const be should be.
+        // FIXME: We are leaking 'text' which is not const but should be.
     }
 }
 
@@ -755,6 +754,20 @@ midori_web_view_new (void)
     return GTK_WIDGET (web_view);
 }
 
+/**
+ * midori_web_view_set_settings:
+ * @web_view: a #MidoriWebView
+ * @web_settings: a #MidoriWebSettings
+ *
+ * Assigns a settings instance to the web view.
+ **/
+void
+midori_web_view_set_settings (MidoriWebView*     web_view,
+                              MidoriWebSettings* web_settings)
+{
+    g_object_set (web_view, "settings", web_settings, NULL);
+}
+
 /**
  * midori_web_view_get_proxy_menu_item:
  * @web_view: a #MidoriWebView
diff --git a/src/ui.h b/src/ui.h
deleted file mode 100644 (file)
index bc5d6a8..0000000
--- a/src/ui.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#ifndef __UI_H__
-#define __UI_H__ 1
-
-#endif /* !__UI_H__ */