[Xfce4-commits] <xfce4-profile-manager:master> Add some example-data.

Stephan Arts noreply at xfce.org
Sun Oct 9 15:26:03 CEST 2011


Updating branch refs/heads/master
         to c255e0037201439ca479f49468a5d6b48a97e37f (commit)
       from 23812cf0802b1e6e5f590bc9a1437c0d358ef291 (commit)

commit c255e0037201439ca479f49468a5d6b48a97e37f
Author: Stephan Arts <stephan at xfce.org>
Date:   Sun Oct 9 15:24:08 2011 +0200

    Add some example-data.

 src/main.c             |    3 +++
 src/main_window.c      |   42 ++++++++++++++++++++++++++++++++++++------
 src/main_window_ui.xml |    5 +++++
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c
index c54ec3b..93f17a9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,11 +23,14 @@
 #include <gtk/gtk.h>
 
 #include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <xfconf/xfconf.h>
 
 #include <libxfce4util/libxfce4util.h>
 
+#include "main_window.h"
+
 static gboolean version = FALSE;
 
 static GOptionEntry entries[] =
diff --git a/src/main_window.c b/src/main_window.c
index 4dd37fa..35ab005 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -57,12 +57,17 @@ struct _XfpmMainWindowPriv
 {
     GtkUIManager *ui_manager;
     GtkActionGroup *action_group;
+    GtkTextBuffer *text_buffer;
 };
 
 static GtkActionEntry action_entries[] =
 {
 /* Profile Toolbar */
-  { "apply", GTK_STOCK_APPLY, N_ ("_Apply"), NULL, N_ ("Apply the selected profile"), G_CALLBACK (NULL) }
+    { "apply", GTK_STOCK_APPLY, N_ ("_Apply"), NULL, N_ ("Apply the selected profile"), G_CALLBACK (NULL) },
+    { "edit", GTK_STOCK_PROPERTIES, N_ ("_Edit"), NULL, N_ ("Edit profile"), G_CALLBACK (NULL) },
+    { "new", "document-new", N_ ("_New"), NULL, N_ ("Create a new profile"), G_CALLBACK (NULL) },
+    { "open", "document-open", N_ ("_Open"), NULL, N_ ("Open profile from file"), G_CALLBACK (NULL) },
+    { "save", "document-save", N_ ("_Save"), NULL, N_ ("Save profile to file"), G_CALLBACK (NULL) },
 };
 
 GType
@@ -109,6 +114,7 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
     GtkTreeIter iter;
     GtkCellRenderer *renderer;
     GtkTreeViewColumn *column;
+    GtkTreeSelection *selection;
 
     GtkListStore *list_store = gtk_list_store_new (
             2,
@@ -172,7 +178,19 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
     content_area = gtk_dialog_get_content_area (
             GTK_DIALOG (dialog) );
 
-    label = gtk_label_new ( _("Some description\n") );
+    label = gtk_label_new (
+            _("The xfce4-profile-manager can be used to apply "
+              "preconfigured profiles\nto the xfce settings manager"
+              ) );
+    gtk_misc_set_alignment (
+        GTK_MISC (label),
+        0.0,
+        0.5);
+
+    gtk_misc_set_padding (
+        GTK_MISC (label),
+        4,
+        4);
 
     hpaned = gtk_hpaned_new ();
 
@@ -184,6 +202,17 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
     gtk_text_view_set_editable (
             GTK_TEXT_VIEW (text_view),
             FALSE );
+    gtk_text_view_set_cursor_visible (
+            GTK_TEXT_VIEW (text_view),
+            FALSE );
+
+    dialog->priv->text_buffer = gtk_text_view_get_buffer (
+            GTK_TEXT_VIEW (text_view) );
+
+    gtk_text_buffer_insert_at_cursor (
+            dialog->priv->text_buffer,
+            "\nProfile description",
+            strlen ("\nProfile description") );
 /******************/
 
 /******************/
@@ -238,6 +267,10 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
             GTK_TREE_VIEW (treeview),
             column);
 
+    selection = gtk_tree_view_get_selection (
+            GTK_TREE_VIEW (treeview) );
+    gtk_tree_selection_select_iter (selection, &iter);
+
     gtk_box_pack_end (
             GTK_BOX (vbox),
             treeview,
@@ -284,7 +317,7 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
 static void
 xfpm_main_window_class_init (GObjectClass *object_class)
 {
-    GParamSpec *pspec;
+    /* GParamSpec *pspec; */
 
     parent_class = g_type_class_peek_parent (XFPM_MAIN_WINDOW_CLASS (object_class));
 
@@ -297,7 +330,6 @@ xfpm_main_window_class_init (GObjectClass *object_class)
 static void
 xfpm_main_window_dispose (GObject *object)
 {
-    XfpmMainWindow *dialog = XFPM_MAIN_WINDOW (object);
 
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
@@ -309,8 +341,6 @@ xfpm_main_window_set_property    (GObject      *object,
                                       const GValue *value,
                                       GParamSpec   *pspec)
 {
-    XfpmMainWindow *dialog = XFPM_MAIN_WINDOW (object);
-
     switch (property_id)
     {
     }
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index 2e23fb5..54992b5 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -3,6 +3,11 @@
 
     -->
     <toolbar name="profile-toolbar">
+        <toolitem action="new"/>
+        <toolitem action="open"/>
+        <toolitem action="save"/>
+        <separator />
         <toolitem action="apply"/>
+        <toolitem action="edit"/>
     </toolbar>
 </ui>


More information about the Xfce4-commits mailing list