Commit e27fb553 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

Random re-formatting foo and: (get_url_from_input): add from Frank's

2003-05-19  Mark McLoughlin  <mark@skynet.ie>

	* panel-run-dialog.[ch]:
	Random re-formatting foo and:
	(get_url_from_input): add from Frank's original libgnome
	patch. Seems it never got in.

2003-05-19  Frank Worsley <fworsley@shaw.ca>

	* panel-run-dialog.c
	* panel-run-dialog.h
	* panel-run-dialog.glade
	the sweet new run program dialog

	* Makefile.am:
	added in the new files

	* menu.c: (add_to_run_dialog):
	* panel-action-button.c: (panel_action_run_program):
	* panel-action-protocol.c: (panel_action_protocol_run_dialog):
	moved to new run dialog function names

	* panel-util.c: (panel_get_unique_uri):
	copied from launcher.c, a function to get a unique uri
	for a given location and file suffix

	* launcher.c: (launcher_location), (panel_launcher_save_ditem):
	now uses new util function to get unique uri

	* panel-util.h:
	updated for new function

	* panel.c:
	don't include gnome-run.h
parent 52ffe563
2003-05-19 Mark McLoughlin <mark@skynet.ie>
* panel-run-dialog.[ch]:
Random re-formatting foo and:
(get_url_from_input): add from Frank's original libgnome
patch. Seems it never got in.
2003-05-19 Frank Worsley <fworsley@shaw.ca>
* panel-run-dialog.c
* panel-run-dialog.h
* panel-run-dialog.glade
the sweet new run program dialog
* Makefile.am:
added in the new files
* menu.c: (add_to_run_dialog):
* panel-action-button.c: (panel_action_run_program):
* panel-action-protocol.c: (panel_action_protocol_run_dialog):
moved to new run dialog function names
* panel-util.c: (panel_get_unique_uri):
copied from launcher.c, a function to get a unique uri
for a given location and file suffix
* launcher.c: (launcher_location), (panel_launcher_save_ditem):
now uses new util function to get unique uri
* panel-util.h:
updated for new function
* panel.c:
don't include gnome-run.h
2003-05-19 Mark McLoughlin <mark@skynet.ie> 2003-05-19 Mark McLoughlin <mark@skynet.ie>
* gnome-run.c: (unset_selected): Remove bogus unsetting * gnome-run.c: (unset_selected): Remove bogus unsetting
......
...@@ -113,7 +113,7 @@ panel_sources = \ ...@@ -113,7 +113,7 @@ panel_sources = \
panel-gconf.c \ panel-gconf.c \
panel-properties-dialog.c \ panel-properties-dialog.c \
distribution.c \ distribution.c \
gnome-run.c \ panel-run-dialog.c \
menu.c \ menu.c \
menu-util.c \ menu-util.c \
menu-ditem.c \ menu-ditem.c \
...@@ -159,7 +159,7 @@ panel_headers = \ ...@@ -159,7 +159,7 @@ panel_headers = \
panel-config-global.h \ panel-config-global.h \
panel-gconf.h \ panel-gconf.h \
distribution.h \ distribution.h \
gnome-run.h \ panel-run-dialog.h \
menu.h \ menu.h \
menu-util.h \ menu-util.h \
menu-ditem.h \ menu-ditem.h \
...@@ -249,7 +249,8 @@ gladedir = $(datadir)/gnome/panel ...@@ -249,7 +249,8 @@ gladedir = $(datadir)/gnome/panel
glade_DATA = \ glade_DATA = \
gnome-panel-preferences.glade \ gnome-panel-preferences.glade \
gnome-panel-screenshot.glade \ gnome-panel-screenshot.glade \
panel-properties-dialog.glade panel-properties-dialog.glade \
panel-run-dialog.glade
EXTRA_DIST = \ EXTRA_DIST = \
GNOME_Panel.server.in \ GNOME_Panel.server.in \
......
This diff is collapsed.
...@@ -78,67 +78,6 @@ panel_launcher_get_filename (const char *path) ...@@ -78,67 +78,6 @@ panel_launcher_get_filename (const char *path)
return p; return p;
} }
static char *
panel_launcher_make_full_path (const char *filename)
{
char *tmp, *retval;
g_return_val_if_fail (filename != NULL, NULL);
tmp = gnome_util_home_file (PANEL_LAUNCHERS_PATH);
/* Make sure the launcher directory exists */
if (!g_file_test (tmp, G_FILE_TEST_EXISTS))
panel_ensure_dir (tmp);
retval = g_build_filename (tmp, filename, NULL);
g_free (tmp);
return retval;
}
static char *
panel_launcher_make_unique_path (void)
{
#define NUM_OF_WORDS 12
char *words[] = {
"foo",
"bar",
"blah",
"gegl",
"frobate",
"hadjaha",
"greasy",
"hammer",
"eek",
"larry",
"curly",
"moe",
NULL};
char *retval = NULL;
gboolean exists = TRUE;
while (exists) {
char *filename;
int rnd;
int word;
rnd = rand ();
word = rand () % NUM_OF_WORDS;
filename = g_strdup_printf ("%s-%010x.desktop",
words [word],
(guint) rnd);
retval = panel_launcher_make_full_path (filename);
exists = g_file_test (retval, G_FILE_TEST_EXISTS);
g_free (filename);
}
return retval;
}
static void static void
panel_launcher_save_ditem (GnomeDesktopItem *ditem, panel_launcher_save_ditem (GnomeDesktopItem *ditem,
GdkScreen *screen) GdkScreen *screen)
...@@ -152,7 +91,7 @@ panel_launcher_save_ditem (GnomeDesktopItem *ditem, ...@@ -152,7 +91,7 @@ panel_launcher_save_ditem (GnomeDesktopItem *ditem,
if (!location) { if (!location) {
char *path; char *path;
path = panel_launcher_make_unique_path (); path = panel_make_unique_path (NULL, ".desktop");
gnome_desktop_item_set_location (ditem, path); gnome_desktop_item_set_location (ditem, path);
g_free (path); g_free (path);
} }
...@@ -479,7 +418,7 @@ create_launcher (const char *location) ...@@ -479,7 +418,7 @@ create_launcher (const char *location)
if (!strchr (location, G_DIR_SEPARATOR)) { if (!strchr (location, G_DIR_SEPARATOR)) {
char *path; char *path;
path = panel_launcher_make_full_path (location); path = panel_make_full_path (NULL, location);
ditem = gnome_desktop_item_new_from_file (path, 0, &error); ditem = gnome_desktop_item_new_from_file (path, 0, &error);
g_free (path); g_free (path);
} else } else
...@@ -1082,7 +1021,7 @@ panel_launcher_create_copy (PanelToplevel *toplevel, ...@@ -1082,7 +1021,7 @@ panel_launcher_create_copy (PanelToplevel *toplevel,
char *new_location; char *new_location;
const char *filename; const char *filename;
new_location = panel_launcher_make_unique_path (); new_location = panel_make_unique_path (NULL, ".desktop");
source_uri = gnome_vfs_uri_new (location); source_uri = gnome_vfs_uri_new (location);
dest_uri = gnome_vfs_uri_new (new_location); dest_uri = gnome_vfs_uri_new (new_location);
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "button-widget.h" #include "button-widget.h"
#include "distribution.h" #include "distribution.h"
#include "gnome-run.h"
#include "launcher.h" #include "launcher.h"
#include "nothing.h" #include "nothing.h"
#include "menu-fentry.h" #include "menu-fentry.h"
...@@ -65,6 +64,7 @@ ...@@ -65,6 +64,7 @@
#include "panel-menu-button.h" #include "panel-menu-button.h"
#include "panel-globals.h" #include "panel-globals.h"
#include "panel-properties-dialog.h" #include "panel-properties-dialog.h"
#include "panel-run-dialog.h"
#undef MENU_DEBUG #undef MENU_DEBUG
...@@ -1187,7 +1187,7 @@ add_to_run_dialog (GtkWidget *widget, ...@@ -1187,7 +1187,7 @@ add_to_run_dialog (GtkWidget *widget,
item, GNOME_DESKTOP_ITEM_URL); item, GNOME_DESKTOP_ITEM_URL);
if (exec != NULL) if (exec != NULL)
show_run_dialog_with_text (menuitem_to_screen (sim->menuitem), exec); panel_run_dialog_present_with_text (menuitem_to_screen (sim->menuitem), exec);
else else
panel_error_dialog ( panel_error_dialog (
menuitem_to_screen (sim->menuitem), menuitem_to_screen (sim->menuitem),
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "applet.h" #include "applet.h"
#include "egg-screen-exec.h" #include "egg-screen-exec.h"
#include "gnome-run.h"
#include "menu.h" #include "menu.h"
#include "panel-config-global.h" #include "panel-config-global.h"
#include "panel-gconf.h" #include "panel-gconf.h"
...@@ -43,6 +42,7 @@ ...@@ -43,6 +42,7 @@
#include "panel-util.h" #include "panel-util.h"
#include "panel-session.h" #include "panel-session.h"
#include "panel-globals.h" #include "panel-globals.h"
#include "panel-run-dialog.h"
enum { enum {
PROP_0, PROP_0,
...@@ -135,7 +135,7 @@ panel_action_logout (GtkWidget *widget) ...@@ -135,7 +135,7 @@ panel_action_logout (GtkWidget *widget)
void void
panel_action_run_program (GtkWidget *widget) panel_action_run_program (GtkWidget *widget)
{ {
show_run_dialog (gtk_widget_get_screen (widget)); panel_run_dialog_present (gtk_widget_get_screen (widget));
} }
/* Search For Files /* Search For Files
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
#include <libgnome/gnome-i18n.h> #include <libgnome/gnome-i18n.h>
#include "egg-screen-exec.h" #include "egg-screen-exec.h"
#include "gnome-run.h"
#include "menu.h" #include "menu.h"
#include "panel-globals.h" #include "panel-globals.h"
#include "panel-toplevel.h" #include "panel-toplevel.h"
#include "panel-util.h" #include "panel-util.h"
#include "panel-run-dialog.h"
static Atom atom_gnome_panel_action = None; static Atom atom_gnome_panel_action = None;
static Atom atom_gnome_panel_action_main_menu = None; static Atom atom_gnome_panel_action_main_menu = None;
...@@ -62,7 +62,7 @@ panel_action_protocol_main_menu (GdkScreen *screen, ...@@ -62,7 +62,7 @@ panel_action_protocol_main_menu (GdkScreen *screen,
static void static void
panel_action_protocol_run_dialog (GdkScreen *screen) panel_action_protocol_run_dialog (GdkScreen *screen)
{ {
show_run_dialog (screen); panel_run_dialog_present (screen);
} }
static GdkFilterReturn static GdkFilterReturn
......
This diff is collapsed.
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="panel_run_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">Run Application</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="help_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-11</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="run_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property>
<accessibility>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Click this button to run the selected application or the command in the command entry field.</atkproperty>
</accessibility>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Run</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="main_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="entry_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkImage" id="icon_pixmap">
<property name="width_request">48</property>
<property name="height_request">48</property>
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Command icon</atkproperty>
<atkproperty name="AtkObject::accessible_description" translatable="yes">The icon of the command to be run.</atkproperty>
</accessibility>
</widget>
</child>
</widget>
<packing>
<property name="padding">10</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GnomeEntry" id="gnome_entry">
<property name="visible">True</property>
<property name="history_id">gnome-run</property>
<property name="max_saved">10</property>
<child internal-child="entry">
<widget class="GtkEntry" id="gtk_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Command entry</atkproperty>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Enter a command string here to run it.</atkproperty>
</accessibility>
</widget>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="terminal_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Run in _terminal</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Select this box to run the command in a terminal window.</atkproperty>
</accessibility>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="file_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Run with _file...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<accessibility>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Click this button to browse for a file whose name to append to the command string.</atkproperty>
</accessibility>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="list_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show list of known _applications</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible_description" translatable="yes">When this is selected the list of known applications is displayed.</atkproperty>
</accessibility>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="program_list_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="program_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">List of known applications</atkproperty>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Select an application from the list to run it</atkproperty>
</accessibility>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="program_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Select an application to view its description.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Application description</atkproperty>
<atkproperty name="AtkObject::accessible_description" translatable="yes">A description of the currently selected application or information on the command that will be run.</atkproperty>
</accessibility>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
/* /*
* grun: Popup a command dialog. Original version by Elliot Lee, * panel-run-dialog.h:
* bloatware edition by Havoc Pennington. Both versions written in 10
* minutes or less. :-)
* Copyright (C) 1998 Havoc Pennington <hp@pobox.com>
* Copyright (C) 2000 Eazel, Inc.
* *
* This program is free software; you can redistribute it and/or * Copyright (C) 2003 Frank Worsley <fworsley@shaw.ca>
* modify it under the terms of the GNU General Public License as *
* 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 * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* USA * 02111-1307, USA.
* Authors:
* Frank Worsley <fworsley@shaw.ca>
*/ */
#ifndef GNOME_RUN_H #ifndef __PANEL_RUN_DIALOG_H__
#define GNOME_RUN_H #define __PANEL_RUN_DIALOG_H__
#include <glib/gmacros.h>
#include <gtk/gtk.h>