totem r6227 - in trunk: . src src/plugins/lirc
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r6227 - in trunk: . src src/plugins/lirc
- Date: Thu, 2 Apr 2009 01:02:49 +0000 (UTC)
Author: hadess
Date: Thu Apr 2 01:02:49 2009
New Revision: 6227
URL: http://svn.gnome.org/viewvc/totem?rev=6227&view=rev
Log:
2009-04-02 Bastien Nocera <hadess hadess net>
* configure.in:
* src/Makefile.am:
* src/bacon-message-connection.c:
* src/bacon-message-connection.h:
* src/plugins/lirc/totem-lirc.c (totem_lirc_to_command):
* src/totem-object.c (totem_remote_command_get_type),
(totem_action_exit), (totem_action_remote):
* src/totem-options.c (totem_options_process_for_server):
* src/totem-options.h:
* src/totem-private.h:
* src/totem.c (totem_message_received_cb), (main):
* src/totem.h: Remove use of bacon-message-connection and
use libunique instead (Closes: #162822)
Removed:
trunk/src/bacon-message-connection.c
trunk/src/bacon-message-connection.h
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/src/Makefile.am
trunk/src/plugins/lirc/totem-lirc.c
trunk/src/totem-object.c
trunk/src/totem-options.c
trunk/src/totem-options.h
trunk/src/totem-private.h
trunk/src/totem.c
trunk/src/totem.h
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Apr 2 01:02:49 2009
@@ -272,6 +272,8 @@
$ISO_CODES
gnome-icon-theme >= $GNOMEICON_REQS])
+PKG_CHECK_MODULES([UNIQUE], unique-1.0)
+
dnl *************************
dnl X11 related functionality
dnl *************************
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu Apr 2 01:02:49 2009
@@ -3,7 +3,6 @@
bin_PROGRAMS = totem totem-video-thumbnailer totem-video-indexer totem-audio-preview
libexec_PROGRAMS =
noinst_LTLIBRARIES = \
- libbaconmessageconnection.la \
libtotem_player.la \
libtotem_main.la
@@ -20,33 +19,6 @@
modules_flags = -export_dynamic -avoid-version -module -no-undefined
-# Bacon message connection ltlibrary
-
-BACON_MESSAGE_CONNECTION = \
- bacon-message-connection.c \
- bacon-message-connection.h
-
-libbaconmessageconnection_la_SOURCES = \
- $(BACON_MESSAGE_CONNECTION)
-
-libbaconmessageconnection_la_CPPFLAGS = \
- $(common_defines) \
- $(AM_CPPFLAGS)
-
-libbaconmessageconnection_la_CFLAGS = \
- $(GTK_CFLAGS) \
- $(WARN_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(AM_CFLAGS)
-
-libbaconmessageconnection_la_LDFLAGS = \
- $(AM_LDFLAGS)
-
-
-BACONDIR=$(srcdir)/../../libbacon/src
-regenerate-built-sources:
- EGGFILES="$(BACON_MESSAGE_CONNECTION)" EGGDIR="$(BACONDIR)" $(srcdir)/update-from-egg.sh || true
-
# Totem UI ltlibrary (used by browser plugins)
libtotem_player_la_SOURCES = \
@@ -68,6 +40,7 @@
libtotem_player_la_CFLAGS = \
$(DEPENDENCY_CFLAGS) \
$(WARN_CFLAGS) \
+ $(UNIQUE_CFLAGS) \
$(AM_CFLAGS)
libtotem_player_la_LDFLAGS = \
@@ -124,6 +97,7 @@
$(WARN_CFLAGS) \
$(DBUS_CFLAGS) \
$(MISSING_PLUGINS_CFLAGS) \
+ $(UNIQUE_CFLAGS) \
$(AM_CFLAGS)
libtotem_main_la_LDFLAGS = \
@@ -133,7 +107,7 @@
libtotem_player.la \
backend/libbaconvideowidget.la \
plugins/libtotemmodule.la \
- libbaconmessageconnection.la \
+ $(UNIQUE_LIBS) \
$(DBUS_LIBS) \
$(XVIDMODE_LIBS) \
$(XTEST_LIBS) \
@@ -192,13 +166,14 @@
totem_SOURCES = totem.c
-totem_CPPFLAGS = \
+totem_CPPFLAGS = \
-I$(top_srcdir)/ \
-I$(srcdir)/backend \
$(common_defines) \
$(AM_CPPFLAGS)
-totem_CFLAGS = \
+totem_CFLAGS = \
+ $(UNIQUE_CFLAGS) \
$(WARN_CFLAGS) \
$(DEPENDENCY_CFLAGS) \
$(AM_CFLAGS)
Modified: trunk/src/plugins/lirc/totem-lirc.c
==============================================================================
--- trunk/src/plugins/lirc/totem-lirc.c (original)
+++ trunk/src/plugins/lirc/totem-lirc.c Thu Apr 2 01:02:49 2009
@@ -85,8 +85,6 @@
#define TOTEM_IR_COMMAND_PLAYPAUSE "play_pause"
#define TOTEM_IR_COMMAND_ZOOM_UP "zoom_up"
#define TOTEM_IR_COMMAND_ZOOM_DOWN "zoom_down"
-#define TOTEM_IR_COMMAND_SHOW_PLAYING "show_playing"
-#define TOTEM_IR_COMMAND_SHOW_VOLUME "show_volume"
#define TOTEM_IR_COMMAND_EJECT "eject"
#define TOTEM_IR_COMMAND_PLAY_DVD "play_dvd"
#define TOTEM_IR_COMMAND_MUTE "mute"
@@ -198,10 +196,6 @@
return TOTEM_REMOTE_COMMAND_ZOOM_UP;
else if (strcmp (str, TOTEM_IR_COMMAND_ZOOM_DOWN) == 0)
return TOTEM_REMOTE_COMMAND_ZOOM_DOWN;
- else if (strcmp (str, TOTEM_IR_COMMAND_SHOW_PLAYING) == 0)
- return TOTEM_REMOTE_COMMAND_SHOW_PLAYING;
- else if (strcmp (str, TOTEM_IR_COMMAND_SHOW_VOLUME) == 0)
- return TOTEM_REMOTE_COMMAND_SHOW_VOLUME;
else if (strcmp (str, TOTEM_IR_COMMAND_EJECT) == 0)
return TOTEM_REMOTE_COMMAND_EJECT;
else if (strcmp (str, TOTEM_IR_COMMAND_PLAY_DVD) == 0)
Modified: trunk/src/totem-object.c
==============================================================================
--- trunk/src/totem-object.c (original)
+++ trunk/src/totem-object.c Thu Apr 2 01:02:49 2009
@@ -670,8 +670,6 @@
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_REPLACE, "Replace"),
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_SHOW, "Show"),
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS, "Toggle controls"),
- ENUM_ENTRY (TOTEM_REMOTE_COMMAND_SHOW_PLAYING, "Show playing"),
- ENUM_ENTRY (TOTEM_REMOTE_COMMAND_SHOW_VOLUME, "Show volume"),
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_UP, "Up"),
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_DOWN, "Down"),
ENUM_ENTRY (TOTEM_REMOTE_COMMAND_LEFT, "Left"),
@@ -880,8 +878,8 @@
totem_action_save_size (totem);
}
- if (totem->conn != NULL)
- bacon_message_connection_free (totem->conn);
+ if (totem->app != NULL)
+ g_object_unref (totem->app);
totem_action_save_state (totem, page_id);
g_free (page_id);
@@ -2945,32 +2943,6 @@
gtk_toggle_action_set_active (action, !state);
}
break;
- case TOTEM_REMOTE_COMMAND_SHOW_PLAYING:
- {
- char *title;
- gboolean custom;
-
- title = totem_playlist_get_current_title
- (totem->playlist, &custom);
- bacon_message_connection_send (totem->conn,
- title ? title : SHOW_PLAYING_NO_TRACKS);
- g_free (title);
- }
- break;
- case TOTEM_REMOTE_COMMAND_SHOW_VOLUME:
- {
- char *vol_str;
- int vol;
-
- if (bacon_video_widget_can_set_volume (totem->bvw) == FALSE)
- vol = 0;
- else
- vol = bacon_video_widget_get_volume (totem->bvw);
- vol_str = g_strdup_printf ("%d", vol);
- bacon_message_connection_send (totem->conn, vol_str);
- g_free (vol_str);
- }
- break;
case TOTEM_REMOTE_COMMAND_UP:
bacon_video_widget_dvd_event (totem->bvw,
BVW_DVD_ROOT_MENU_UP);
Modified: trunk/src/totem-options.c
==============================================================================
--- trunk/src/totem-options.c (original)
+++ trunk/src/totem-options.c Thu Apr 2 01:02:49 2009
@@ -95,23 +95,9 @@
options->debug, NULL);
}
-G_GNUC_NORETURN static void
-totem_print_playing_cb (const gchar *msg, gpointer user_data)
-{
- if (strcmp (msg, SHOW_PLAYING_NO_TRACKS) != 0)
- g_print ("%s\n", msg);
- exit (0);
-}
-
-static char *
-totem_option_create_line (int command)
-{
- return g_strdup_printf ("%03d ", command);
-}
-
void
-totem_options_process_for_server (BaconMessageConnection *conn,
- const TotemCmdLineOptions* options)
+totem_options_process_for_server (UniqueApp *app,
+ const TotemCmdLineOptions* options)
{
GList *commands, *l;
int default_action, i;
@@ -121,10 +107,7 @@
/* Are we quitting ? */
if (options->quit) {
- char *line;
- line = totem_option_create_line (TOTEM_REMOTE_COMMAND_QUIT);
- bacon_message_connection_send (conn, line);
- g_free (line);
+ unique_app_send_message (app, TOTEM_REMOTE_COMMAND_QUIT, NULL);
return;
}
@@ -139,93 +122,94 @@
}
/* Send the files to enqueue */
- for (i = 0; options->filenames && options->filenames[i] != NULL; i++)
- {
- char *line, *full_path;
+ for (i = 0; options->filenames && options->filenames[i] != NULL; i++) {
+ UniqueMessageData *data;
+ char *full_path;
+
+ data = unique_message_data_new ();
+ full_path = totem_create_full_path (options->filenames[i]);
+ unique_message_data_set_text (data, full_path ? full_path : options->filenames[i], -1);
full_path = totem_create_full_path (options->filenames[i]);
- line = g_strdup_printf ("%03d %s", default_action,
- full_path ? full_path : options->filenames[i]);
- bacon_message_connection_send (conn, line);
+
+ unique_app_send_message (app, default_action, data);
+
/* Even if the default action is replace, we only want to replace with the
first file. After that, we enqueue. */
default_action = TOTEM_REMOTE_COMMAND_ENQUEUE;
- g_free (line);
+ unique_message_data_free (data);
g_free (full_path);
}
if (options->playpause) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_PLAYPAUSE));
}
if (options->play) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_PLAY));
}
if (options->pause) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_PAUSE));
}
if (options->next) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_NEXT));
}
if (options->previous) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_PREVIOUS));
}
if (options->seekfwd) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_SEEK_FORWARD));
}
if (options->seekbwd) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_SEEK_BACKWARD));
}
if (options->volumeup) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_VOLUME_UP));
}
if (options->volumedown) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_VOLUME_DOWN));
}
if (options->mute) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_MUTE));
}
if (options->fullscreen) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_FULLSCREEN));
}
if (options->togglecontrols) {
- commands = g_list_append (commands, totem_option_create_line
+ commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS));
}
/* No commands, no files, show ourselves */
if (commands == NULL && options->filenames == NULL) {
- char *line;
- line = totem_option_create_line (TOTEM_REMOTE_COMMAND_SHOW);
- bacon_message_connection_send (conn, line);
- g_free (line);
+ unique_app_send_message (app, TOTEM_REMOTE_COMMAND_SHOW, NULL);
return;
}
/* Send commands */
for (l = commands; l != NULL; l = l->next) {
- bacon_message_connection_send (conn, l->data);
- g_free (l->data);
+ int command = GPOINTER_TO_INT (l->data);
+ unique_app_send_message (app, command, NULL);
}
g_list_free (commands);
}
Modified: trunk/src/totem-options.h
==============================================================================
--- trunk/src/totem-options.h (original)
+++ trunk/src/totem-options.h Thu Apr 2 01:02:49 2009
@@ -24,9 +24,9 @@
#define TOTEM_OPTIONS_H
#include <gconf/gconf-client.h>
+#include <unique/uniqueapp.h>
#include "totem.h"
-#include "bacon-message-connection.h"
G_BEGIN_DECLS
@@ -62,7 +62,7 @@
const TotemCmdLineOptions* options);
void totem_options_process_late (Totem *totem,
const TotemCmdLineOptions* options);
-void totem_options_process_for_server (BaconMessageConnection *conn,
+void totem_options_process_for_server (UniqueApp *app,
const TotemCmdLineOptions* options);
G_END_DECLS
Modified: trunk/src/totem-private.h
==============================================================================
--- trunk/src/totem-private.h (original)
+++ trunk/src/totem-private.h Thu Apr 2 01:02:49 2009
@@ -31,9 +31,9 @@
#include <gconf/gconf-client.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <unique/uniqueapp.h>
#include "totem-playlist.h"
-#include "bacon-message-connection.h"
#include "bacon-video-widget.h"
#include "totem-open-location.h"
#include "totem-fullscreen.h"
@@ -157,7 +157,7 @@
char *mrl;
TotemPlaylist *playlist;
GConfClient *gc;
- BaconMessageConnection *conn;
+ UniqueApp *app;
TotemStates state;
TotemOpenLocation *open_location;
};
Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c (original)
+++ trunk/src/totem.c Thu Apr 2 01:02:49 2009
@@ -57,27 +57,25 @@
gtk_main_iteration ();
}
-static void
-totem_message_connection_receive_cb (const char *msg, Totem *totem)
+static UniqueResponse
+totem_message_received_cb (UniqueApp *app,
+ int command,
+ UniqueMessageData *message_data,
+ guint time_,
+ Totem *totem)
{
- char *command_str, *url;
- int command;
-
- if (strlen (msg) < 4)
- return;
-
- command_str = g_strndup (msg, 3);
- sscanf (command_str, "%d", &command);
- g_free (command_str);
+ char *url;
- if (msg[4] != '\0')
- url = g_strdup (msg + 4);
+ if (message_data != NULL)
+ url = unique_message_data_get_text (message_data);
else
url = NULL;
totem_action_remote (totem, command, url);
g_free (url);
+
+ return UNIQUE_RESPONSE_OK;;
}
static void
@@ -176,9 +174,9 @@
/* IPC stuff */
if (optionstate.notconnectexistingsession == FALSE) {
- totem->conn = bacon_message_connection_new (GETTEXT_PACKAGE);
- if (bacon_message_connection_get_is_server (totem->conn) == FALSE) {
- totem_options_process_for_server (totem->conn, &optionstate);
+ totem->app = unique_app_new ("org.gnome.Totem", NULL);
+ if (unique_app_is_running (totem->app) != FALSE) {
+ totem_options_process_for_server (totem->app, &optionstate);
gdk_notify_startup_complete ();
totem_action_exit (totem);
} else {
@@ -271,11 +269,9 @@
if (optionstate.fullscreen == FALSE)
gdk_window_set_cursor (totem->win->window, NULL);
- if (totem->conn != NULL && bacon_message_connection_get_is_server (totem->conn) != FALSE)
- {
- bacon_message_connection_set_callback (totem->conn,
- (BaconMessageReceivedFunc)
- totem_message_connection_receive_cb, totem);
+ if (totem->app != NULL) {
+ g_signal_connect (totem->app, "message-received",
+ G_CALLBACK (totem_message_received_cb), totem);
}
gtk_main ();
Modified: trunk/src/totem.h
==============================================================================
--- trunk/src/totem.h (original)
+++ trunk/src/totem.h Thu Apr 2 01:02:49 2009
@@ -56,8 +56,6 @@
* @TOTEM_REMOTE_COMMAND_REPLACE: replace an item in the playlist
* @TOTEM_REMOTE_COMMAND_SHOW: show the Totem instance
* @TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS: toggle the control visibility
- * @TOTEM_REMOTE_COMMAND_SHOW_PLAYING: return the current stream's metadata
- * @TOTEM_REMOTE_COMMAND_SHOW_VOLUME: return the current volume
* @TOTEM_REMOTE_COMMAND_UP: go up (DVD controls)
* @TOTEM_REMOTE_COMMAND_DOWN: go down (DVD controls)
* @TOTEM_REMOTE_COMMAND_LEFT: go left (DVD controls)
@@ -74,7 +72,7 @@
* Represents a command which can be sent to a running Totem instance remotely.
**/
typedef enum {
- TOTEM_REMOTE_COMMAND_UNKNOWN,
+ TOTEM_REMOTE_COMMAND_UNKNOWN = 0,
TOTEM_REMOTE_COMMAND_PLAY,
TOTEM_REMOTE_COMMAND_PAUSE,
TOTEM_REMOTE_COMMAND_STOP,
@@ -91,8 +89,6 @@
TOTEM_REMOTE_COMMAND_REPLACE,
TOTEM_REMOTE_COMMAND_SHOW,
TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS,
- TOTEM_REMOTE_COMMAND_SHOW_PLAYING,
- TOTEM_REMOTE_COMMAND_SHOW_VOLUME,
TOTEM_REMOTE_COMMAND_UP,
TOTEM_REMOTE_COMMAND_DOWN,
TOTEM_REMOTE_COMMAND_LEFT,
@@ -122,8 +118,6 @@
#define TOTEM_TYPE_DISC_MEDIA_TYPE (totem_disc_media_type_get_type())
#define TOTEM_DISC_MEDIA_TYPE totem_disc_media_type_quark ()
-#define SHOW_PLAYING_NO_TRACKS "NONE"
-
#define TOTEM_TYPE_OBJECT (totem_object_get_type ())
#define TOTEM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), totem_object_get_type (), TotemObject))
#define TOTEM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), totem_object_get_type (), TotemObjectClass))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]