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

rpms/gnome-applets/devel gnome-applets-2.10.1-no-mixer-warning-on-startup.patch, NONE, 1.1 gnome-applets.spec, 1.71, 1.72 gnome-applets-2.9.5-mixer-crash-with-no-channels.patch, 1.1, NONE



Author: markmc

Update of /cvs/dist/rpms/gnome-applets/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv9439

Modified Files:
	gnome-applets.spec 
Added Files:
	gnome-applets-2.10.1-no-mixer-warning-on-startup.patch 
Removed Files:
	gnome-applets-2.9.5-mixer-crash-with-no-channels.patch 
Log Message:
* Fri Jul  1 2005 Mark McLoughlin <markmc redhat com> 1:2.10.1-10
- Backport from HEAD patch to remove lame warning dialog when the
  mixer applet can't find a mixer device


gnome-applets-2.10.1-no-mixer-warning-on-startup.patch:
 ChangeLog |   17 +++++
 applet.c  |  199 ++++++++++++++++++++++++++++++++++++++------------------------
 load.c    |    4 -
 3 files changed, 143 insertions(+), 77 deletions(-)

--- NEW FILE gnome-applets-2.10.1-no-mixer-warning-on-startup.patch ---
--- gnome-applets-2.10.1/mixer/ChangeLog.no-mixer-warning-on-startup	2005-04-04 16:05:23.000000000 +0100
+++ gnome-applets-2.10.1/mixer/ChangeLog	2005-07-01 13:14:52.000000000 +0100
@@ -0,0 +1,17 @@
+2005-06-10  Ryan Lortie  <desrt desrt ca>
+
+	* applet.c: (gnome_volume_applet_scroll): Small fix for showing
+	  dialog on first user interaction:  return TRUE on the event handler
+	  and double-check for non-null before invoking a callback function.
+
+2005-06-10  Ronald S. Bultje  <rbultje ronald bitfreak net>
+
+	* applet.c: (gnome_volume_applet_setup), (show_no_mixer_dialog),
+	(gnome_volume_applet_scroll), (gnome_volume_applet_button),
+	(gnome_volume_applet_key), (gnome_volume_applet_refresh),
+	(cb_verb), (cb_ui_event):
+	* load.c: (gnome_volume_applet_factory):
+	  If no elements/devices present, don't show a dialog to the user;
+	  instead, show a insensitive/mute icon, and show the dialog on a
+	  user action (only once).
+
--- gnome-applets-2.10.1/mixer/applet.c.no-mixer-warning-on-startup	2005-04-04 16:03:32.000000000 +0100
+++ gnome-applets-2.10.1/mixer/applet.c	2005-07-01 13:27:52.000000000 +0100
@@ -374,6 +374,7 @@
   gchar *key;
   gchar *active_element_name;
   gchar *active_track_name;
+  gboolean res;
 
   active_element_name = panel_applet_gconf_get_string (PANEL_APPLET (applet),
 						       GNOME_VOLUME_APPLET_KEY_ACTIVE_ELEMENT,
@@ -383,40 +384,32 @@
 						     GNOME_VOLUME_APPLET_KEY_ACTIVE_TRACK,
 						     NULL);
 
-  if (!select_element_and_track (applet, elements, active_element_name, active_track_name)) {
-    GtkWidget *dialog;
-
-    g_free (active_element_name);
-    g_free (active_track_name);
-
-    dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
-				     GTK_BUTTONS_CLOSE,
-				     _("No volume control elements and/or devices found."));
-    gtk_widget_show (dialog);
-    gtk_dialog_run (GTK_DIALOG (dialog));
-    gtk_widget_destroy (dialog);
-
-    return FALSE;
-  }
+  res = select_element_and_track (applet, elements, active_element_name, active_track_name);
 
   g_free (active_element_name);
   g_free (active_track_name);
 
-  /* tell the dock */
-  page = (applet->track->max_volume - applet->track->min_volume) / 10;
-  adj = gtk_adjustment_new (0, applet->track->min_volume,
-			    applet->track->max_volume,
-			    (page / 5 > 0) ? page / 5 : 1,
-			    page, 0);
+  if (res) {
+    /* tell the dock */
+    page = (applet->track->max_volume - applet->track->min_volume) / 10;
+    adj = gtk_adjustment_new (0, applet->track->min_volume,
+			      applet->track->max_volume,
+			      (page / 5 > 0) ? page / 5 : 1,
+			      page, 0);
+  }
   gnome_volume_applet_orientation (PANEL_APPLET (applet),
 				   panel_applet_get_orient (PANEL_APPLET (applet)));
-  gnome_volume_applet_dock_change (applet->dock,
-				   GTK_ADJUSTMENT (adj));
-  g_signal_connect (adj, "value-changed",
-		    G_CALLBACK (cb_volume), applet);
+  if (res) {
+    gnome_volume_applet_dock_change (applet->dock,
+				     GTK_ADJUSTMENT (adj));
+    g_signal_connect (adj, "value-changed",
+		      G_CALLBACK (cb_volume), applet);
+  }
 
   gnome_volume_applet_refresh (applet, FALSE);
-  applet->timeout = g_timeout_add (100, cb_check, applet);
+  if (res) {
+    applet->timeout = g_timeout_add (100, cb_check, applet);
+  }
 
   /* menu - done here because bonobo is intialized now */
   panel_applet_setup_menu_from_file (PANEL_APPLET (applet), 
@@ -426,21 +419,19 @@
   component = panel_applet_get_popup_component (PANEL_APPLET (applet));
   g_signal_connect (component, "ui-event", G_CALLBACK (cb_ui_event), applet);
 
-  /* gconf */
-  key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet),
+  if (res) {
+    /* gconf */
+    key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet),
 				GNOME_VOLUME_APPLET_KEY_ACTIVE_ELEMENT);
-#if 0
-  gconf_client_add_dir (applet->client, key,
-			GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-#endif
-  gconf_client_notify_add (applet->client, key,
-			   cb_gconf, applet, NULL, NULL);
-  g_free (key);
-  key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet),
-                                GNOME_VOLUME_APPLET_KEY_ACTIVE_TRACK);
-  gconf_client_notify_add (applet->client, key,
-                           cb_gconf, applet, NULL, NULL);
-  g_free (key);
+    gconf_client_notify_add (applet->client, key,
+			     cb_gconf, applet, NULL, NULL);
+    g_free (key);
+    key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet),
+				GNOME_VOLUME_APPLET_KEY_ACTIVE_TRACK);
+    gconf_client_notify_add (applet->client, key,
+			     cb_gconf, applet, NULL, NULL);
+    g_free (key);
+  }
 
   gtk_widget_show (GTK_WIDGET (applet));
 
@@ -488,6 +479,33 @@
 }
 
 /*
+ * Show a dialog (once) when no mixer is available.
+ */
+
+static void
+show_no_mixer_dialog (GnomeVolumeApplet *applet)
+{
+  static gboolean shown = FALSE;
+  GtkWidget *dialog;
+
+  if (shown)
+    return;
+  shown = TRUE;
+
+  dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
+		GTK_BUTTONS_CLOSE, "%s\n\n%s",
+		_("The volume control did not find any elements and/or "
+		  "devices to control. This means either that you don't "
+		  "have the right GStreamer plugins installed, or that you "
+		  "don't have a sound card configured."),
+		_("You can remove the volume control from the panel by "
+		  "right-clicking the speaker icon on the panel and "
+		  "selecting \"Remove From Panel\" from the menu."));
+  gtk_widget_show (dialog);
+  g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+}
+
+/*
  * get position that the dock should get based on applet position.
  */
 
@@ -666,6 +684,11 @@
 {
   GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (widget);
 
+  if (!applet->mixer) {
+    show_no_mixer_dialog (applet);
+    return TRUE;
+  }
+
   if (event->type == GDK_SCROLL) {
     switch (event->direction) {
       case GDK_SCROLL_UP:
@@ -691,7 +714,10 @@
     }
   }
 
-  return GTK_WIDGET_CLASS (parent_class)->scroll_event (widget, event);
+  if (GTK_WIDGET_CLASS (parent_class)->scroll_event)
+    return GTK_WIDGET_CLASS (parent_class)->scroll_event (widget, event);
+  else
+    return FALSE;
 }
 
 static gboolean
@@ -709,10 +735,16 @@
       case 1:
         switch (event->type) {
           case GDK_BUTTON_PRESS:
-            gnome_volume_applet_pop_dock (applet);
+            if (!applet->mixer) {
+              show_no_mixer_dialog (applet);
+            } else {
+              gnome_volume_applet_pop_dock (applet);
+            }
             return TRUE;
           case GDK_2BUTTON_PRESS:
-            gnome_volume_applet_popdown_dock (applet);
+            if (applet->mixer) {
+              gnome_volume_applet_popdown_dock (applet);
+            }
             gnome_volume_applet_run_mixer (applet);
             return TRUE;
           default:
@@ -743,7 +775,9 @@
 {
   GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (widget);
 
-  switch (event->keyval) {
+  if (!applet->mixer) {
+    show_no_mixer_dialog (applet);
+  } else switch (event->keyval) {
     case GDK_KP_Enter:
     case GDK_ISO_Enter:
     case GDK_3270_Enter:
@@ -917,29 +951,33 @@
   gboolean mute;
 
   /* build-up phase */
-  if (!applet->track)
+  if (!applet->mixer) {
+    n = 0;
+    mute = FALSE;
+  } else if (!applet->track) {
     return;
+  } else {
+    volumes = g_new (gint, applet->track->num_channels);
+    gst_mixer_get_volume (applet->mixer, applet->track, volumes);
+    for (n = 0; n < applet->track->num_channels; n++)
+      volume += volumes[n];
+    g_free (volumes);
+    mute = GST_MIXER_TRACK_HAS_FLAG (applet->track,
+				     GST_MIXER_TRACK_MUTE);
+    if (volume == 0)
+      mute = TRUE;
+    orig_vol = volume;
+    volume /= applet->track->num_channels;
+
+    n = 4 * volume / (applet->track->max_volume -
+		      applet->track->min_volume) + 1;
+    if (n <= 0)
+      n = 1;
+    if (n >= 5)
+      n = 4;
+  }
 
-  volumes = g_new (gint, applet->track->num_channels);
-  gst_mixer_get_volume (applet->mixer, applet->track, volumes);
-  for (n = 0; n < applet->track->num_channels; n++)
-    volume += volumes[n];
-  g_free (volumes);
-  mute = GST_MIXER_TRACK_HAS_FLAG (applet->track,
-				   GST_MIXER_TRACK_MUTE);
-  if (volume == 0)
-    mute = TRUE;
-  orig_vol = volume;
-  volume /= applet->track->num_channels;
-
-  n = 4 * volume / (applet->track->max_volume -
-      applet->track->min_volume) + 1;
-  if (n <= 0)
-    n = 1;
-  if (n >= 5)
-    n = 4;
-
-  if ((STATE (n, mute) != applet->state) || force_refresh) {
+  if (force_refresh || (STATE (n, mute) != applet->state)) {
     if (mute)
       pixbuf = pix[0].pixbuf;
     else
@@ -950,6 +988,9 @@
     applet->state = STATE (n, mute);
   }
 
+  if (!applet->mixer)
+    return;
+
   applet->lock = TRUE;
   if (orig_vol > 0)
     gtk_range_set_value (applet->dock->scale, volume);
@@ -1129,16 +1170,20 @@
 		NULL);
 
   } else if (!strcmp (verbname, "Pref")) {
-    if (applet->prefs)
-      return;
-
-    applet->prefs = gnome_volume_applet_preferences_new (PANEL_APPLET (applet),
-							 applet->elements,
-							 applet->mixer,
-							 applet->track);
-    g_signal_connect (applet->prefs, "destroy",
-		      G_CALLBACK (cb_prefs_destroy), applet);
-    gtk_widget_show (applet->prefs);
+    if (!applet->mixer) {
+      show_no_mixer_dialog (applet);
+    } else {
+      if (applet->prefs)
+	return;
+
+      applet->prefs = gnome_volume_applet_preferences_new (PANEL_APPLET (applet),
+							   applet->elements,
+							   applet->mixer,
+							   applet->track);
+      g_signal_connect (applet->prefs, "destroy",
+			G_CALLBACK (cb_prefs_destroy), applet);
+      gtk_widget_show (applet->prefs);
+    }
   } else {
     g_warning ("Unknown bonobo command '%s'", verbname);
   }
@@ -1153,7 +1198,9 @@
 {
   GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (data);
 
-  if (!strcmp (verbname, "Mute")) {
+  if (!applet->mixer) {
+    show_no_mixer_dialog (applet);
+  } else if (!strcmp (verbname, "Mute")) {
     /* mute will have a value of 4 without the ? TRUE : FALSE bit... */
     gboolean mute = applet->state & 1,
              want_mute = !strcmp (state_string, "1") ? TRUE : FALSE;
--- gnome-applets-2.10.1/mixer/load.c.no-mixer-warning-on-startup	2005-03-20 10:30:18.000000000 +0000
+++ gnome-applets-2.10.1/mixer/load.c	2005-07-01 13:14:53.000000000 +0100
@@ -157,7 +157,9 @@
   }
 
   elements = create_mixer_collection ();
-  return gnome_volume_applet_setup (GNOME_VOLUME_APPLET (applet), elements);
+  gnome_volume_applet_setup (GNOME_VOLUME_APPLET (applet), elements);
+
+  return TRUE;
 }
 
 PANEL_APPLET_BONOBO_FACTORY (


Index: gnome-applets.spec
===================================================================
RCS file: /cvs/dist/rpms/gnome-applets/devel/gnome-applets.spec,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- gnome-applets.spec	27 May 2005 18:29:32 -0000	1.71
+++ gnome-applets.spec	1 Jul 2005 12:44:07 -0000	1.72
@@ -15,7 +15,7 @@
 Summary:        Small applications for the GNOME panel.
 Name:     	gnome-applets
 Version: 	2.10.1
-Release:        9
+Release:        10
 Epoch:          1
 License:	GPL
 Group:          User Interface/Desktops
@@ -26,6 +26,7 @@
 Patch2:		gnome-applets-2.10.1-use-builtin-apm.patch
 Patch3:		gnome-applets-2.3.6-ppp-command.patch
 Patch4:		gnome-applets-2.10.1-cpufreq.patch
+Patch5:         gnome-applets-2.10.1-no-mixer-warning-on-startup.patch
 URL:		http://www.gnome.org/
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-root
@@ -73,6 +74,7 @@
 %patch1 -p1 -b .fix-docs-error
 %patch2 -p1 -b .use-builtin-apm
 %patch4 -p1 -b .cpufreq
+%patch5 -p1 -b .no-mixer-warning-on-startup
 
 cp gswitchit/gswitchit-applet.png  gswitchit/gswitchit-properties-capplet.png
 
@@ -160,6 +162,10 @@
 %{_libdir}/pkgconfig/gswitchit.pc
 
 %changelog
+* Fri Jul  1 2005 Mark McLoughlin <markmc redhat com> 1:2.10.1-10
+- Backport from HEAD patch to remove lame warning dialog when the
+  mixer applet can't find a mixer device
+
 * Fri May 27 2005 Bill Nottingham <notting redhat com> 1:2.10.1-9
 - remove setuid bit from cpufreq-selector, usermode-ify it
 


--- gnome-applets-2.9.5-mixer-crash-with-no-channels.patch DELETED ---


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