A
download gnome-panel-add-launcher.c
Language: C
License: GPL
Copyright: Copyright 2000 Eazel, Inc.
LOC: 58
Project Info
gnome-core
Server: Gnome
Type: cvs
...nome‑core\gnome‑core\panel\
   .cvsignore
   aligned-widget.c
   aligned-widget.h
   applet.c
   applet.h
   basep-widget.c
   basep-widget.h
   border-widget.c
   border-widget.h
   button-widget.c
   button-widget.h
   distribution.c
   distribution.h
   drawer-widget.c
   drawer-widget.h
   drawer.c
   drawer.h
   edge-widget.c
   edge-widget.h
   floating-widget.c
   floating-widget.h
   foobar-widget.c
   foobar-widget.h
   global-keys.c
   global-keys.h
   gnome-panel-add-launcher.c
   gnome-panel-properties.c
   ...l-properties.desktop.in
   ...-panel-properties.glade
   gnome-panel-screenshot.c
   ...-panel-screenshot.glade
   gnome-run.c
   gnome-run.h
   GNOME_Panel.server.in
   launcher.c
   launcher.h
   logout.c
   logout.h
   main.c
   Makefile.am
   menu-fentry.c
   menu-fentry.h
   menu-properties.c
   menu-properties.h
   menu-util.c
   menu-util.h
   menu.c
   menu.h
   multiscreen-stuff.c
   multiscreen-stuff.h
   nothing.cP
   nothing.h
   panel-applet-frame.c
   panel-applet-frame.h
   panel-config-global.h
   panel-config.c
   panel-config.h
   panel-gconf.c
   panel-gconf.h
   ...l-global-config.schemas
   panel-main.h
   panel-marshal.list
   ...er-panel-config.schemas
   panel-shell.c
   panel-shell.h
   panel-types.h
   panel-util.c
   panel-util.h
   panel-widget.c
   panel-widget.h
   panel.c
   panel.h
   panel.hints
   quick-desktop-reader.c
   quick-desktop-reader.h
   rgb-stuff.c
   rgb-stuff.h
   session.c
   session.h
   sliding-widget.c
   sliding-widget.h
   status-docklet.c
   status-docklet.h
   status.c
   status.h
   swallow.c
   swallow.h
   TODO.old
   xstuff.c
   xstuff.h

/*   gnome-panel-add-launcher: Thingie to add a launcher
 *
 *   Copyright 2000 Eazel, Inc.
 *   Authors: George Lebl <jirka@5z.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */

#include <config.h>
#include <libgnomeui/libgnomeui.h>
#include <bonobo-activation/bonobo-activation.h>
#include <libgnomeui/gnome-window-icon.h>
#include <gdk/gdkx.h>
#include "GNOME_Panel.h"

static int panel = 0;
static int pos = 0;
static gboolean url = FALSE;

static const struct poptOption options[] = {
	{ "panel", 0, POPT_ARG_INT, &panel, 0, N_("Panel to add the launcher to"), N_("NUMBER") },
	{ "pos", 0, POPT_ARG_INT, &pos, 0, N_("Position to add the launcher to"), N_("NUMBER") },
	{ "url", 0, POPT_ARG_NONE, &url, 0, N_("The argument is a url to add, not a .desktop file"), NULL },
	{ NULL } 
};

int
main (int argc, char **argv)
{
	CORBA_Environment ev;
	poptContext ctx;
	const char **args;
	const char *arg;
	GNOME_Panel2 panel_client = CORBA_OBJECT_NIL;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	CORBA_exception_init(&ev);

	if (gnome_CORBA_init_with_popt_table ("gnome-panel-add-launcher", VERSION,
					      &argc, argv,
					      options, 0, &ctx,
					      GNORBA_INIT_SERVER_FUNC, &ev) == NULL)
		return 1;

	args = poptGetArgs (ctx);

	if (args == NULL ||
	    args[0] == NULL ||
	    args[1] != NULL) {
		fprintf (stderr,
			 _("You must supply a single argument with the "
			   ".desktop file or url to use\n"));
		return 1;
	}

	arg = args[0];

	panel_client =
		goad_server_activate_with_repo_id (NULL,
						   "IDL:GNOME/Panel2:1.0",
						   GOAD_ACTIVATE_EXISTING_ONLY,
						   NULL);
	
	if (panel_client == NULL) {
		fprintf (stderr, _("No panel found\n"));
		return 1;
	}

	if (url)
		GNOME_Panel2_add_launcher_from_info_url (panel_client, arg, arg, arg, "", panel, pos, &ev);
	else
		GNOME_Panel2_add_launcher (panel_client, arg, panel, pos, &ev);

	CORBA_exception_free(&ev);

	return 0;
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us