[Goodies-commits] r4661 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Wed Apr 23 02:25:13 CEST 2008
Author: squisher
Date: 2008-04-23 00:25:13 +0000 (Wed, 23 Apr 2008)
New Revision: 4661
Added:
xfburn/trunk/xfburn/xfburn-hal-manager.c
xfburn/trunk/xfburn/xfburn-hal-manager.h
Log:
Start of XfburnHalManager to handle volume changes
Added: xfburn/trunk/xfburn/xfburn-hal-manager.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-hal-manager.c (rev 0)
+++ xfburn/trunk/xfburn/xfburn-hal-manager.c 2008-04-23 00:25:13 UTC (rev 4661)
@@ -0,0 +1,120 @@
+/* $Id: xfburn-hal-manager.c 4382 2006-11-01 17:08:37Z pollux $ */
+/*
+ * Copyright (c) 2005-2006 Jean-François Wauthy (pollux at xfce.org)
+ *
+ * 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 */
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "xfburn-global.h"
+#include "xfburn-progress-dialog.h"
+
+#include "xfburn-hal-manager.h"
+
+static void xfburn_hal_manager_class_init (XfburnHalManagerClass * klass);
+static void xfburn_hal_manager_init (XfburnHalManager * sp);
+
+static void cb_new_output (XfburnHalManager * dialog, const gchar * output, gpointer data);
+
+/*********************/
+/* class declaration */
+/*********************/
+static XfburnProgressDialogClass *parent_class = NULL;
+
+GtkType
+xfburn_hal_manager_get_type ()
+{
+ static GtkType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo our_info = {
+ sizeof (XfburnHalManagerClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) xfburn_hal_manager_class_init,
+ NULL,
+ NULL,
+ sizeof (XfburnHalManager),
+ 0,
+ (GInstanceInitFunc) xfburn_hal_manager_init,
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT, "XfburnHalManager", &our_info, 0);
+ }
+
+ return type;
+}
+
+static void
+xfburn_hal_manager_class_init (XfburnHalManagerClass * klass)
+{
+ parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+xfburn_hal_manager_init (XfburnHalManager * obj)
+{
+ g_signal_connect_after (G_OBJECT (obj), "output", G_CALLBACK (cb_new_output), NULL);
+}
+
+/* */
+/* internals */
+/* */
+static void
+cb_new_output (XfburnHalManager * dialog, const gchar * output, gpointer data)
+{
+ static gint readcd_end = -1;
+
+ if (strstr (output, READCD_DONE)) {
+ xfburn_progress_dialog_set_status (XFBURN_PROGRESS_DIALOG (dialog), XFBURN_PROGRESS_DIALOG_STATUS_COMPLETED);
+ }
+ else if (strstr (output, READCD_PROGRESS)) {
+ gint readcd_done = -1;
+ gdouble fraction;
+
+ sscanf (output, "%*s %d", &readcd_done);
+ fraction = ((gdouble) readcd_done) / readcd_end;
+
+ xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG (dialog), fraction);
+ }
+ else if (strstr (output, READCD_CAPACITY)) {
+ xfburn_progress_dialog_set_action_text (XFBURN_PROGRESS_DIALOG (dialog), _("Reading CD..."));
+ sscanf (output, "%*s %d", &readcd_end);
+ }
+}
+
+/* */
+/* public */
+/* */
+
+GtkWidget *
+xfburn_hal_manager_new ()
+{
+ XfburnHalManager *obj;
+
+ obj = XFBURN_CREATE_HAL_MANAGER (g_object_new (XFBURN_TYPE_CREATE_HAL_MANAGER,
+ "show-buffers", FALSE, "title", _("Create ISO from CD"), NULL));
+
+ return GTK_WIDGET (obj);
+}
Added: xfburn/trunk/xfburn/xfburn-hal-manager.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-hal-manager.h (rev 0)
+++ xfburn/trunk/xfburn/xfburn-hal-manager.h 2008-04-23 00:25:13 UTC (rev 4661)
@@ -0,0 +1,57 @@
+/* $Id: xfburn-hal-manager.h 4352 2006-08-11 16:02:53Z pollux $ */
+/*
+ * Copyright (c) 2005-2006 Jean-François Wauthy (pollux at xfce.org)
+ * Copyright (c) 2008 David Mohr (david at mcbf.net)
+ *
+ * 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_CREATE_HAL_MANAGER_H__
+#define __XFBURN_CREATE_HAL_MANAGER_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* !HAVE_CONFIG_H */
+
+#include <gtk/gtk.h>
+
+#include "xfburn-progress-dialog.h"
+
+G_BEGIN_DECLS
+
+#define XFBURN_TYPE_CREATE_HAL_MANAGER (xfburn_hal_manager_get_type ())
+#define XFBURN_CREATE_HAL_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XFBURN_TYPE_CREATE_HAL_MANAGER, XfburnHalManager))
+#define XFBURN_CREATE_HAL_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XFBURN_TYPE_CREATE_HAL_MANAGER, XfburnHalManagerClass))
+#define XFBURN_IS_CREATE_HAL_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XFBURN_TYPE_CREATE_HAL_MANAGER))
+#define XFBURN_IS_CREATE_HAL_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XFBURN_TYPE_CREATE_HAL_MANAGER))
+#define XFBURN_CREATE_HAL_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XFBURN_TYPE_CREATE_HAL_MANAGER, XfburnHalManagerClass))
+
+typedef struct
+{
+ XfburnProgressDialog parent;
+} XfburnHalManager;
+
+typedef struct
+{
+ XfburnProgressDialogClass parent_class;
+ /* Add Signal Functions Here */
+} XfburnHalManagerClass;
+
+GtkType xfburn_hal_manager_get_type ();
+GtkWidget *xfburn_hal_manager_new ();
+
+G_END_DECLS
+
+#endif /* XFBURN_CREATE_HAL_MANAGER_H */
More information about the Goodies-commits
mailing list