]> spindle.queued.net Git - midori/commitdiff
Flash browser window if new tab opened in background
authorAndré Stösel <andre@stoesel.de>
Tue, 9 Aug 2011 17:41:20 +0000 (19:41 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 15 Aug 2011 19:30:22 +0000 (21:30 +0200)
midori/midori-browser.c
midori/midori-preferences.c
midori/midori-websettings.c

index 1858f69ef1f5cb73e27756863ff853b8a1ee0448..6b84abd8374db37b1ee8758dfcd1ca4d72ac1acb 100644 (file)
@@ -1240,6 +1240,23 @@ midori_browser_view_copy_history (GtkWidget* view_to,
     }
 }
 
+static gint
+midori_browser_notify_new_tab_timeout_cb (MidoriBrowser *browser)
+{
+    gtk_window_set_opacity (GTK_WINDOW (browser), 1);
+    return 0;
+}
+
+static void
+midori_browser_notify_new_tab (MidoriBrowser *browser)
+{
+    if (katze_object_get_boolean (browser->settings, "flash-window-on-new-bg-tabs"))
+    {
+        gtk_window_set_opacity (GTK_WINDOW (browser), 0.8);
+        gtk_timeout_add (100, (GtkFunction) midori_browser_notify_new_tab_timeout_cb, browser);
+    }
+}
+
 static void
 midori_view_new_tab_cb (GtkWidget*     view,
                         const gchar*   uri,
@@ -1252,6 +1269,8 @@ midori_view_new_tab_cb (GtkWidget*     view,
 
     if (!background)
         midori_browser_set_current_page (browser, n);
+    else
+        midori_browser_notify_new_tab (browser);
 }
 
 static void
@@ -1287,6 +1306,8 @@ midori_view_new_view_cb (GtkWidget*     view,
         gint n = midori_browser_add_tab (browser, new_view);
         if (where != MIDORI_NEW_VIEW_BACKGROUND)
             midori_browser_set_current_page (browser, n);
+        else
+            midori_browser_notify_new_tab (browser);
     }
 
     if (!user_initiated)
index aee12c2f5e072542c759bad320471d439bcae2a1..4d4a771dd8eba6e0534ed9f794d3961e7aaaf2f9 100644 (file)
@@ -393,6 +393,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
     else
         button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
     INDENTED_ADD (button);
+    button = katze_property_proxy (settings, "flash-window-on-new-bg-tabs", NULL);
+    SPANNED_ADD (button);
     FRAME_NEW (NULL);
     button = katze_property_label (settings, "preferred-languages");
     INDENTED_ADD (button);
index 73d1aa04a456c8d0afdcd15ac926affe0fbd4e33..351f3df466826ef3c27f2b53a06a2b48d94b23b3 100644 (file)
@@ -90,6 +90,7 @@ struct _MidoriWebSettings
     gboolean enable_dns_prefetching;
     #endif
     gboolean strip_referer;
+    gboolean flash_window_on_bg_tabs;
 };
 
 struct _MidoriWebSettingsClass
@@ -140,6 +141,7 @@ enum
     PROP_OPEN_TABS_IN_THE_BACKGROUND,
     PROP_OPEN_TABS_NEXT_TO_CURRENT,
     PROP_OPEN_POPUPS_IN_TABS,
+    PROP_FLASH_WINDOW_ON_BG_TABS,
 
     PROP_AUTO_LOAD_IMAGES,
     PROP_ENABLE_SCRIPTS,
@@ -167,7 +169,7 @@ enum
     PROP_CLEAR_PRIVATE_DATA,
     PROP_CLEAR_DATA,
     PROP_ENABLE_DNS_PREFETCHING,
-    PROP_STRIP_REFERER
+    PROP_STRIP_REFERER,
 };
 
 GType
@@ -768,6 +770,14 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
                                                            TRUE,
                                                            flags));
     #endif
+    g_object_class_install_property (gobject_class,
+                                     PROP_OPEN_TABS_IN_THE_BACKGROUND,
+                                     g_param_spec_boolean (
+                                     "flash-window-on-new-bg-tabs",
+                                     _("Flash window on background tabs"),
+                                     _("Flash the browser window if a new tab was opened in the background"),
+                                     FALSE,
+                                     flags));
 
     /**
      * MidoriWebSettings:zoom-text-and-images:
@@ -1385,6 +1395,9 @@ midori_web_settings_set_property (GObject*      object,
     case PROP_STRIP_REFERER:
         web_settings->strip_referer = g_value_get_boolean (value);
         break;
+    case PROP_FLASH_WINDOW_ON_BG_TABS:
+        web_settings->flash_window_on_bg_tabs = g_value_get_boolean (value);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1634,6 +1647,9 @@ midori_web_settings_get_property (GObject*    object,
     case PROP_STRIP_REFERER:
         g_value_set_boolean (value, web_settings->strip_referer);
         break;
+    case PROP_FLASH_WINDOW_ON_BG_TABS:
+        g_value_set_boolean (value, web_settings->flash_window_on_bg_tabs);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;