コード例 #1
0
ファイル: panel-menu-items.c プロジェクト: Lyude/mate-panel
static void
panel_menu_item_rescan_drive (GtkWidget *menuitem,
			      GDrive    *drive)
{
	g_drive_poll_for_media (drive, NULL,
				drive_poll_for_media_cb,
				menuitem_to_screen (menuitem));
}
コード例 #2
0
void
panel_menu_item_activate_desktop_file (GtkWidget  *menuitem,
				       const char *path)
{
	GError *error;

	error = NULL;
	panel_launch_desktop_file (path, NULL,
				   menuitem_to_screen (menuitem), &error);
	if (error) {
		panel_error_dialog (NULL, menuitem_to_screen (menuitem),
				    "cannot_launch_entry", TRUE,
				    _("Could not launch menu item"),
				    error->message);

		g_error_free (error);
	}
}
コード例 #3
0
ファイル: panel-menu-items.c プロジェクト: Lyude/mate-panel
static void
activate_path (GtkWidget  *menuitem,
	       const char *path)
{
	char *uri;

	uri = g_filename_to_uri (path, NULL, NULL);
	activate_uri_on_screen (uri, menuitem_to_screen (menuitem));
	g_free (uri);
}
コード例 #4
0
ファイル: panel-menu-items.c プロジェクト: Lyude/mate-panel
static void
panel_menu_item_mount_volume (GtkWidget *menuitem,
			      GVolume   *volume)
{
	PanelVolumeMountData *mount_data;

	mount_data = g_slice_new (PanelVolumeMountData);
	mount_data->screen = menuitem_to_screen (menuitem);
	mount_data->mount_op = gtk_mount_operation_new (NULL);
	gtk_mount_operation_set_screen (GTK_MOUNT_OPERATION (mount_data->mount_op),
					mount_data->screen);

	g_volume_mount (volume, G_MOUNT_MOUNT_NONE, mount_data->mount_op, NULL,
			volume_mount_cb, mount_data);
}
コード例 #5
0
static void
panel_menu_item_mount_volume (GtkWidget *menuitem,
			      GVolume   *volume)
{
	PanelVolumeMountData *mount_data;

	mount_data = g_slice_new (PanelVolumeMountData);
	mount_data->screen = menuitem_to_screen (menuitem);
	/*FIXME: kill PanelMountOperation when we can depend on newer GTK+ that
	 * will have the same feature */
	mount_data->mount_op = panel_mount_operation_new (NULL);

	g_volume_mount (volume, G_MOUNT_MOUNT_NONE, mount_data->mount_op, NULL,
			volume_mount_cb, mount_data);
}
コード例 #6
0
static void
activate_uri (GtkWidget  *menuitem,
	      const char *path)
{
	GError    *error = NULL;
	GFile     *file;
	GdkScreen *screen;
	char      *escaped;
	char      *scheme;
	char      *url;

	screen = menuitem_to_screen (menuitem);
	
	scheme = g_uri_parse_scheme (path);
	if (scheme) {
		url = g_strdup (path);
		g_free (scheme);
	} else {
		file = g_file_new_for_path (path);
		url = g_file_get_uri (file);
		g_object_unref (file);
	}
	
	if (g_str_has_prefix (url, "x-nautilus-search:")) {
		//FIXME: this is ugly...
		char *command;

		command = g_strdup_printf ("nautilus --no-desktop %s", url);
		gdk_spawn_command_line_on_screen (screen, command, &error);
	} else
		gnome_url_show_on_screen (url, screen, &error);

	if (error != NULL) {
		if (error->code != GNOME_URL_ERROR_CANCELLED) {
			char *primary;
			escaped = g_markup_escape_text (url, -1);
			primary = g_strdup_printf (_("Could not open location '%s'"),
						   escaped);
			g_free (escaped);
			panel_error_dialog (NULL, screen,
					    "cannot_show_url", TRUE,
					    primary, error->message);
			g_free (primary);
		}
		g_error_free (error);
	}
	g_free (url);
}
コード例 #7
0
ファイル: panel-menu-items.c プロジェクト: Lyude/mate-panel
void
panel_menu_item_activate_desktop_file (GtkWidget  *menuitem,
				       const char *path)
{
	panel_launch_desktop_file (path, menuitem_to_screen (menuitem), NULL);
}
コード例 #8
0
ファイル: panel-menu-items.c プロジェクト: Lyude/mate-panel
static void
activate_uri (GtkWidget  *menuitem,
	      const char *uri)
{
	activate_uri_on_screen (uri, menuitem_to_screen (menuitem));
}
コード例 #9
0
static void
panel_context_menu_show_about_dialog (GtkWidget *menuitem)
{
	static GtkWidget *about = NULL;
	char             *authors [] = {
		/* MATE */
		"Perberos <*****@*****.**>",
		"Stefano Karapetsas <*****@*****.**>",
		"Steve Zesch <*****@*****.**>",
		/* GNOME */
		"Alex Larsson <*****@*****.**>",
		"Anders Carlsson <*****@*****.**>",
		"Arvind Samptur <*****@*****.**>",
		"Darin Adler <*****@*****.**>",
		"Elliot Lee <*****@*****.**>",
		"Federico Mena <*****@*****.**>",
		"George Lebl <*****@*****.**>",
		"Glynn Foster <*****@*****.**>",
		"Ian Main <*****@*****.**>",
		"Ian McKellar <*****@*****.**>",
		"Jacob Berkman <*****@*****.**>",
		"Mark McLoughlin <*****@*****.**>",
		"Martin Baulig <*****@*****.**>",
		"Miguel de Icaza <*****@*****.**>",
		"Owen Taylor <*****@*****.**>",
		"Padraig O'Briain <*****@*****.**>",
		"Seth Nickell <*****@*****.**>",
		"Stephen Browne <*****@*****.**>",
		"Tom Tromey <*****@*****.**>",
		"Vincent Untz <*****@*****.**>",
		N_("And many, many others..."),
		NULL
	};
	char *documenters[] = {
	        "Alexander Kirillov <*****@*****.**>",
		"Dan Mueth <*****@*****.**>",
		"Dave Mason <*****@*****.**>",
		NULL
	  };
	int   i;

	if (about) {
		gtk_window_set_screen (GTK_WINDOW (about),
				       menuitem_to_screen (menuitem));
		gtk_window_present (GTK_WINDOW (about));
		return;
	}

	for (i = 0; authors [i]; i++)
		authors [i] = _(authors [i]);

	/* Note: we don't use gtk_show_about_dialog() since some applets can
	 * be loaded in this process and we don't want to share the about
	 * dialog */
	about = mate_about_dialog_new ();
	g_object_set (about,
		      "program-name",  _("The MATE Panel"),
		      "version", VERSION,
		      "copyright", "Copyright \xc2\xa9 1997-2003 Free Software Foundation, Inc.",
		      "comments", _("This program is responsible for launching other "
				    "applications and provides useful utilities."),
		      "authors", authors,
		      "documenters", documenters,
		      "title", _("About the MATE Panel"),
		      "translator-credits", _("translator-credits"),
		      "logo-icon-name", PANEL_ICON_PANEL,
		      NULL);

	gtk_window_set_screen (GTK_WINDOW (about),
			       menuitem_to_screen (menuitem));
	g_signal_connect (about, "destroy",
			  G_CALLBACK (gtk_widget_destroyed),
			  &about);
	g_signal_connect (about, "event",
			  G_CALLBACK (panel_context_menu_check_for_screen),
			  NULL);

	g_signal_connect (about, "response",
			  G_CALLBACK (gtk_widget_destroy),
			  NULL);

	gtk_widget_show (about);
}