libmbca r11 - in trunk: data src



Author: kaijanma
Date: Tue Aug 12 06:32:16 2008
New Revision: 11
URL: http://svn.gnome.org/viewvc/libmbca?rev=11&view=rev

Log:
Introduced MBCA_DEVICE_PSEUDO

Modified:
   trunk/data/mbca.glade
   trunk/src/mbca_assistant.c
   trunk/src/mbca_assistant.h
   trunk/src/summary_page.c
   trunk/src/test_mbca.c

Modified: trunk/data/mbca.glade
==============================================================================
--- trunk/data/mbca.glade	(original)
+++ trunk/data/mbca.glade	Tue Aug 12 06:32:16 2008
@@ -961,7 +961,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label17">
+                      <object class="GtkLabel" id="summary_device_caption_label">
                         <property name="visible">True</property>
                         <property name="xalign">1</property>
                         <property name="label" translatable="yes">&lt;b&gt;Device:&lt;/b&gt;</property>

Modified: trunk/src/mbca_assistant.c
==============================================================================
--- trunk/src/mbca_assistant.c	(original)
+++ trunk/src/mbca_assistant.c	Tue Aug 12 06:32:16 2008
@@ -1204,13 +1204,9 @@
 		priv->device_is_preset = TRUE;
 		priv->conf->device = g_strdup (device);
 		priv->nice_device_name = g_strdup (nice_device_name);
+		priv->conf->type = type;
 		switch (type)
 		{
-			case MBCA_DEVICE_BLUETOOTH:
-			{
-				priv->conf->type = MBCA_DEVICE_BLUETOOTH;
-				break;
-			}
 			case MBCA_DEVICE_SERIAL:
 			{	
 				/* serial devices are special.
@@ -1223,12 +1219,12 @@
 				
 				g_free (priv->conf->baud);
 				priv->conf->baud = g_strdup (nice_device_name);
-				priv->conf->type = MBCA_DEVICE_SERIAL;
 				break;			
 			}
+			case MBCA_DEVICE_BLUETOOTH:
 			case MBCA_DEVICE_HAL:
+			case MBCA_DEVICE_PSEUDO:
 			{
-				priv->conf->type = MBCA_DEVICE_HAL;
 				break;
 			}
 			default:

Modified: trunk/src/mbca_assistant.h
==============================================================================
--- trunk/src/mbca_assistant.h	(original)
+++ trunk/src/mbca_assistant.h	Tue Aug 12 06:32:16 2008
@@ -121,7 +121,8 @@
 	MBCA_DEVICE_NONE,	   /**< no device selected, for initialization	  */
 	MBCA_DEVICE_BLUETOOTH, /**< Bluetooth device						  */
 	MBCA_DEVICE_HAL,	   /**< devices discovered using HAL			  */
-	MBCA_DEVICE_SERIAL	   /**< Serial device						  */
+	MBCA_DEVICE_SERIAL,	   /**< Serial device						  */
+	MBCA_DEVICE_PSEUDO	   /**< pseudo device, not shown on summary page	  */
 };
 
 /**
@@ -216,8 +217,11 @@
  *
  * Runs the assistant. If device type is MBCA_DEVICE_NONE assistant is
  * run fully. Otherwise assistant skips device selection and service provider
- * page follows directly after introduction page. After assistant is once run
- * it can't be run again. Unref the old and create a new one if necessary.
+ * page follows directly after introduction page. If device type is
+ * MBCA_DEVICE_PSEUDO device field on summary page is also hidden.
+ *
+ * After assistant is once run it can't be run again. Unref the old and create
+ * a new one if necessary.
  *
  *
  * format for device depends from type:
@@ -236,6 +240,9 @@
  *   devices nice_device_name means baud rate!
  * - e.g. "/dev/ttyS0", "9600"
  *
+ * MBCA_DEVICE_PSEUDO
+ * - device and nice_device_name are ignored
+ *
  * @see mbca_assistant_run()
  *
  * @note assistant must be in MBCA_STATE_READY state

Modified: trunk/src/summary_page.c
==============================================================================
--- trunk/src/summary_page.c	(original)
+++ trunk/src/summary_page.c	Tue Aug 12 06:32:16 2008
@@ -84,6 +84,18 @@
 			gtk_label_set_text (method, priv->hal_device_type);
 			break;
 		}
+		case MBCA_DEVICE_PSEUDO:
+		{
+			GObject* caption;
+			caption = gtk_builder_get_object (priv->builder,
+									    "summary_device_caption_label");
+			g_return_if_fail (caption);
+			
+			/* hide device name */
+			gtk_widget_hide (GTK_WIDGET (caption));
+			gtk_widget_hide (GTK_WIDGET (device));
+			break;
+		}		
 		default:
 		{
 			g_return_if_reached ();
@@ -105,12 +117,18 @@
 	gtk_label_set_text (country, priv->country_name);
 	gtk_label_set_text (provider, priv->provider_name);
 
-	namestr = g_strjoin (NULL,
-					 priv->nice_device_name,
-					 " - ",
-					 priv->provider_name,
-					 NULL);
-	
+	if (priv->conf->type == MBCA_DEVICE_PSEUDO)
+	{
+		namestr = g_strdup (priv->provider_name);
+	}
+	else
+	{
+		namestr = g_strjoin (NULL,
+						 priv->nice_device_name,
+						 " - ",
+						 priv->provider_name,
+						 NULL);
+	}
 	gtk_entry_set_text (name, namestr);
 	g_free (priv->conf->name);
 	priv->conf->name = namestr;

Modified: trunk/src/test_mbca.c
==============================================================================
--- trunk/src/test_mbca.c	(original)
+++ trunk/src/test_mbca.c	Tue Aug 12 06:32:16 2008
@@ -54,7 +54,12 @@
 		}
 		case MBCA_DEVICE_HAL:
 		{
-			g_print ("type:      %s", "hal");
+			g_print ("type:      %s\n", "hal");
+			break;
+		}
+		case MBCA_DEVICE_PSEUDO:
+		{
+			g_print ("type:      %s\n", "pseudo");
 			break;
 		}
 		default:
@@ -172,6 +177,22 @@
 }
 
 void
+pseudo_button_clicked_cb (GtkWidget* button, gpointer user_data)
+{
+	GSList** assistants = user_data;
+	MBCAAssistant* assistant;
+	gint ret;
+
+	assistant = mbca_assistant_new ();
+	g_signal_connect (G_OBJECT (assistant), "state-changed",
+				   G_CALLBACK (run_gui_state_changed), assistants);
+	
+	*assistants = g_slist_append (*assistants, assistant);
+	ret = mbca_assistant_run_for_device (assistant, MBCA_DEVICE_PSEUDO,
+								  NULL, NULL);
+}
+
+void
 abort_button_clicked_cb (GtkWidget* button, gpointer user_data)
 {
 	GSList** assistants = user_data;
@@ -198,6 +219,7 @@
 
 	GtkWidget* full_button;
 	GtkWidget* preset_button;
+	GtkWidget* pseudo_button;
 	GtkWidget* abort_button;
 	GtkWidget* quit_button;
 	
@@ -220,13 +242,16 @@
 
 	preset_button = gtk_button_new_with_label ("Preset");
 	gtk_box_pack_start (GTK_BOX(vbox), preset_button, FALSE, FALSE, 0);
+
+	pseudo_button = gtk_button_new_with_label ("Pseudo");
+	gtk_box_pack_start (GTK_BOX(vbox), pseudo_button, FALSE, FALSE, 0);
 	
-	gtk_box_pack_start (GTK_BOX(vbox), gtk_vseparator_new(), FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX(vbox), gtk_vseparator_new(), FALSE, FALSE, 6);
 	
 	abort_button = gtk_button_new_with_label ("Abort");
 	gtk_box_pack_start (GTK_BOX(vbox), abort_button, FALSE, FALSE, 0);
 	
-	gtk_box_pack_start (GTK_BOX(vbox), gtk_vseparator_new(), FALSE, FALSE, 0);	
+	gtk_box_pack_start (GTK_BOX(vbox), gtk_vseparator_new(), FALSE, FALSE, 6);	
 	
 	quit_button = gtk_button_new_with_label ("Quit");
 	gtk_box_pack_start (GTK_BOX(vbox), quit_button, FALSE, FALSE, 0);
@@ -235,6 +260,8 @@
 				   G_CALLBACK (full_button_clicked_cb), &assistants);
 	g_signal_connect (G_OBJECT (preset_button), "clicked",
 				   G_CALLBACK (preset_button_clicked_cb), &assistants);
+	g_signal_connect (G_OBJECT (pseudo_button), "clicked",
+				   G_CALLBACK (pseudo_button_clicked_cb), &assistants);
 	g_signal_connect (G_OBJECT (abort_button), "clicked",
 				   G_CALLBACK (abort_button_clicked_cb), &assistants);	
 	g_signal_connect (G_OBJECT (quit_button), "clicked",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]