[Xfce4-commits] <xfce4-panel:devel> * New mokup for the launcher dialogs, more .desktop file orientated.

Nick Schermer nick at xfce.org
Tue Aug 11 20:26:35 CEST 2009


Updating branch refs/heads/devel
         to 706b00e6bb67ab6687252118aa492997af41d36a (commit)
       from a038d25a4cfc98674aae553ab118b0f64b8c96ef (commit)

commit 706b00e6bb67ab6687252118aa492997af41d36a
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Dec 31 17:36:06 2008 +0100

    * New mokup for the launcher dialogs, more .desktop file orientated.

 plugins/launcher/launcher-dialog.c     |  164 ++++++-
 plugins/launcher/launcher-dialog.glade |  796 ++++++++++++++++++++------------
 plugins/launcher/launcher.c            |   38 +-
 plugins/launcher/launcher.h            |    6 +-
 4 files changed, 679 insertions(+), 325 deletions(-)

diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index cd968fd..c358fef 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -27,11 +27,128 @@
 #include "launcher-dialog_glade.h"
 
 
+
 static void
-launcher_dialog_add_button_clicked (GtkWidget *button,
-                                    GtkWidget *menu)
+launcher_dialog_tree_selection_changed (GtkTreeSelection *selection,
+                                        GtkBuilder       *builder)
 {
+  GObject      *object;
+  GtkTreeModel *model;
+  GtkTreeIter   iter;
+  gint          n_children = -1, position = 0;
+  GtkTreePath  *path;
+
+  panel_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+  panel_return_if_fail (GTK_IS_BUILDER (builder));
+
+  if (gtk_tree_selection_get_selected (selection, &model, &iter))
+    {
+      /* get the number of launchers in the tree */
+      n_children = gtk_tree_model_iter_n_children (model, NULL);
+
+      /* get the position of the selected item in the tree */
+      path = gtk_tree_model_get_path (model, &iter);
+      position = gtk_tree_path_get_indices (path)[0];
+      gtk_tree_path_free (path);
+    }
+
+  /* update the sensitivity of the buttons */
+  object = gtk_builder_get_object (builder, "entry-remove");
+  gtk_widget_set_sensitive (GTK_WIDGET (object), n_children > 1);
+
+  object = gtk_builder_get_object (builder, "entry-move-up");
+  gtk_widget_set_sensitive (GTK_WIDGET (object), position > 0);
 
+  object = gtk_builder_get_object (builder, "entry-move-down");
+  gtk_widget_set_sensitive (GTK_WIDGET (object), n_children > position);
+  
+  object = gtk_builder_get_object (builder, "entry-edit");
+  gtk_widget_set_sensitive (GTK_WIDGET (object), position >= 0);
+}
+
+
+
+static void
+launcher_dialog_entry_button_clicked (GtkWidget  *button,
+                                      GtkBuilder *builder)
+{
+  const gchar *name;
+  GObject     *dialog;
+
+  panel_return_if_fail (GTK_IS_BUILDABLE (button));
+  panel_return_if_fail (GTK_IS_BUILDER (builder));
+
+  /* name of the button */
+  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
+
+  if (exo_str_is_equal (name, "entry-add"))
+    {
+      dialog = gtk_builder_get_object (builder, "dialog-add");
+      gtk_widget_show (GTK_WIDGET (dialog));
+    }
+  else if (exo_str_is_equal (name, "entry-remove"))
+    {
+
+    }
+  else if (exo_str_is_equal (name, "entry-move-up"))
+    {
+
+    }
+  else if (exo_str_is_equal (name, "entry-move-down"))
+    {
+
+    }
+  else /* entry-edit */
+    {
+      dialog = gtk_builder_get_object (builder, "dialog-editor");
+      gtk_widget_show (GTK_WIDGET (dialog));
+    }
+}
+
+
+
+static void
+launcher_dialog_response (GtkWidget      *dialog,
+                          gint            response_id,
+                          LauncherPlugin *plugin)
+{
+  panel_return_if_fail (GTK_IS_DIALOG (dialog));
+  panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
+
+  if (G_UNLIKELY (response_id == 1))
+    {
+      /* TODO open help */
+    }
+  else
+    {
+      /* destroy the dialog */
+      gtk_widget_destroy (dialog);
+    }
+}
+
+
+static void
+launcher_dialog_editor_response (GtkWidget      *dialog,
+                                 gint            response_id,
+                                 LauncherPlugin *plugin)
+{
+  panel_return_if_fail (GTK_IS_DIALOG (dialog));
+  panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
+
+  gtk_widget_hide (dialog);
+}
+
+
+
+static void
+launcher_dialog_add_response (GtkWidget      *dialog,
+                              gint            response_id,
+                              LauncherPlugin *plugin)
+{
+  panel_return_if_fail (GTK_IS_DIALOG (dialog));
+  panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
+
+  gtk_widget_hide (dialog);
 }
 
 
@@ -39,27 +156,41 @@ launcher_dialog_add_button_clicked (GtkWidget *button,
 void
 launcher_dialog_show (LauncherPlugin *plugin)
 {
-  GtkBuilder *builder;
-  GObject    *dialog;
-  GObject    *object;
+  GtkBuilder       *builder;
+  GObject          *dialog;
+  GObject          *object;
+  guint             i;
+  GtkTreeSelection *selection;
+  const gchar      *entry_names[] = { "entry-add", "entry-remove", "entry-move-up", "entry-move-down", "entry-edit" };
 
   panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
 
   builder = gtk_builder_new ();
   if (gtk_builder_add_from_string (builder, launcher_dialog_glade, launcher_dialog_glade_length, NULL))
     {
+      /* get dialog from builder, release builder when dialog is destroyed */
       dialog = gtk_builder_get_object (builder, "dialog");
       g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
       xfce_panel_plugin_take_window (XFCE_PANEL_PLUGIN (plugin), GTK_WINDOW (dialog));
+      g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (launcher_dialog_response), plugin);
 
+      /* block plugin, release block when the dialog is destroyed */
       xfce_panel_plugin_block_menu (XFCE_PANEL_PLUGIN (plugin));
       g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) xfce_panel_plugin_unblock_menu, plugin);
 
-      object = gtk_builder_get_object (builder, "close-button");
-      g_signal_connect_swapped (G_OBJECT (object), "clicked", G_CALLBACK (gtk_widget_destroy), dialog);
+      /* connect entry buttons */
+      for (i = 0; i < G_N_ELEMENTS (entry_names); i++)
+        {
+          object = gtk_builder_get_object (builder, entry_names[i]);
+          g_signal_connect (G_OBJECT (object), "clicked", G_CALLBACK (launcher_dialog_entry_button_clicked), builder);
+        }
 
-      object = gtk_builder_get_object (builder, "entry-add");
-      g_signal_connect (G_OBJECT (object), "clicked", G_CALLBACK (launcher_dialog_add_button_clicked), NULL);
+      /* setup treeview selection */
+      object = gtk_builder_get_object (builder, "entry-treeview");
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object));
+      gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+      g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (launcher_dialog_tree_selection_changed), builder);
+      launcher_dialog_tree_selection_changed (selection, builder);
 
       /* connect binding to the advanced properties */
       object = gtk_builder_get_object (builder, "disable-tooltips");
@@ -73,12 +204,23 @@ launcher_dialog_show (LauncherPlugin *plugin)
 
       object = gtk_builder_get_object (builder, "arrow-position");
       xfconf_g_property_bind (plugin->channel, "/arrow-position", G_TYPE_UINT, object, "active");
-
+      
+      /* setup responses for the other dialogs */
+      object = gtk_builder_get_object (builder, "dialog-editor");
+      g_signal_connect (G_OBJECT (object), "response", G_CALLBACK (launcher_dialog_editor_response), plugin);
+      g_signal_connect (G_OBJECT (object), "delete-event", G_CALLBACK (exo_noop_true), NULL);
+      
+      object = gtk_builder_get_object (builder, "dialog-add");
+      g_signal_connect (G_OBJECT (object), "response", G_CALLBACK (launcher_dialog_add_response), plugin);
+      g_signal_connect (G_OBJECT (object), "delete-event", G_CALLBACK (exo_noop_true), NULL);
+
+      /* show the dialog */
       gtk_widget_show (GTK_WIDGET (dialog));
     }
   else
     {
-      /* release the builder */
+      /* release the builder and fire error */
       g_object_unref (G_OBJECT (builder));
+      panel_assert_not_reached ();
     }
 }
diff --git a/plugins/launcher/launcher-dialog.glade b/plugins/launcher/launcher-dialog.glade
index 56498e4..374f6d3 100644
--- a/plugins/launcher/launcher-dialog.glade
+++ b/plugins/launcher/launcher-dialog.glade
@@ -2,7 +2,7 @@
 <interface>
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-requires libxfce4ui 0.0 -->
-  <!-- interface-naming-policy toplevel-contextual -->
+  <!-- interface-naming-policy project-wide -->
   <object class="GtkListStore" id="arrow-position-store">
     <columns>
       <!-- column-name title -->
@@ -31,7 +31,8 @@
   </object>
   <object class="XfceTitledDialog" id="dialog">
     <property name="title" translatable="yes">Launcher Properties</property>
-    <property name="window_position">center</property>
+    <property name="default_width">350</property>
+    <property name="default_height">400</property>
     <property name="icon_name">gtk-properties</property>
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
@@ -40,49 +41,52 @@
         <property name="visible">True</property>
         <property name="spacing">2</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="GtkNotebook" id="notebook2">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="border_width">6</property>
             <child>
-              <object class="GtkHPaned" id="hpaned1">
+              <object class="GtkHBox" id="hbox1">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
                 <property name="border_width">6</property>
+                <property name="spacing">6</property>
                 <child>
-                  <object class="GtkVBox" id="vbox1">
+                  <object class="GtkScrolledWindow" id="scrolledwindow2">
                     <property name="visible">True</property>
-                    <property name="spacing">6</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <property name="shadow_type">etched-in</property>
                     <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow1">
+                      <object class="GtkTreeView" id="entry-treeview">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">automatic</property>
-                        <property name="vscrollbar_policy">automatic</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <object class="GtkTreeView" id="entry-treeview">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="headers_visible">False</property>
-                          </object>
-                        </child>
                       </object>
-                      <packing>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="yalign">0</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
                     <child>
-                      <object class="GtkHBox" id="hbox1">
+                      <object class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
                         <property name="spacing">6</property>
+                        <property name="homogeneous">True</property>
                         <child>
-                          <object class="GtkButton" id="entry-up">
+                          <object class="GtkButton" id="entry-move-up">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
+                            <property name="tooltip_text" translatable="yes">Move currently selected item up by one row</property>
                             <child>
-                              <object class="GtkImage" id="image1">
+                              <object class="GtkImage" id="image2">
                                 <property name="visible">True</property>
                                 <property name="stock">gtk-go-up</property>
                                 <property name="icon-size">4</property>
@@ -95,12 +99,13 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="entry-down">
+                          <object class="GtkButton" id="entry-move-down">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
+                            <property name="tooltip_text" translatable="yes">Move currently selected item down by one row</property>
                             <child>
-                              <object class="GtkImage" id="image2">
+                              <object class="GtkImage" id="image3">
                                 <property name="visible">True</property>
                                 <property name="stock">gtk-go-down</property>
                                 <property name="icon-size">4</property>
@@ -113,313 +118,68 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="entry-remove">
+                          <object class="GtkButton" id="entry-add">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
+                            <property name="tooltip_text" translatable="yes">Add new item to the launcher</property>
                             <child>
                               <object class="GtkImage" id="image4">
                                 <property name="visible">True</property>
-                                <property name="stock">gtk-remove</property>
+                                <property name="stock">gtk-add</property>
                                 <property name="icon-size">4</property>
                               </object>
                             </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="position">3</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="entry-add">
+                          <object class="GtkButton" id="entry-remove">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
+                            <property name="tooltip_text" translatable="yes">Remove currently selected item</property>
                             <child>
-                              <object class="GtkHBox" id="hbox3">
+                              <object class="GtkImage" id="image5">
                                 <property name="visible">True</property>
-                                <child>
-                                  <object class="GtkImage" id="image3">
-                                    <property name="visible">True</property>
-                                    <property name="stock">gtk-add</property>
-                                    <property name="icon-size">4</property>
-                                  </object>
-                                  <packing>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkArrow" id="arrow1">
-                                    <property name="visible">True</property>
-                                    <property name="arrow_type">down</property>
-                                  </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
+                                <property name="stock">gtk-remove</property>
+                                <property name="icon-size">4</property>
                               </object>
                             </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="position">4</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkFrame" id="frame3">
-                    <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
-                    <child>
-                      <object class="GtkTable" id="table3">
-                        <property name="visible">True</property>
-                        <property name="border_width">6</property>
-                        <property name="n_rows">7</property>
-                        <property name="n_columns">2</property>
-                        <property name="column_spacing">12</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="label16">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Name:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">entry-name</property>
-                          </object>
-                          <packing>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label17">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Description:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">entry-description</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label18">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Icon:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">entry-icon</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label19">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Co_mmand:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">entry-command</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label20">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Working Directory:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">entry-working-directory</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label21">
-                            <property name="visible">True</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">7</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="entry-name">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="entry-description">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkFileChooserButton" id="entry-working-directory">
-                            <property name="visible">True</property>
-                            <property name="action">select-folder</property>
-                            <property name="title" translatable="yes">Select A Working Directory</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkCheckButton" id="entry-terminal">
-                            <property name="label" translatable="yes">Run in _terminal</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="y_options">GTK_FILL</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="entry-startup-notify">
-                            <property name="label" translatable="yes">Use _statup notification</property>
+                          <object class="GtkButton" id="entry-edit">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment3">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="xscale">0</property>
-                            <child>
-                              <object class="GtkButton" id="entry-icon">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child>
-                                  <object class="GtkImage" id="image8">
-                                    <property name="visible">True</property>
-                                    <property name="stock">gtk-missing-image</property>
-                                    <property name="icon-size">5</property>
-                                  </object>
-                                </child>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkHBox" id="hbox4">
-                            <property name="visible">True</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkEntry" id="entry-command">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
+                            <property name="receives_default">True</property>
+                            <property name="tooltip_text" translatable="yes">Edit the currently selected item</property>
                             <child>
-                              <object class="GtkButton" id="entry-open">
+                              <object class="GtkImage" id="image6">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child>
-                                  <object class="GtkImage" id="image6">
-                                    <property name="visible">True</property>
-                                    <property name="stock">gtk-open</property>
-                                    <property name="icon-size">1</property>
-                                  </object>
-                                </child>
+                                <property name="stock">gtk-edit</property>
+                                <property name="icon-size">4</property>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="expand">False</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                       </object>
                     </child>
                   </object>
                   <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">True</property>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -434,7 +194,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="vbox2">
+              <object class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
                 <property name="border_width">6</property>
                 <property name="spacing">6</property>
@@ -525,7 +285,7 @@
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="label2">
+              <object class="GtkLabel" id="label5">
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">Advanced</property>
               </object>
@@ -544,7 +304,20 @@
             <property name="visible">True</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="close-button">
+              <object class="GtkButton" id="button1">
+                <property name="label" translatable="yes">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
                 <property name="label" translatable="yes">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -552,9 +325,429 @@
                 <property name="use_stock">True</property>
               </object>
               <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="1">button1</action-widget>
+      <action-widget response="0">button2</action-widget>
+    </action-widgets>
+  </object>
+  <object class="XfceTitledDialog" id="dialog-editor">
+    <property name="title" translatable="yes">Edit Custom Launcher</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="icon_name">applications-other</property>
+    <property name="type_hint">normal</property>
+    <property name="transient_for">dialog</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkTable" id="table3">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">7</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label16">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Name:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry-name</property>
+              </object>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label17">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">C_omment:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry-description</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label20">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Working Directory:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry-working-directory</property>
+              </object>
+              <packing>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label21">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">5</property>
+                <property name="bottom_attach">7</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry-name">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry-description">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFileChooserButton" id="entry-working-directory">
+                <property name="visible">True</property>
+                <property name="action">select-folder</property>
+                <property name="title" translatable="yes">Select A Working Directory</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="entry-terminal">
+                <property name="label" translatable="yes">Run in _terminal</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">5</property>
+                <property name="bottom_attach">6</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="entry-startup-notify">
+                <property name="label" translatable="yes">Use _statup notification</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">6</property>
+                <property name="bottom_attach">7</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Comm_and:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Icon:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox3">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkEntry" id="entry-command3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="entry-open3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <object class="GtkImage" id="image4">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-open</property>
+                        <property name="icon-size">1</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="xscale">0</property>
+                <child>
+                  <object class="GtkButton" id="entry-iconn">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <object class="GtkImage" id="image5">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-missing-image</property>
+                        <property name="icon-size">5</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button3">
+                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button4">
+                <property name="label" translatable="yes">gtk-save</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">button3</action-widget>
+      <action-widget response="2">button4</action-widget>
+    </action-widgets>
+  </object>
+  <object class="XfceTitledDialog" id="dialog-add">
+    <property name="title" translatable="yes">Add New Entry</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="default_width">400</property>
+    <property name="default_height">400</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="icon_name">gtk-add</property>
+    <property name="type_hint">normal</property>
+    <property name="transient_for">dialog</property>
+    <property name="has_separator">False</property>
+    <property name="subtitle" translatable="yes">Add a new or custom launcher entry</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox4">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_Search:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">add-search</property>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="add-search">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">etched-in</property>
+                <child>
+                  <object class="GtkTreeView" id="add-treeview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area4">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button5">
+                <property name="label" translatable="yes">gtk-add</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button6">
+                <property name="label" translatable="yes">C_ustom</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="image">image1</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button7">
+                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -565,7 +758,20 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">close-button</action-widget>
+      <action-widget response="2">button5</action-widget>
+      <action-widget response="3">button6</action-widget>
+      <action-widget response="0">button7</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="stock">gtk-new</property>
+    <property name="icon-size">4</property>
+  </object>
+  <object class="GtkSizeGroup" id="sizegroup1">
+    <property name="mode">both</property>
+    <widgets>
+      <widget name="entry-iconn"/>
+    </widgets>
+  </object>
 </interface>
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index ca7b3b3..1b94842 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -178,6 +178,7 @@ launcher_plugin_init (LauncherPlugin *plugin)
 }
 
 
+
 static void
 launcher_plugin_property_changed (XfconfChannel  *channel,
                                   const gchar    *property_name,
@@ -192,19 +193,19 @@ launcher_plugin_property_changed (XfconfChannel  *channel,
   panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
   panel_return_if_fail (plugin->channel == channel);
 
-  if (strcmp (property_name, "/disable-tooltips") == 0)
+  if (exo_str_is_equal (property_name, "/disable-tooltips"))
     {
       plugin->disable_tooltips = g_value_get_boolean (value);
     }
-  else if (strcmp (property_name, "/move-first") == 0)
+  else if (exo_str_is_equal (property_name, "/move-first"))
     {
       plugin->move_first = g_value_get_boolean (value);
     }
-  else if (strcmp (property_name, "/show-labels") == 0)
+  else if (exo_str_is_equal (property_name, "/show-labels"))
     {
       plugin->show_labels = g_value_get_boolean (value);
     }
-  else if (strcmp (property_name, "/arrow-position") == 0)
+  else if (exo_str_is_equal (property_name, "/arrow-position"))
     {
       plugin->arrow_position = MIN (g_value_get_uint (value), ARROW_POS_MAX);
     }
@@ -214,7 +215,7 @@ launcher_plugin_property_changed (XfconfChannel  *channel,
       entry = g_list_nth_data (plugin->entries, nth);
       if (G_LIKELY (entry))
         {
-          if (strcmp (property, "name") == 0)
+          if (exo_str_is_equal (property, "name"))
             {
               g_free (entry->name);
               entry->name = g_value_dup_string (value);
@@ -222,36 +223,41 @@ launcher_plugin_property_changed (XfconfChannel  *channel,
               if (nth > 0 || plugin->show_labels)
                 launcher_plugin_rebuild (plugin, FALSE);
             }
-          else if (strcmp (property, "comment") == 0)
+          else if (exo_str_is_equal (property, "comment"))
             {
               g_free (entry->comment);
               entry->comment = g_value_dup_string (value);
             }
-          else if (strcmp (property, "icon") == 0)
+          else if (exo_str_is_equal (property, "icon"))
             {
               g_free (entry->icon);
               entry->icon = g_value_dup_string (value);
 
               launcher_plugin_rebuild (plugin, (nth == 0));
             }
-          else if (strcmp (property, "command") == 0)
+          else if (exo_str_is_equal (property, "command"))
             {
               g_free (entry->exec);
               entry->exec = g_value_dup_string (value);
             }
-          else if (strcmp (property, "working-directory") == 0)
+          else if (exo_str_is_equal (property, "working-directory"))
             {
               g_free (entry->path);
               entry->path = g_value_dup_string (value);
             }
-          else if (strcmp (property, "terminal") == 0)
-            entry->terminal = g_value_get_boolean (value);
+          else if (exo_str_is_equal (property, "terminal"))
+            {
+              entry->terminal = g_value_get_boolean (value);
+            }
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
-          else if (strcmp (property, "startup-notify") == 0)
-            entry->startup_notify = g_value_get_boolean (value);
+          else if (exo_str_is_equal (property, "startup-notify"))
+            {
+              entry->startup_notify = g_value_get_boolean (value);
+            }
 #endif
         }
 
+      /* cleanup */
       g_free (property);
     }
 }
@@ -418,7 +424,7 @@ launcher_plugin_save (XfcePanelPlugin *panel_plugin)
       entry = li->data;
 
       g_snprintf (buf, sizeof (buf), "/entries/entry-%d/name", i);
-      if (entry->name)
+      if (G_LIKELY (entry->name))
         xfconf_channel_set_string (plugin->channel, buf, entry->name);
       else
         xfconf_channel_reset_property (plugin->channel, buf, FALSE);
@@ -430,13 +436,13 @@ launcher_plugin_save (XfcePanelPlugin *panel_plugin)
         xfconf_channel_reset_property (plugin->channel, buf, FALSE);
 
       g_snprintf (buf, sizeof (buf), "/entries/entry-%d/icon", i);
-      if (entry->icon)
+      if (G_LIKELY (entry->icon))
         xfconf_channel_set_string (plugin->channel, buf, entry->icon);
       else
         xfconf_channel_reset_property (plugin->channel, buf, FALSE);
 
       g_snprintf (buf, sizeof (buf), "/entries/entry-%d/command", i);
-      if (entry->exec)
+      if (G_LIKELY (entry->exec))
         xfconf_channel_set_string (plugin->channel, buf, entry->exec);
       else
         xfconf_channel_reset_property (plugin->channel, buf, FALSE);
diff --git a/plugins/launcher/launcher.h b/plugins/launcher/launcher.h
index 9c37a04..211063a 100644
--- a/plugins/launcher/launcher.h
+++ b/plugins/launcher/launcher.h
@@ -38,10 +38,10 @@ typedef enum   _LauncherPluginArrowPos LauncherPluginArrowPos;
 
 #define LIST_HAS_ONE_ENTRY(list)             ((list) != NULL && (list)->next == NULL)
 #define LIST_HAS_TWO_OR_MORE_ENTRIES(list)   ((list) != NULL && (list)->next != NULL)
-#define launcher_plugin_filenames_free(list) G_STMT_START{ \
+#define launcher_plugin_filenames_free(list) G_STMT_START { \
                                              g_slist_foreach (list, (GFunc) g_free, NULL); \
                                              g_slist_free (list); \
-                                             }G_STMT_END
+                                             } G_STMT_END
 
 enum _LauncherPluginArrowPos
 {
@@ -51,7 +51,7 @@ enum _LauncherPluginArrowPos
   ARROW_POS_TOP,
   ARROW_POS_BOTTOM,
   ARROW_POS_INSIDE_BUTTON,
-  
+
   ARROW_POS_MIN = ARROW_POS_DEFAULT,
   ARROW_POS_MAX = ARROW_POS_INSIDE_BUTTON
 };



More information about the Xfce4-commits mailing list