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>
* gnome-run.c: (unset_selected): Remove bogus unsetting
......
......@@ -113,7 +113,7 @@ panel_sources = \
panel-gconf.c \
panel-properties-dialog.c \
distribution.c \
gnome-run.c \
panel-run-dialog.c \
menu.c \
menu-util.c \
menu-ditem.c \
......@@ -159,7 +159,7 @@ panel_headers = \
panel-config-global.h \
panel-gconf.h \
distribution.h \
gnome-run.h \
panel-run-dialog.h \
menu.h \
menu-util.h \
menu-ditem.h \
......@@ -249,7 +249,8 @@ gladedir = $(datadir)/gnome/panel
glade_DATA = \
gnome-panel-preferences.glade \
gnome-panel-screenshot.glade \
panel-properties-dialog.glade
panel-properties-dialog.glade \
panel-run-dialog.glade
EXTRA_DIST = \
GNOME_Panel.server.in \
......
This diff is collapsed.
......@@ -78,67 +78,6 @@ panel_launcher_get_filename (const char *path)
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
panel_launcher_save_ditem (GnomeDesktopItem *ditem,
GdkScreen *screen)
......@@ -152,7 +91,7 @@ panel_launcher_save_ditem (GnomeDesktopItem *ditem,
if (!location) {
char *path;
path = panel_launcher_make_unique_path ();
path = panel_make_unique_path (NULL, ".desktop");
gnome_desktop_item_set_location (ditem, path);
g_free (path);
}
......@@ -479,7 +418,7 @@ create_launcher (const char *location)
if (!strchr (location, G_DIR_SEPARATOR)) {
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);
g_free (path);
} else
......@@ -1082,7 +1021,7 @@ panel_launcher_create_copy (PanelToplevel *toplevel,
char *new_location;
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);
dest_uri = gnome_vfs_uri_new (new_location);
......
......@@ -39,7 +39,6 @@
#include "button-widget.h"
#include "distribution.h"
#include "gnome-run.h"
#include "launcher.h"
#include "nothing.h"
#include "menu-fentry.h"
......@@ -65,6 +64,7 @@
#include "panel-menu-button.h"
#include "panel-globals.h"
#include "panel-properties-dialog.h"
#include "panel-run-dialog.h"
#undef MENU_DEBUG
......@@ -1187,7 +1187,7 @@ add_to_run_dialog (GtkWidget *widget,
item, GNOME_DESKTOP_ITEM_URL);
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
panel_error_dialog (
menuitem_to_screen (sim->menuitem),
......
......@@ -32,7 +32,6 @@
#include "applet.h"
#include "egg-screen-exec.h"
#include "gnome-run.h"
#include "menu.h"
#include "panel-config-global.h"
#include "panel-gconf.h"
......@@ -43,6 +42,7 @@
#include "panel-util.h"
#include "panel-session.h"
#include "panel-globals.h"
#include "panel-run-dialog.h"
enum {
PROP_0,
......@@ -135,7 +135,7 @@ panel_action_logout (GtkWidget *widget)
void
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
......
......@@ -32,11 +32,11 @@
#include <libgnome/gnome-i18n.h>
#include "egg-screen-exec.h"
#include "gnome-run.h"
#include "menu.h"
#include "panel-globals.h"
#include "panel-toplevel.h"
#include "panel-util.h"
#include "panel-run-dialog.h"
static Atom atom_gnome_panel_action = None;
static Atom atom_gnome_panel_action_main_menu = None;
......@@ -62,7 +62,7 @@ panel_action_protocol_main_menu (GdkScreen *screen,
static void
panel_action_protocol_run_dialog (GdkScreen *screen)
{
show_run_dialog (screen);
panel_run_dialog_present (screen);
}
static GdkFilterReturn
......
This diff is collapsed.
This diff is collapsed.
/*
* grun: Popup a command dialog. Original version by Elliot Lee,
* 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.
* panel-run-dialog.h:
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* Copyright (C) 2003 Frank Worsley <fworsley@shaw.ca>
*
* 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.
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
* Authors:
* Frank Worsley <fworsley@shaw.ca>
*/
#ifndef GNOME_RUN_H
#define GNOME_RUN_H
#ifndef __PANEL_RUN_DIALOG_H__
#define __PANEL_RUN_DIALOG_H__
#include <glib/gmacros.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
void show_run_dialog (GdkScreen *screen);
void show_run_dialog_with_text (GdkScreen *screen,
const char *text);
void panel_run_dialog_present (GdkScreen *screen);
void panel_run_dialog_present_with_text (GdkScreen *screen,
const char *text);
G_END_DECLS
#endif /* GNOME_RUN_H */
#endif /* __PANEL_RUN_DIALOG_H__ */
......@@ -43,6 +43,7 @@
#include "egg-screen-help.h"
#include "xstuff.h"
#include "panel-globals.h"
#include "launcher.h"
GdkScreen *
panel_screen_from_number (int screen)
......@@ -1439,3 +1440,75 @@ panel_lock_screen (GdkScreen *screen)
_("<b>Cannot execute xscreensaver</b>\n\n"
"Details: xscreensaver-command not found"));
}
char *
panel_make_full_path (const char *dir,
const char *filename)
{
char *retval;
char *freeme = NULL;
g_return_val_if_fail (filename != NULL, NULL);
if (!dir) {
freeme = gnome_util_home_file (PANEL_LAUNCHERS_PATH);
dir = freeme;
}
/* Make sure the launcher directory exists */
if (!g_file_test (dir, G_FILE_TEST_EXISTS))
panel_ensure_dir (dir);
retval = g_build_filename (dir, filename, NULL);
g_free (freeme);
return retval;
}
char *
panel_make_unique_path (const char *dir,
const char *suffix)
{
#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%s",
words [word],
(guint) rnd,
suffix);
g_free (retval);
retval = panel_make_full_path (dir, filename);
exists = g_file_test (retval, G_FILE_TEST_EXISTS);
g_free (filename);
}
return retval;
#undef NUM_OF_WORDS
}
......@@ -162,6 +162,10 @@ void panel_set_atk_relation (GtkWidget *widget,
GdkPixbuf * missing_pixbuf (int size);
char *panel_make_full_path (const char *dir,
const char *filename);
char *panel_make_unique_path (const char *dir,
const char *suffix);
G_END_DECLS
......
......@@ -32,7 +32,6 @@
#include "drawer.h"
#include "button-widget.h"
#include "distribution.h"
#include "gnome-run.h"
#include "launcher.h"
#include "menu-fentry.h"
#include "menu-util.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment