Author: pollux
Date: 2006-07-20 22:14:57 +0000 (Thu, 20 Jul 2006)
New Revision: 22500
Added:
xfburn/trunk/xfburn/xfburn-adding-progress.c
xfburn/trunk/xfburn/xfburn-adding-progress.h
Modified:
xfburn/trunk/xfburn/Makefile.am
xfburn/trunk/xfburn/xfburn-disc-content.c
xfburn/trunk/xfburn/xfburn-disc-content.h
xfburn/trunk/xfburn/xfburn-main-window.c
xfburn/trunk/xfburn/xfburn-main-window.h
Log:
* avoid using a kind of signal proxy in XfburnDiscContent
* prepared a progress bar dialog to show while adding files to the
compilation (doesn't work so far so it's disabled)
Modified: xfburn/trunk/xfburn/Makefile.am
===================================================================
--- xfburn/trunk/xfburn/Makefile.am 2006-07-20 20:59:20 UTC (rev 22499)
+++ xfburn/trunk/xfburn/Makefile.am 2006-07-20 22:14:57 UTC (rev 22500)
@@ -9,6 +9,7 @@
xfburn_headers = \
xfburn-global.h \
+ xfburn-adding-progress.h \
xfburn-blank-cd-dialog.h \
xfburn-blank-cd-progress-dialog.h \
xfburn-burn-composition-dialog.h \
@@ -33,6 +34,7 @@
xfburn_SOURCES = \
$(xfburn_headers) \
+ xfburn-adding-progress.c \
xfburn-blank-cd-dialog.c \
xfburn-blank-cd-progress-dialog.c \
xfburn-burn-composition-dialog.c \
Added: xfburn/trunk/xfburn/xfburn-adding-progress.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-adding-progress.c
(rev 0)
+++ xfburn/trunk/xfburn/xfburn-adding-progress.c 2006-07-20 22:14:57 UTC
(rev 22500)
@@ -0,0 +1,128 @@
+/* $Id$ */
+/*
+ * Copyright (c) 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-adding-progress.h"
+
+#define XFBURN_ADDING_PROGRESS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE
((obj), XFBURN_TYPE_ADDING_PROGRESS, XfburnAddingProgressPrivate))
+
+/* private struct */
+typedef struct
+{
+ GtkWidget *progress_bar;
+} XfburnAddingProgressPrivate;
+
+/* prototypes */
+static void xfburn_adding_progress_class_init (XfburnAddingProgressClass *);
+static void xfburn_adding_progress_init (XfburnAddingProgress *);
+
+/* globals */
+static GtkWindowClass *parent_class = NULL;
+
+/******************************/
+/* XfburnAddingProgress class */
+/******************************/
+GtkType
+xfburn_adding_progress_get_type (void)
+{
+ static GtkType adding_progress_type = 0;
+
+ if (!adding_progress_type)
+ {
+ static const GTypeInfo adding_progress_info = {
+ sizeof (XfburnAddingProgressClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) xfburn_adding_progress_class_init,
+ NULL,
+ NULL,
+ sizeof (XfburnAddingProgress),
+ 0,
+ (GInstanceInitFunc) xfburn_adding_progress_init
+ };
+
+ adding_progress_type = g_type_register_static (GTK_TYPE_WINDOW,
"XfburnAddingProgress", &adding_progress_info, 0);
+ }
+
+ return adding_progress_type;
+}
+
+static void
+xfburn_adding_progress_class_init (XfburnAddingProgressClass * klass)
+{
+
+ g_type_class_add_private (klass, sizeof (XfburnAddingProgressPrivate));
+
+ parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+xfburn_adding_progress_init (XfburnAddingProgress * win)
+{
+ XfburnAddingProgressPrivate *priv = XFBURN_ADDING_PROGRESS_GET_PRIVATE (win);
+ GtkWidget *vbox;
+
+ 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"));
+
+ vbox = gtk_vbox_new (FALSE, 5);
+ gtk_widget_show (vbox);
+ gtk_container_add (GTK_CONTAINER (win), vbox);
+
+ priv->progress_bar = gtk_progress_bar_new ();
+ gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (priv->progress_bar), 0.1);
+ gtk_widget_show (priv->progress_bar);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->progress_bar, TRUE, TRUE, 0);
+
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar), 0.5);
+}
+
+/* internals */
+
+/******************/
+/* public methods */
+/******************/
+GtkWidget *
+xfburn_adding_progress_new (void)
+{
+ GtkWidget *obj;
+
+ obj = g_object_new (xfburn_adding_progress_get_type (), NULL);
+
+ gtk_widget_realize (obj);
+ return obj;
+}
+
+void
+xfburn_adding_progress_pulse (XfburnAddingProgress *adding_progress)
+{
+ XfburnAddingProgressPrivate *priv = XFBURN_ADDING_PROGRESS_GET_PRIVATE
(adding_progress);
+
+ DBG ("pulse");
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
+ gtk_widget_realize (priv->progress_bar);
+ gtk_widget_queue_draw (priv->progress_bar);
+}
Property changes on: xfburn/trunk/xfburn/xfburn-adding-progress.c
___________________________________________________________________
Name: svn:keywords
+ Id
Added: xfburn/trunk/xfburn/xfburn-adding-progress.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-adding-progress.h
(rev 0)
+++ xfburn/trunk/xfburn/xfburn-adding-progress.h 2006-07-20 22:14:57 UTC
(rev 22500)
@@ -0,0 +1,55 @@
+/* $Id$ */
+/*
+ * Copyright (c) 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_ADDING_PROGRESS_H__
+#define __XFBURN_ADDING_PROGRESS_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+#define XFBURN_TYPE_ADDING_PROGRESS
(xfburn_adding_progress_get_type ())
+#define XFBURN_ADDING_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST
((obj), XFBURN_TYPE_ADDING_PROGRESS, XfburnAddingProgress))
+#define XFBURN_ADDING_PROGRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST
((klass), XFBURN_TYPE_ADDING_PROGRESS, XfburnAddingProgressClass))
+#define XFBURN_IS_ADDING_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE
((obj), XFBURN_TYPE_ADDING_PROGRESS))
+#define XFBURN_IS_ADDING_PROGRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), XFBURN_TYPE_ADDING_PROGRESS))
+#define XFBURN_ADDING_PROGRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS
((obj), XFBURN_TYPE_ADDING_PROGRESS, XfburnAddingProgressClass))
+typedef struct _XfburnAddingProgress XfburnAddingProgress;
+typedef struct _XfburnAddingProgressClass XfburnAddingProgressClass;
+
+struct _XfburnAddingProgress
+{
+ GtkWindow window;
+};
+
+struct _XfburnAddingProgressClass
+{
+ GtkWindowClass parent_class;
+};
+
+GtkType xfburn_adding_progress_get_type (void);
+
+GtkWidget *xfburn_adding_progress_new (void);
+void xfburn_adding_progress_pulse (XfburnAddingProgress *adding_progress);
+
+G_END_DECLS
+#endif
Property changes on: xfburn/trunk/xfburn/xfburn-adding-progress.h
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: xfburn/trunk/xfburn/xfburn-disc-content.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-disc-content.c 2006-07-20 20:59:20 UTC (rev
22499)
+++ xfburn/trunk/xfburn/xfburn-disc-content.c 2006-07-20 22:14:57 UTC (rev
22500)
@@ -44,7 +44,13 @@
#include <exo/exo.h>
#include "xfburn-disc-content.h"
+
+#if 0
+#include "xfburn-adding-progress.h"
+#endif
+
#include "xfburn-disc-usage.h"
+#include "xfburn-main-window.h"
#include "xfburn-utils.h"
/* prototypes */
@@ -60,7 +66,6 @@
static gboolean cb_treeview_button_pressed (GtkTreeView * treeview,
GdkEventButton * event, XfburnDiscContent * dc);
static void cb_begin_burn (XfburnDiscUsage * du, XfburnDiscContent * dc);
-
static void cell_file_edited_cb (GtkCellRenderer * renderer, gchar * path,
gchar * newtext, XfburnDiscContent * dc);
static void content_drag_data_rcv_cb (GtkWidget *, GdkDragContext *, guint,
guint, GtkSelectionData *, guint, guint,
@@ -91,12 +96,6 @@
DISC_CONTENT_TYPE_DIRECTORY
} DiscContentType;
-enum
-{
- BEGIN_BURN,
- LAST_SIGNAL,
-};
-
struct XfburnDiscContentPrivate
{
GtkActionGroup *action_group;
@@ -105,6 +104,9 @@
GtkWidget *toolbar;
GtkWidget *content;
GtkWidget *disc_usage;
+#if 0
+ GtkWidget *progress;
+#endif
};
/* globals */
@@ -127,7 +129,6 @@
"import-session",
};
-static guint signals[LAST_SIGNAL];
static GdkPixbuf *icon_directory = NULL, *icon_file = NULL;
/***************************/
@@ -164,10 +165,6 @@
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = xfburn_disc_content_finalize;
-
- signals[BEGIN_BURN] = g_signal_new ("begin-burn", G_TYPE_FROM_CLASS
(object_class), G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (XfburnDiscContentClass,
begin_burn),
- NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void
@@ -272,6 +269,11 @@
g_signal_connect (G_OBJECT (disc_content->priv->content),
"button-press-event",
G_CALLBACK (cb_treeview_button_pressed), disc_content);
+#if 0
+ /* adding progress window */
+ disc_content->priv->progress = xfburn_adding_progress_new ();
+#endif
+
/* disc usage */
disc_content->priv->disc_usage = xfburn_disc_usage_new ();
gtk_box_pack_start (GTK_BOX (disc_content), disc_content->priv->disc_usage,
FALSE, FALSE, 5);
@@ -313,9 +315,12 @@
static void
cb_begin_burn (XfburnDiscUsage * du, XfburnDiscContent * dc)
{
- g_signal_emit (G_OBJECT (dc), signals[BEGIN_BURN], 0);
+ XfburnMainWindow *mainwin = xfburn_main_window_get_instance ();
+
+ xfburn_main_window_burn_composition (mainwin, dc);
}
+
static gboolean
cb_treeview_button_pressed (GtkTreeView * treeview, GdkEventButton * event,
XfburnDiscContent * dc)
{
@@ -591,6 +596,10 @@
GtkTreeIter *parent = NULL;
GtkTreePath *tree_path = NULL;
+#if 0
+ xfburn_adding_progress_pulse (XFBURN_ADDING_PROGRESS (dc->priv->progress));
+#endif
+
/* find parent */
switch (position){
case GTK_TREE_VIEW_DROP_BEFORE:
@@ -741,7 +750,7 @@
GtkTreeIter * insertion, GtkTreeViewDropPosition position)
{
struct stat s;
- gboolean ret = FALSE;
+ gboolean ret = FALSE;
if ((stat (path, &s) == 0)) {
gchar *basename = NULL;
@@ -787,6 +796,10 @@
else if (sd->target == gdk_atom_intern ("text/plain", FALSE)) {
const gchar *file = NULL;
+#if 0
+ gtk_widget_show (content->priv->progress);
+#endif
+
file = strtok ((gchar *) sd->data, "\n");
while (file) {
GtkTreeIter iter;
@@ -821,6 +834,9 @@
file = strtok (NULL, "\n");
}
+#if 0
+ gtk_widget_hide (content->priv->progress);
+#endif
gtk_drag_finish (dc, FALSE, (dc->action == GDK_ACTION_COPY), t);
}
}
Modified: xfburn/trunk/xfburn/xfburn-disc-content.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-disc-content.h 2006-07-20 20:59:20 UTC (rev
22499)
+++ xfburn/trunk/xfburn/xfburn-disc-content.h 2006-07-20 22:14:57 UTC (rev
22500)
@@ -47,8 +47,6 @@
struct _XfburnDiscContentClass
{
GtkVBoxClass parent_class;
-
- void (*begin_burn) (XfburnDiscContent *dc);
};
enum
Modified: xfburn/trunk/xfburn/xfburn-main-window.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main-window.c 2006-07-20 20:59:20 UTC (rev
22499)
+++ xfburn/trunk/xfburn/xfburn-main-window.c 2006-07-20 22:14:57 UTC (rev
22500)
@@ -47,11 +47,11 @@
/* prototypes */
static void xfburn_main_window_class_init (XfburnMainWindowClass *);
+static void xfburn_main_window_finalize (GObject *obj);
static void xfburn_main_window_init (XfburnMainWindow *);
static gboolean cb_delete_main_window (XfburnMainWindow *, GdkEvent *,
XfburnMainWindowPrivate *);
static void cb_edit_toolbars_view (ExoToolbarsView *, gpointer);
-static void cb_burn_composition (XfburnDiscContent *dc, XfburnMainWindow *
window);
static void xfburn_window_action_about (GtkAction *, XfburnMainWindow *);
static void xfburn_window_action_preferences (GtkAction *, XfburnMainWindow *);
@@ -118,6 +118,8 @@
"preferences",
};
+static XfburnMainWindow *instance = NULL;
+
/**************************/
/* XfburnMainWindow class */
/**************************/
@@ -148,12 +150,23 @@
static void
xfburn_main_window_class_init (XfburnMainWindowClass * klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
g_type_class_add_private (klass, sizeof (XfburnMainWindowPrivate));
parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = xfburn_main_window_finalize;
}
static void
+xfburn_main_window_finalize (GObject *obj)
+{
+ if (instance)
+ instance = NULL;
+}
+
+static void
xfburn_main_window_init (XfburnMainWindow * mainwin)
{
XfburnMainWindowPrivate *priv = XFBURN_MAIN_WINDOW_GET_PRIVATE (mainwin);
@@ -166,6 +179,7 @@
/* the window itself */
gtk_window_set_position (GTK_WINDOW (mainwin), GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_set_title (GTK_WINDOW (mainwin), "Xfburn");
+ gtk_window_set_icon_name (GTK_WINDOW (mainwin), GTK_STOCK_CDROM);
gtk_window_resize (GTK_WINDOW (mainwin), xfburn_settings_get_int
("main-window-width", 850),
xfburn_settings_get_int ("main-window-height", 700));
@@ -256,7 +270,6 @@
mainwin->disc_content = xfburn_disc_content_new ();
gtk_paned_add2 (GTK_PANED (priv->vpaned), mainwin->disc_content);
gtk_widget_show (mainwin->disc_content);
- g_signal_connect (G_OBJECT (mainwin->disc_content), "begin-burn", G_CALLBACK
(cb_burn_composition), mainwin);
gtk_paned_set_position (GTK_PANED (priv->vpaned), xfburn_settings_get_int
("vpaned-position", 200));
@@ -336,20 +349,6 @@
}
static void
-cb_burn_composition (XfburnDiscContent *dc, XfburnMainWindow * window)
-{
- GtkWidget *dialog;
- gchar *tmpfile;
-
- xfburn_disc_content_generate_file_list (XFBURN_DISC_CONTENT
(window->disc_content), &tmpfile);
-
- dialog = xfburn_burn_composition_dialog_new (tmpfile);
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-}
-
-static void
xfburn_window_action_burn_image (GtkAction * action, XfburnMainWindow * window)
{
GtkWidget *dialog;
@@ -407,7 +406,7 @@
{"Cosmo Chene", "[EMAIL PROTECTED]", "zh_TW",},
};
- icon = xfce_themed_icon_load ("xfburn", 48);
+ icon = xfce_themed_icon_load (GTK_STOCK_CDROM, 48);
//if (G_UNLIKELY (icon == NULL))
//icon = gdk_pixbuf_new_from_file (DATADIR
"/icons/hicolor/48x48/apps/Terminal.png", NULL);
@@ -492,24 +491,61 @@
}
}
+/******************/
/* public methods */
+/******************/
GtkWidget *
xfburn_main_window_new (void)
{
GtkWidget *obj;
XfburnMainWindow *win;
GtkAction *action;
+
+ if (G_UNLIKELY (instance)) {
+ g_error ("An instance of XfburnMainWindow has already been created");
+ return NULL;
+ }
obj = g_object_new (xfburn_main_window_get_type (), NULL);
- win = XFBURN_MAIN_WINDOW (obj);
- /* load settings */
- action = gtk_action_group_get_action (win->action_group, "show-filebrowser");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-filebrowser", TRUE));
- action = gtk_action_group_get_action (win->action_group, "show-toolbar");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-toolbar", TRUE));
- action = gtk_action_group_get_action (win->action_group,
"show-content-toolbar");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-content-toolbar", TRUE));
+ if (obj) {
+ win = XFBURN_MAIN_WINDOW (obj);
+ instance = win;
+
+ /* load settings */
+ action = gtk_action_group_get_action (win->action_group,
"show-filebrowser");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-filebrowser", TRUE));
+ action = gtk_action_group_get_action (win->action_group, "show-toolbar");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-toolbar", TRUE));
+ action = gtk_action_group_get_action (win->action_group,
"show-content-toolbar");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
xfburn_settings_get_boolean ("show-content-toolbar", TRUE));
+ }
return obj;
}
+
+XfburnMainWindow *
+xfburn_main_window_get_instance ()
+{
+ if (!instance)
+ g_warning ("No existing instance of XfburnMainWindow");
+
+ return instance;
+}
+
+void
+xfburn_main_window_burn_composition (XfburnMainWindow * window,
XfburnDiscContent *dc)
+{
+ GtkWidget *dialog;
+ gchar *tmpfile = NULL;
+
+ xfburn_disc_content_generate_file_list (XFBURN_DISC_CONTENT
(window->disc_content), &tmpfile);
+
+ dialog = xfburn_burn_composition_dialog_new (tmpfile);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (tmpfile);
+}
+
Modified: xfburn/trunk/xfburn/xfburn-main-window.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-main-window.h 2006-07-20 20:59:20 UTC (rev
22499)
+++ xfburn/trunk/xfburn/xfburn-main-window.h 2006-07-20 22:14:57 UTC (rev
22500)
@@ -26,6 +26,8 @@
#include <gtk/gtk.h>
+#include "xfburn-disc-content.h"
+
G_BEGIN_DECLS
#define XFBURN_TYPE_MAIN_WINDOW (xfburn_main_window_get_type ())
#define XFBURN_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
XFBURN_TYPE_MAIN_WINDOW, XfburnMainWindow))
@@ -55,7 +57,10 @@
};
GtkType xfburn_main_window_get_type (void);
+
GtkWidget *xfburn_main_window_new (void);
+XfburnMainWindow *xfburn_main_window_get_instance (void);
+void xfburn_main_window_burn_composition (XfburnMainWindow * window,
XfburnDiscContent *dc);
G_END_DECLS
#endif
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits