Author: pollux
Date: 2006-07-23 15:40:55 +0000 (Sun, 23 Jul 2006)
New Revision: 22516

Added:
   xfburn/trunk/xfburn/xfburn-notebook-tab.c
   xfburn/trunk/xfburn/xfburn-notebook-tab.h
Modified:
   xfburn/trunk/xfburn/Makefile.am
   xfburn/trunk/xfburn/xfburn-adding-progress.c
   xfburn/trunk/xfburn/xfburn-composition.c
   xfburn/trunk/xfburn/xfburn-compositions-notebook.c
   xfburn/trunk/xfburn/xfburn-data-composition.c
   xfburn/trunk/xfburn/xfburn-main-window.c
Log:
* rename some lost 'Compilation' into 'Composition'
* add the XfburnNotebookTab widget and use it in 
XfburnCompositionsNotebook



Modified: xfburn/trunk/xfburn/Makefile.am
===================================================================
--- xfburn/trunk/xfburn/Makefile.am     2006-07-23 12:52:08 UTC (rev 22515)
+++ xfburn/trunk/xfburn/Makefile.am     2006-07-23 15:40:55 UTC (rev 22516)
@@ -25,6 +25,7 @@
        xfburn-create-iso-from-composition-progress-dialog.h            \
        xfburn-progress-dialog.h                                        \
        xfburn-main-window.h                                            \
+       xfburn-notebook-tab.h                                           \
        xfburn-file-browser.h                                           \
        xfburn-data-composition.h                                       \
        xfburn-disc-usage.h                                             \
@@ -53,6 +54,7 @@
        xfburn-progress-dialog.c                                        \
        xfburn-main.c                                                   \
        xfburn-main-window.c                                            \
+       xfburn-notebook-tab.c                                           \
        xfburn-file-browser.c                                           \
        xfburn-data-composition.c                                       \
        xfburn-disc-usage.c                                             \

Modified: xfburn/trunk/xfburn/xfburn-adding-progress.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-adding-progress.c        2006-07-23 12:52:08 UTC 
(rev 22515)
+++ xfburn/trunk/xfburn/xfburn-adding-progress.c        2006-07-23 15:40:55 UTC 
(rev 22516)
@@ -86,7 +86,7 @@
   
   gtk_window_set_icon_name (GTK_WINDOW (win), GTK_STOCK_ADD);
   gtk_window_set_destroy_with_parent (GTK_WINDOW (win), TRUE);
-  gtk_window_set_title (GTK_WINDOW (win), _("Adding files to the 
compilation"));
+  gtk_window_set_title (GTK_WINDOW (win), _("Adding files to the 
composition"));
   
   vbox = gtk_vbox_new (FALSE, 5);
   gtk_widget_show (vbox);

Modified: xfburn/trunk/xfburn/xfburn-composition.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-composition.c    2006-07-23 12:52:08 UTC (rev 
22515)
+++ xfburn/trunk/xfburn/xfburn-composition.c    2006-07-23 15:40:55 UTC (rev 
22516)
@@ -23,6 +23,11 @@
 
 #include "xfburn-composition.h"
 
+enum {
+  NAME_CHANGED,
+  LAST_SIGNAL,
+};
+
 /*******************************************/
 /* interface definition and initialization */
 /*******************************************/

Modified: xfburn/trunk/xfburn/xfburn-compositions-notebook.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-compositions-notebook.c  2006-07-23 12:52:08 UTC 
(rev 22515)
+++ xfburn/trunk/xfburn/xfburn-compositions-notebook.c  2006-07-23 15:40:55 UTC 
(rev 22516)
@@ -28,17 +28,27 @@
 #include "xfburn-compositions-notebook.h"
 
 #include "xfburn-composition.h"
+#include "xfburn-notebook-tab.h"
 #include "xfburn-data-composition.h"
 
+#define XFBURN_COMPOSITIONS_NOTEBOOK_GET_PRIVATE(obj) 
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_COMPOSITIONS_NOTEBOOK, 
XfburnCompositionsNotebookPrivate))
+
+/* private members */
+typedef struct
+{
+  gpointer gna;
+} XfburnCompositionsNotebookPrivate;
+
+
+/* prototypes */
 static void xfburn_compositions_notebook_class_init 
(XfburnCompositionsNotebookClass * klass);
 static void xfburn_compositions_notebook_init (XfburnCompositionsNotebook * 
notebook);
 static void xfburn_compositions_notebook_finalize (GObject * object);
 
-typedef struct
-{
+static void cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, 
guint page_num, 
+                            XfburnCompositionsNotebookPrivate *priv);
 
-} XfburnCompositionsNotebookPrivate;
-
+/* static member */
 static GtkNotebookClass *parent_class = NULL;
 
 GtkType
@@ -82,19 +92,48 @@
 }
 
 static void
+cb_move_focus_out (GtkNotebook *notebook, GtkDirectionType *arg1, 
XfburnCompositionsNotebookPrivate *priv) 
+{
+  guint page_num;
+  
+  page_num = gtk_notebook_get_current_page (notebook);
+  DBG ("%d", page_num);
+}
+
+static void
 xfburn_compositions_notebook_init (XfburnCompositionsNotebook * notebook)
 {
+  XfburnCompositionsNotebookPrivate *priv = 
XFBURN_COMPOSITIONS_NOTEBOOK_GET_PRIVATE (notebook);
+  
+  g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK 
(cb_switch_page), priv);
+  g_signal_connect (G_OBJECT (notebook), "move-focus-out", G_CALLBACK 
(cb_move_focus_out), priv);
 }
 
 /*************/
 /* internals */
 /*************/
+typedef struct {
+  GtkNotebook *notebook;
+  GtkWidget *child;
+} CompositionCloseInfo;
+
 static void
-cb_composition_close (GtkButton *button, gint page_num)
+cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, 
XfburnCompositionsNotebookPrivate *priv)
 {
-  DBG ("%d", page_num);
+
 }
 
+static void
+cb_composition_close (GtkButton *button, CompositionCloseInfo *info)
+{
+  guint page_num;
+  
+  page_num = gtk_notebook_page_num (info->notebook, info->child);
+  gtk_notebook_remove_page (info->notebook, page_num);
+  
+  g_free (info);
+}
+
 /**********/
 /* public */
 /**********/
@@ -118,7 +157,7 @@
   switch (type) {
     case XFBURN_DATA_COMPOSITION:
       composition = xfburn_data_composition_new ();
-      label_text = g_strdup_printf ("%s %d", _("Data compilation"), ++i);
+      label_text = g_strdup_printf ("%s %d", _("Data composition"), ++i);
       break;
     case XFBURN_AUDIO_COMPOSITION:
       DBG ("later");
@@ -126,31 +165,21 @@
   }
   
   if (composition) {
-       GtkWidget *label = NULL;
-       GtkWidget *hbox, *button_close, *img;
-       gint page_num;
-
-       hbox = gtk_hbox_new (FALSE, 2);
-       gtk_widget_show (hbox);
+    GtkWidget *tab = NULL;
+    guint page_num;
+    CompositionCloseInfo *info;
+    
+    tab = xfburn_notebook_tab_new (label_text);
+    gtk_widget_show (tab);
        
-       label = gtk_label_new (label_text);
-       gtk_widget_show (label);
-       gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
-       
-       button_close = gtk_button_new ();
-       gtk_button_set_relief (GTK_BUTTON (button_close), GTK_RELIEF_NONE);
-       gtk_widget_show (button_close);
-       
-       img = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
-       gtk_widget_show (img);
-       gtk_container_add (GTK_CONTAINER (button_close), img);
-       gtk_box_pack_start (GTK_BOX (hbox), button_close, FALSE, FALSE, 0);
-       
     gtk_widget_show (composition);
-    page_num = gtk_notebook_append_page(GTK_NOTEBOOK (notebook), composition, 
hbox);
-       gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
+    page_num = gtk_notebook_append_page(GTK_NOTEBOOK (notebook), composition, 
tab);
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
        
-       g_signal_connect (G_OBJECT (button_close), "clicked", G_CALLBACK 
(cb_composition_close), GINT_TO_POINTER (page_num));
+    info = g_new0 (CompositionCloseInfo, 1);
+    info->notebook = GTK_NOTEBOOK (notebook);
+    info->child = composition;
+    g_signal_connect (G_OBJECT (tab), "button-close-clicked", G_CALLBACK 
(cb_composition_close), info);
   }
   
   g_free (label_text);

Modified: xfburn/trunk/xfburn/xfburn-data-composition.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-data-composition.c       2006-07-23 12:52:08 UTC 
(rev 22515)
+++ xfburn/trunk/xfburn/xfburn-data-composition.c       2006-07-23 15:40:55 UTC 
(rev 22516)
@@ -503,7 +503,7 @@
 
   if (gtk_tree_model_get_iter (model, &iter, real_path)) {
     if (file_exists_on_same_level (model, real_path, TRUE, newtext)) {
-      xfce_err (_("A file with the same name is already present in the 
compilation"));
+      xfce_err (_("A file with the same name is already present in the 
composition"));
     }
     else {
       gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 
DATA_COMPOSITION_COLUMN_CONTENT, newtext, -1);
@@ -704,7 +704,7 @@
     }
     
     if (file_exists_on_same_level (model, tree_path, FALSE, name)) {
-      xfce_err (_("A file with the same name is already present in the 
compilation"));
+      xfce_err (_("A file with the same name is already present in the 
composition"));
 
       gtk_tree_path_free (tree_path);
       g_free (parent);

Modified: xfburn/trunk/xfburn/xfburn-main-window.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main-window.c    2006-07-23 12:52:08 UTC (rev 
22515)
+++ xfburn/trunk/xfburn/xfburn-main-window.c    2006-07-23 15:40:55 UTC (rev 
22516)
@@ -429,6 +429,7 @@
     {"Piarres Beobide", "[EMAIL PROTECTED]", "eu",},
     {"Jari Rahkonen", "[EMAIL PROTECTED]", "fi",},
     {"Etienne Collet", "[EMAIL PROTECTED]", "fr",},
+    {"Maximilian Schleiss", "[EMAIL PROTECTED]", "fr",},
     {"Attila SZERVÑC", "[EMAIL PROTECTED]", "hu",},
     {"Daichi Kawahata", "[EMAIL PROTECTED]", "ja",},
     {"Mantas", "[EMAIL PROTECTED]", "lt",},

Added: xfburn/trunk/xfburn/xfburn-notebook-tab.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-notebook-tab.c                           (rev 0)
+++ xfburn/trunk/xfburn/xfburn-notebook-tab.c   2006-07-23 15:40:55 UTC (rev 
22516)
@@ -0,0 +1,194 @@
+/* $Id$ */
+/*
+ *  Copyright (c) 2005-2006 Jean-François Wauthy ([EMAIL PROTECTED])
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* !HAVE_CONFIG_H */
+
+#include <gtk/gtk.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "xfburn-notebook-tab.h"
+
+#define XFBURN_NOTEBOOK_TAB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE 
((obj), XFBURN_TYPE_NOTEBOOK_TAB, XfburnNotebookTabPrivate))
+
+enum {
+  BUTTON_CLOSE_CLICKED,
+  LAST_SIGNAL,
+};
+
+enum {
+  PROP_0,
+  PROP_LABEL,
+};
+
+/* private members */
+typedef struct
+{
+  GtkWidget *label;
+  GtkWidget *button_close;
+} XfburnNotebookTabPrivate;
+
+
+/* prototypes */
+static void xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass);
+static void xfburn_notebook_tab_init (XfburnNotebookTab * tab);
+static void xfburn_notebook_tab_get_property (GObject *object, guint prop_id, 
GValue *value, GParamSpec *pspec);
+static void xfburn_notebook_tab_set_property (GObject *object, guint prop_id, 
const GValue *value, GParamSpec *pspec);
+
+static void cb_composition_close (GtkButton *button, XfburnNotebookTab *tab);
+
+/* static member */
+static GtkHBoxClass *parent_class = NULL;
+static guint notebook_tab_signals[LAST_SIGNAL];
+
+/************************/
+/* class initiliazation */
+/************************/
+GtkType
+xfburn_notebook_tab_get_type ()
+{
+  static GtkType type = 0;
+
+  if (type == 0) {
+    static const GTypeInfo our_info = {
+      sizeof (XfburnNotebookTabClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) xfburn_notebook_tab_class_init,
+      NULL,
+      NULL,
+      sizeof (XfburnNotebookTab),
+      0,
+      (GInstanceInitFunc) xfburn_notebook_tab_init,
+    };
+
+    type = g_type_register_static (GTK_TYPE_HBOX, "XfburnNotebookTab", 
&our_info, 0);
+  }
+
+  return type;
+}
+
+static void
+xfburn_notebook_tab_class_init (XfburnNotebookTabClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (XfburnNotebookTabPrivate));
+
+  parent_class = g_type_class_peek_parent (klass);
+  
+  object_class->set_property = xfburn_notebook_tab_set_property;
+  object_class->get_property = xfburn_notebook_tab_get_property;
+  
+  notebook_tab_signals[BUTTON_CLOSE_CLICKED] = g_signal_new 
("button-close-clicked",
+                                                             G_TYPE_FROM_CLASS 
(object_class), G_SIGNAL_ACTION,
+                                                             G_STRUCT_OFFSET 
(XfburnNotebookTabClass, button_close_clicked),
+                                                             NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+  
+  g_object_class_install_property (object_class, PROP_LABEL, 
+                                   g_param_spec_string ("label", _("Label"), 
_("The text of the label"), 
+                                                        NULL, 
G_PARAM_READWRITE));
+}
+
+static void
+xfburn_notebook_tab_init (XfburnNotebookTab * tab)
+{
+  XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (tab);
+  GtkBox *hbox = GTK_BOX (tab);
+  GtkWidget *img;
+  
+  priv->label = gtk_label_new ("");
+  gtk_widget_show (priv->label);
+  gtk_box_pack_start (hbox, priv->label, TRUE, TRUE, 0);
+    
+  priv->button_close = gtk_button_new ();
+  gtk_button_set_relief (GTK_BUTTON (priv->button_close), GTK_RELIEF_NONE);
+  gtk_widget_show (priv->button_close);
+       
+  img = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+  gtk_widget_show (img);
+  gtk_container_add (GTK_CONTAINER (priv->button_close), img);
+  gtk_box_pack_start (hbox, priv->button_close, FALSE, FALSE, 0);
+
+  g_signal_connect (G_OBJECT (priv->button_close), "clicked", G_CALLBACK 
(cb_composition_close), tab);
+}
+
+static void
+xfburn_notebook_tab_get_property (GObject *object, guint prop_id, GValue 
*value, GParamSpec *pspec)
+{
+  XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (object);
+
+  switch (prop_id) {
+    case PROP_LABEL:
+      g_value_set_string (value, gtk_label_get_text (GTK_LABEL (priv->label)));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+xfburn_notebook_tab_set_property (GObject *object, guint prop_id, const GValue 
*value, GParamSpec *pspec)
+{
+  XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (object);
+  
+  switch (prop_id) {
+    case PROP_LABEL:
+      gtk_label_set_text (GTK_LABEL (priv->label), g_value_get_string (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+                                          
+/*************/
+/* internals */
+/*************/
+static void
+cb_composition_close (GtkButton *button, XfburnNotebookTab *tab)
+{
+  g_signal_emit (G_OBJECT (tab), notebook_tab_signals[BUTTON_CLOSE_CLICKED], 
0);
+}
+
+/**********/
+/* public */
+/**********/
+GtkWidget *
+xfburn_notebook_tab_new (const gchar *label)
+{
+  GtkWidget *obj;
+
+  obj = GTK_WIDGET (g_object_new (XFBURN_TYPE_NOTEBOOK_TAB, "homogeneous", 
FALSE, "label", label, NULL));
+
+  return obj;
+}
+
+void
+xfburn_notebook_tab_set_label (XfburnNotebookTab *tab, const gchar *label)
+{
+  XfburnNotebookTabPrivate *priv = XFBURN_NOTEBOOK_TAB_GET_PRIVATE (tab);
+  
+  gtk_label_set_text (GTK_LABEL (priv->label), label);
+}


Property changes on: xfburn/trunk/xfburn/xfburn-notebook-tab.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: xfburn/trunk/xfburn/xfburn-notebook-tab.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-notebook-tab.h                           (rev 0)
+++ xfburn/trunk/xfburn/xfburn-notebook-tab.h   2006-07-23 15:40:55 UTC (rev 
22516)
@@ -0,0 +1,51 @@
+/* $Id$ */
+/*
+ * Copyright (c) 2005-2006 Jean-François Wauthy ([EMAIL PROTECTED])
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBURN_NOTEBOOK_TAB_H__
+#define __XFBURN_NOTEBOOK_TAB_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+#define XFBURN_TYPE_NOTEBOOK_TAB         (xfburn_notebook_tab_get_type ())
+#define XFBURN_NOTEBOOK_TAB(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
XFBURN_TYPE_NOTEBOOK_TAB, XfburnNotebookTab))
+#define XFBURN_NOTEBOOK_TAB_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), 
XFBURN_TYPE_NOTEBOOK_TAB, XfburnNotebookTabClass))
+#define XFBURN_IS_NOTEBOOK_TAB(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
XFBURN_TYPE_NOTEBOOK_TAB))
+#define XFBURN_IS_NOTEBOOK_TAB_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), 
XFBURN_TYPE_NOTEBOOK_TAB))
+#define XFBURN_NOTEBOOK_TAB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
XFBURN_TYPE_NOTEBOOK_TAB, XfburnNotebookTabClass))
+
+typedef struct
+{
+  GtkHBox parent;
+} XfburnNotebookTab;
+
+typedef struct
+{
+  GtkHBoxClass parent_class;
+  
+  void (*button_close_clicked) (XfburnNotebookTab *tab);
+} XfburnNotebookTabClass;
+
+GtkType xfburn_notebook_tab_get_type ();
+
+GtkWidget *xfburn_notebook_tab_new (const gchar *label);
+
+void xfburn_notebook_tab_set_label (XfburnNotebookTab *tab, const gchar 
*label);
+
+#endif /* XFBURN_NOTEBOOK_TAB_H */


Property changes on: xfburn/trunk/xfburn/xfburn-notebook-tab.h
___________________________________________________________________
Name: svn:keywords
   + Id

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to