[Xfce4-commits] <midori:master> Allow custom shortcut and column count in speed dial

Christian Dywan noreply at xfce.org
Wed May 19 01:00:01 CEST 2010


Updating branch refs/heads/master
         to 84d4865e222b46194b48be2c74e24c5a0bbcb613 (commit)
       from 2f5a65947f15847737621834c36ca3e3d2ad04bf (commit)

commit 84d4865e222b46194b48be2c74e24c5a0bbcb613
Author: Peter de Ridder <peter at xfce.org>
Date:   Sun May 16 17:56:22 2010 +0200

    Allow custom shortcut and column count in speed dial

 data/speeddial-head.html |   55 ++++++++++++++++++++++++++++++++++++++++++++-
 midori/midori-view.c     |    6 ++++-
 2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/data/speeddial-head.html b/data/speeddial-head.html
index 8152afe..2e01507 100644
--- a/data/speeddial-head.html
+++ b/data/speeddial-head.html
@@ -30,7 +30,7 @@
     }
 
     #content {
-        margin-top: 40px;
+        margin-top: 10px;
     }
 
     div.shortcut {
@@ -140,6 +140,20 @@
         opacity: 1;
         color: rgba(0,0,0,0.5);
     }
+
+    div.config {
+        padding: 12px;
+        text-align: left;
+    }
+
+    div.config span {
+        color: #ccc;
+    }
+
+    div.config span:hover {
+        color: #999;
+        cursor: pointer;
+    }
     </style>
 
     <script type="text/javascript">
@@ -252,7 +266,7 @@
     var buildSpeeddial = function ()
     {
         var width = 3;
-        if (sc.width != undefined)
+        if (sc.width)
         {
             width = sc.width;
             $('wrap').style.width = (width * 220) + 'px';
@@ -305,6 +319,39 @@
         });
     }
 
+    var setWidth = function ()
+    {
+        var width = prompt ("{enter_dial_width}", "");
+        if (!width || isNaN (width)) return;
+
+        sc.width = width;
+
+        $('content').empty ();
+        buildSpeeddial ();
+
+        console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
+    }
+
+    var setCount = function ()
+    {
+        var count = prompt ("{enter_shortcut_count}", "");
+        if (!count || isNaN (count)) return;
+
+        sc.shortcuts = sc.shortcuts.slice (0, count);
+
+        var i = sc.shortcuts.length;
+        while (i < count)
+        {
+            i++;
+            sc.shortcuts.push ({"id" : "s" + i, "href" : "#", "title" : "", "img" : ""});
+        }
+
+        $('content').empty ();
+        buildSpeeddial ();
+
+        console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
+    }
+
     window.addEvent ('domready', function () {
         buildSpeeddial ();
     });
@@ -326,6 +373,10 @@
     </script>
 </head>
 <body>
+    <div class="config">
+        <span onclick="javascript:setWidth()">{set_dial_width}</span>
+        <span onclick="javascript:setCount()">{set_shortcut_count}</span>
+    </div>
     <div id="wrap">
         <div id="content">
         </div>
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 83f2035..1b8720d 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3483,7 +3483,11 @@ midori_view_set_uri (MidoriView*  view,
                 "{click_to_add}", _("Click to add a shortcut"),
                 "{enter_shortcut_address}", _("Enter shortcut address"),
                 "{enter_shortcut_name}", _("Enter shortcut title"),
-                "{are_you_sure}", _("Are you sure you want to delete this shortcut?"), NULL);
+                "{are_you_sure}", _("Are you sure you want to delete this shortcut?"),
+                "{set_dial_width}", _("Set number of columns"),
+                "{enter_dial_width}", _("Enter number of columns:"),
+                "{set_shortcut_count}", _("Set number of shortcuts"),
+                "{enter_shortcut_count}", _("Enter number of shortcuts:"),  NULL);
 
 
             midori_view_load_alternate_string (view,



More information about the Xfce4-commits mailing list