source: trunk/third/gnome-core/panel/gnome-panel-add-launcher.c @ 15821

Revision 15821, 2.5 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15820, which included commits to RCS files with non-trunk default branches.
Line 
1/*   gnome-panel-add-launcher: Thingie to add a launcher
2 *
3 *   Copyright 2000 Eazel, Inc.
4 *   Authors: George Lebl <jirka@5z.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22#include <config.h>
23#include <gnome.h>
24#include <libgnorba/gnorba.h>
25#include <libgnomeui/gnome-window-icon.h>
26#include <gdk/gdkx.h>
27#include "gnome-panel.h"
28
29static int panel = 0;
30static int pos = 0;
31static gboolean url = FALSE;
32
33static const struct poptOption options[] = {
34        { "panel", 0, POPT_ARG_INT, &panel, 0, N_("Panel to add the launcher to"), N_("NUMBER") },
35        { "pos", 0, POPT_ARG_INT, &pos, 0, N_("Position to add the launcher to"), N_("NUMBER") },
36        { "url", 0, POPT_ARG_NONE, &url, 0, N_("The argument is a url to add, not a .desktop file"), NULL },
37        { NULL }
38};
39
40int
41main (int argc, char **argv)
42{
43        CORBA_Environment ev;
44        poptContext ctx;
45        const char **args;
46        const char *arg;
47        GNOME_Panel2 panel_client = CORBA_OBJECT_NIL;
48
49        bindtextdomain (PACKAGE, GNOMELOCALEDIR);
50        textdomain (PACKAGE);
51
52        CORBA_exception_init(&ev);
53
54        if (gnome_CORBA_init_with_popt_table ("gnome-panel-add-launcher", VERSION,
55                                              &argc, argv,
56                                              options, 0, &ctx,
57                                              GNORBA_INIT_SERVER_FUNC, &ev) == NULL)
58                return 1;
59
60        args = poptGetArgs (ctx);
61
62        if (args == NULL ||
63            args[0] == NULL ||
64            args[1] != NULL) {
65                fprintf (stderr,
66                         _("You must supply a single argument with the "
67                           ".desktop file or url to use\n"));
68                return 1;
69        }
70
71        arg = args[0];
72
73        panel_client =
74                goad_server_activate_with_repo_id (NULL,
75                                                   "IDL:GNOME/Panel2:1.0",
76                                                   GOAD_ACTIVATE_EXISTING_ONLY,
77                                                   NULL);
78       
79        if (panel_client == NULL) {
80                fprintf (stderr, _("No panel found\n"));
81                return 1;
82        }
83
84        if (url)
85                GNOME_Panel2_add_launcher_from_info_url (panel_client, arg, arg, arg, "", panel, pos, &ev);
86        else
87                GNOME_Panel2_add_launcher (panel_client, arg, panel, pos, &ev);
88
89        CORBA_exception_free(&ev);
90
91        return 0;
92}
Note: See TracBrowser for help on using the repository browser.