Ejemplo n.º 1
0
static void
fr_application_activate_help (GSimpleAction *action,
			      GVariant      *parameter,
			      gpointer       user_data)
{
	GtkWidget *window;

	window = _gtk_application_get_current_window (G_APPLICATION (user_data));
	_gtk_show_help_dialog (GTK_WINDOW (window) , NULL);
}
Ejemplo n.º 2
0
static void
fr_application_activate_open (GSimpleAction *action,
			      GVariant      *parameter,
			      gpointer       user_data)
{
	GtkWidget *window;

	window = _gtk_application_get_current_window (G_APPLICATION (user_data));
	if (window != NULL)
		fr_window_activate_open (action, parameter, window);
}
Ejemplo n.º 3
0
static void
fr_application_activate_about (GSimpleAction *action,
			       GVariant      *parameter,
			       gpointer       user_data)
{
	const char *authors[] = { "Paolo Bacchilega <*****@*****.**>", NULL	};
	const char *documenters [] = { "Alexander Kirillov", "Breda McColgan", NULL };

	gtk_show_about_dialog (GTK_WINDOW (_gtk_application_get_current_window (G_APPLICATION (user_data))),
			       "version", PACKAGE_VERSION,
			       "copyright", _("Copyright \xc2\xa9 2001–2014 Free Software Foundation, Inc."),
			       "comments", _("An archive manager for GNOME."),
			       "authors", authors,
			       "documenters", documenters,
			       "translator-credits", _("translator-credits"),
			       "logo-icon-name", "org.gnome.ArchiveManager",
			       "license-type", GTK_LICENSE_GPL_2_0,
			       "wrap-license", TRUE,
			       NULL);
}
Ejemplo n.º 4
0
static int
goo_application_command_line (GApplication            *application,
			      GApplicationCommandLine *command_line)
{
	char           **argv;
	int              argc;
	GOptionContext  *options_context;
	GError          *error = NULL;
	GtkWidget       *window;

	argv = g_application_command_line_get_arguments (command_line, &argc);
	options_context = goo_application_create_option_context ();
	if (! g_option_context_parse (options_context, &argc, &argv, &error)) {
		g_critical ("Failed to parse arguments: %s", error->message);
		g_error_free (error);
		g_option_context_free (options_context);
		return goo_application_command_line_finished (application, EXIT_FAILURE);
	}
	g_option_context_free (options_context);

	/* check the gstreamer plugins */

	if (! required_gstreamer_plugins_available ()) {
		GtkWidget *d;
		d = _gtk_message_dialog_new (NULL,
					     0,
					     _GTK_ICON_NAME_DIALOG_ERROR,
					     _("Cannot start the CD player"),
					     _("In order to read CDs you have to install the gstreamer base plugins"),
					     _GTK_LABEL_OK, GTK_RESPONSE_OK,
					     NULL);
		g_signal_connect_swapped (G_OBJECT (d), "response",
					  G_CALLBACK (gtk_widget_destroy),
					  d);
		gtk_window_set_application (GTK_WINDOW (d), GTK_APPLICATION (application));
		gtk_widget_show (d);

		return goo_application_command_line_finished (application, EXIT_FAILURE);
	}

	/* execute the command line */

	window = _gtk_application_get_current_window (GTK_APPLICATION (application));
	if (window == NULL)
		window = goo_window_new (NULL);
	gtk_window_present (GTK_WINDOW (window));

	if (arg_auto_play) {
		goo_window_play (GOO_WINDOW (window));
	}
	else if (arg_toggle_play) {
		goo_window_toggle_play (GOO_WINDOW (window));
	}
	else if (arg_stop) {
		goo_window_stop (GOO_WINDOW (window));
	}
	else if (arg_next) {
		goo_window_next (GOO_WINDOW (window));
	}
	else if (arg_prev) {
		goo_window_prev (GOO_WINDOW (window));
	}
	else if (arg_eject) {
		goo_window_eject (GOO_WINDOW (window));
	}
	else if (arg_toggle_visibility) {
		goo_window_toggle_visibility (GOO_WINDOW (window));
	}
	else if (arg_quit) {
		goo_window_close (GOO_WINDOW (window));
	}
	else if (arg_device != NULL) {
		BraseroDrive *drive;

		drive = main_get_drive_for_device (arg_device);
		window = main_get_window_from_device (arg_device);
		if (window == NULL) {
			window = goo_window_new (drive);
			gtk_widget_show (window);
		}
		else
			goo_window_set_drive (GOO_WINDOW (window), drive);

		g_object_unref (drive);
		g_free (arg_device);
		arg_device = NULL;
	}

	return goo_application_command_line_finished (application, EXIT_SUCCESS);
}