rhythmbox r5786 - in trunk: . plugins/lirc



Author: jmatthew
Date: Tue Jul  1 11:59:03 2008
New Revision: 5786
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5786&view=rev

Log:
2008-07-01  Jonathan Matthew  <jonathan d14n org>

	patch by:  Alfredo Pironti  <alfredio fastwebnet it>

	* plugins/lirc/rb-lirc-plugin.c: (rb_lirc_plugin_read_code),
	(impl_activate), (impl_deactivate):
	Add lirc 'quit' command that surprisingly quits rhythmbox.  Fixes
	#540610.


Modified:
   trunk/ChangeLog
   trunk/plugins/lirc/rb-lirc-plugin.c

Modified: trunk/plugins/lirc/rb-lirc-plugin.c
==============================================================================
--- trunk/plugins/lirc/rb-lirc-plugin.c	(original)
+++ trunk/plugins/lirc/rb-lirc-plugin.c	Tue Jul  1 11:59:03 2008
@@ -64,10 +64,12 @@
 #define RB_IR_COMMAND_VOLUME_UP "volume_up"
 #define RB_IR_COMMAND_VOLUME_DOWN "volume_down"
 #define RB_IR_COMMAND_MUTE "mute"
+#define RB_IR_COMMAND_QUIT "quit"
 
 typedef struct
 {
 	RBPlugin parent;
+	RBShell *shell;
 	RBShellPlayer *shell_player;
 	struct lirc_config *lirc_config;
 	GIOChannel *lirc_channel;
@@ -172,6 +174,10 @@
 			if (rb_shell_player_get_mute (plugin->shell_player, &mute, NULL)) {
 				rb_shell_player_set_mute (plugin->shell_player, !mute, NULL);
 			}
+		} else if (strcmp (str,RB_IR_COMMAND_QUIT) == 0) {
+			rb_shell_quit (plugin->shell, NULL);
+			/* the plugin will have been deactivated, so we can't continue the loop */
+			break;
 		}
 		processed = TRUE;
 	} while (ok == 0);
@@ -187,6 +193,8 @@
 	int fd;
 	RBLircPlugin *plugin = RB_LIRC_PLUGIN (rbplugin);
 
+	plugin->shell = g_object_ref (shell);
+
 	g_object_get (G_OBJECT (shell), "shell-player", &plugin->shell_player, NULL);
 
 	rb_debug ("Activating lirc plugin");
@@ -240,5 +248,10 @@
 		g_object_unref (G_OBJECT (plugin->shell_player));
 		plugin->shell_player = NULL;
 	}
+
+	if (plugin->shell) {
+		g_object_unref (G_OBJECT (plugin->shell));
+		plugin->shell = NULL;
+	}
 }
 



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