示例#1
0
static void
pragha_application_shutdown (GApplication *application)
{
	PraghaApplication *pragha = PRAGHA_APPLICATION (application);

	CDEBUG(DBG_INFO, "Pragha shutdown: Saving curret state.");

	if (pragha_preferences_get_restore_playlist (pragha->preferences))
		pragha_playlist_save_playlist_state (pragha->playlist);

	pragha_window_save_settings (pragha);

	pragha_playback_stop (pragha);

	/* Shutdown plugins can hide sidebar before save settings. */
	if (pragha->sidebar2_binding) {
		g_object_unref (pragha->sidebar2_binding);
		pragha->sidebar2_binding = NULL;
	}

#ifdef HAVE_LIBPEAS
	pragha_plugins_engine_shutdown (pragha->plugins_engine);
#endif

	gtk_widget_destroy (pragha->mainwindow);

	G_APPLICATION_CLASS (pragha_application_parent_class)->shutdown (application);
}
示例#2
0
文件: keybinder.c 项目: pingax/pragha
static void keybind_stop_handler (const char *keystring, gpointer data)
{
	struct con_win *cwin = data;

	if (pragha_backend_emitted_error (cwin->backend) == FALSE)
		pragha_playback_stop(cwin);
}
示例#3
0
static void on_media_player_key_pressed(con_gnome_media_keys *gmk,
                                        const gchar *key)
{
	PraghaBackend *backend;
	PraghaPreferences *preferences;

    PraghaApplication *pragha = gmk->pragha;

	backend = pragha_application_get_backend (pragha);
	preferences = pragha_application_get_preferences (pragha);

    if (pragha_backend_emitted_error (backend))
        return;

    if (g_strcmp0("Play", key) == 0)
        pragha_playback_play_pause_resume(pragha);
    else if (g_strcmp0("Pause", key) == 0)
        pragha_backend_pause (backend);
    else if (g_strcmp0("Stop", key) == 0)
        pragha_playback_stop(pragha);
    else if (g_strcmp0("Previous", key) == 0)
        pragha_playback_prev_track(pragha);
    else if (g_strcmp0("Next", key) == 0)
        pragha_playback_next_track(pragha);
    else if (g_strcmp0("Repeat", key) == 0)
    {
        gboolean repeat = pragha_preferences_get_repeat (preferences);
        pragha_preferences_set_repeat (preferences, !repeat);
    }
    else if (g_strcmp0("Shuffle", key) == 0)
    {
        gboolean shuffle = pragha_preferences_get_shuffle (preferences);
        pragha_preferences_set_shuffle (preferences, !shuffle);
    }

    //XXX missed buttons: "Rewind" and "FastForward"
}
示例#4
0
文件: pragha.c 项目: TingPing/pragha
static void
pragha_application_dispose (GObject *object)
{
	PraghaApplication *pragha = PRAGHA_APPLICATION (object);

	CDEBUG(DBG_INFO, "Cleaning up");

	if (pragha->sidebar2_binding) {
		g_object_unref (pragha->sidebar2_binding);
		pragha->sidebar2_binding = NULL;
	}
#ifdef HAVE_LIBPEAS
	if (pragha->peas_engine) {
		pragha_plugins_save_activated (pragha);

		peas_engine_garbage_collect (pragha->peas_engine);

		g_object_unref (pragha->peas_engine);
		pragha->peas_engine = NULL;
	}
	if (pragha->peas_exten_set) {
		g_object_unref (pragha->peas_exten_set);
		pragha->peas_exten_set = NULL;
	}
#endif
	if (pragha->setting_dialog) {
		pragha_preferences_dialog_free (pragha->setting_dialog);
		pragha->setting_dialog = NULL;
	}
	if (pragha->backend) {
		pragha_playback_stop (pragha);
		g_object_unref (pragha->backend);
		pragha->backend = NULL;
	}
	if (pragha->art_cache) {
		g_object_unref (pragha->art_cache);
		pragha->art_cache = NULL;
	}
	if (pragha->enum_map) {
		g_object_unref (pragha->enum_map);
		pragha->enum_map = NULL;
	}
	if (pragha->mainwindow) {
		pragha_window_free (pragha);
		/* Explicit destroy mainwindow to finalize lifecycle of childrens */
		gtk_widget_destroy (pragha->mainwindow);
		pragha->mainwindow = NULL;
	}
	if (pragha->scanner) {
		pragha_scanner_free (pragha->scanner);
		pragha->scanner = NULL;
	}

	if (pragha->pixbuf_app) {
		g_object_unref (pragha->pixbuf_app);
		pragha->pixbuf_app = NULL;
	}

	if (pragha->menu_ui_manager) {
		g_object_unref (pragha->menu_ui_manager);
		pragha->menu_ui_manager = NULL;
	}

	/* Save Preferences and database. */

	if (pragha->preferences) {
		g_object_unref (pragha->preferences);
		pragha->preferences = NULL;
	}
	if (pragha->cdbase) {
		g_object_unref (pragha->cdbase);
		pragha->cdbase = NULL;
	}

	G_OBJECT_CLASS (pragha_application_parent_class)->dispose (object);
}