Commit d6a8664f authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Implement a quick no-frills .desktop reader to make reading .desktop files

Fri Nov 16 22:13:22 2001  George Lebl <jirka@5z.com>

	* quick-desktop-reader.[ch], Makefile.am, gnome-run.c, menu-fentry.c:
	  Implement a quick no-frills .desktop reader to make reading
	  .desktop files quicker and less memory heavy.

	* gnome-run.c, menu.c: use the NO_TRANSLATIONS flag of gnome-desktop
	  where appropriate

	* applet.c, foobar-widget.c, global-keys.c, gnome-run.c,
	  menu-fentry.c, menu-properties.c, menu.c, panel.c,
	  session.c, panel-util.[ch]: move to g_path_is_absolute,
	  g_find_program_in_path, g_shell_parse_argv and
	  g_ascii_strcasecmp

	* gnome-run.c: whack the usage of gnome-pixmap
parent d903a273
Fri Nov 16 22:13:22 2001 George Lebl <jirka@5z.com>
* quick-desktop-reader.[ch], Makefile.am, gnome-run.c, menu-fentry.c:
Implement a quick no-frills .desktop reader to make reading
.desktop files quicker and less memory heavy.
* gnome-run.c, menu.c: use the NO_TRANSLATIONS flag of gnome-desktop
where appropriate
* applet.c, foobar-widget.c, global-keys.c, gnome-run.c,
menu-fentry.c, menu-properties.c, menu.c, panel.c,
session.c, panel-util.[ch]: move to g_path_is_absolute,
g_find_program_in_path, g_shell_parse_argv and
g_ascii_strcasecmp
* gnome-run.c: whack the usage of gnome-pixmap
Fri Nov 16 13:47:27 2001 George Lebl <jirka@5z.com>
* Makefile.am: remove $(includedir) from includes to prevent old
......
......@@ -162,6 +162,7 @@ panel_sources = \
extern.c \
panel-applet-frame.c \
panel-shell.c \
quick-desktop-reader.c \
$(NULL)
panel_headers = \
......@@ -207,6 +208,7 @@ panel_headers = \
launcher.h \
extern.h \
panel-applet-frame.h \
quick-desktop-reader.h \
$(NULL)
panel_2_SOURCES = \
......
......@@ -157,7 +157,7 @@ applet_callback_callback(GtkWidget *widget, gpointer data)
menu_properties(menu->info->data);
else if(strcmp(menu->name,"edit_menus")==0) {
char *tmp;
if((tmp = gnome_is_program_in_path("gmenu"))) {
if((tmp = g_find_program_in_path ("gmenu"))) {
gnome_execute_async (g_get_home_dir (), 1, &tmp);
g_free(tmp);
}
......
......@@ -340,7 +340,7 @@ display_gmc_menu (void)
if ( ! checked_path) {
char *gmc_client;
gmc_client = gnome_is_program_in_path ("gmc-client");
gmc_client = g_find_program_in_path ("gmc-client");
if (gmc_client == NULL)
got_gmc = FALSE;
......@@ -426,7 +426,7 @@ append_desktop_menu (GtkWidget *menu_bar)
item = add_menu_separator (menu);
gmc_menu_items = g_list_prepend (gmc_menu_items, item);
char_tmp = gnome_is_program_in_path ("xscreensaver");
char_tmp = g_find_program_in_path ("xscreensaver");
if (char_tmp) {
item = pixmap_menu_item_new (_("Lock Screen"),
"gnome-lockscreen.png");
......@@ -661,7 +661,7 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar)
add_menu_separator (menu);
#endif
time_admin_path = gnome_is_program_in_path ("time-admin");
time_admin_path = g_find_program_in_path ("time-admin");
if (time_admin_path) {
item = gtk_menu_item_new_with_label (_("Set Time"));
gtk_signal_connect (GTK_OBJECT (item), "activate",
......
......@@ -284,7 +284,7 @@ panel_global_keys_filter (GdkXEvent *gdk_xevent,
return GDK_FILTER_CONTINUE;
}
proggie = gnome_is_program_in_path ("gnome-panel-screenshot");
proggie = g_find_program_in_path ("gnome-panel-screenshot");
if (proggie == NULL) {
panel_error_dialog ("cannot_find_ss_program",
_("Can't find the screenshot "
......@@ -312,7 +312,7 @@ panel_global_keys_filter (GdkXEvent *gdk_xevent,
return GDK_FILTER_CONTINUE;
}
proggie = gnome_is_program_in_path ("gnome-panel-screenshot");
proggie = g_find_program_in_path ("gnome-panel-screenshot");
if (proggie == NULL) {
panel_error_dialog ("cannot_find_ss_program",
_("Can't find the screenshot "
......
......@@ -36,6 +36,7 @@
#include "menu.h"
#include "main.h"
#include "multiscreen-stuff.h"
#include "quick-desktop-reader.h"
#include "applet.h"
#include "button-widget.h"
......@@ -133,8 +134,6 @@ kill_completion (void)
}
}
/* Note, this expects a vector allocated by popt, where we can
* just forget about entries as they are part of the same buffer */
static void
get_environment (int *argc, char ***argv, int *envc, char ***envv)
{
......@@ -163,10 +162,13 @@ get_environment (int *argc, char ***argv, int *envc, char ***envv)
return;
for (i = 0; i < *argc; i++) {
if (i + moveby < *argc)
g_free ((*argv)[i]);
if (i + moveby < *argc) {
(*argv)[i] = (*argv)[i+moveby];
else
(*argv)[i+moveby] = NULL;
} else {
(*argv)[i] = NULL;
}
}
*argc -= moveby;
......@@ -186,11 +188,10 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
GtkEntry *entry;
GtkWidget *clist;
GtkToggleButton *terminal;
char **argv;
char **argv = NULL;
char **temp_argv = NULL;
int argc, temp_argc;
const char *s;
GSList *tofree = NULL;
char **envv = NULL;
int envc;
gboolean use_advanced;
......@@ -206,8 +207,6 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
} else if (button_num == 1/*cancel*/) {
goto return_and_close;
}
clist = gtk_object_get_data (GTK_OBJECT (run_dialog), "dentry_list");
terminal = GTK_TOGGLE_BUTTON (gtk_object_get_data(GTK_OBJECT(w),
......@@ -229,7 +228,7 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name,
0 /* flags */,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
&error);
if (ditem != NULL) {
/* Honor "run in terminal" button */
......@@ -294,9 +293,7 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
goto return_and_close;
}
/* we use a popt function as it does exactly what we want to do and
gnome already uses popt */
if (poptParseArgvString (s, &temp_argc, (const char ***)&temp_argv) != 0) {
if ( ! g_shell_parse_argv (s, &temp_argc, &temp_argv, NULL)) {
panel_error_dialog (_("Failed to execute command:\n"
"%s"), s);
goto return_and_close;
......@@ -312,37 +309,39 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
if (term_argv) {
int i;
argv = g_new(char *, term_argc + temp_argc + 1);
tofree = g_slist_prepend(tofree, argv);
argc = term_argc + temp_argc;
for(i = 0; i < term_argc; i++) {
argv[i] = term_argv[i];
tofree = g_slist_prepend(tofree, argv[i]);
term_argv[i] = NULL;
}
for(i = term_argc; i < term_argc+temp_argc; i++)
for(i = term_argc; i < term_argc+temp_argc; i++) {
argv[i] = temp_argv[i-term_argc];
temp_argv[i-term_argc] = NULL;
}
argv[i] = NULL;
g_free(argv);
g_free (term_argv);
} else {
char *check;
int i;
check = gnome_is_program_in_path("gnome-terminal");
check = g_find_program_in_path ("gnome-terminal");
argv = g_new(char *, 2 + temp_argc + 1);
tofree = g_slist_prepend(tofree, argv);
argc = 2 + temp_argc;
if(!check) {
argv[0] = "xterm";
argv[1] = "-e";
argv[0] = g_strdup ("xterm");
argv[1] = g_strdup ("-e");
} else {
argv[0] = check;
tofree = g_slist_prepend(tofree, check);
argv[1] = "-x";
argv[1] = g_strdup ("-x");
}
for(i = 2; i < 2+temp_argc; i++)
for(i = 2; i < 2+temp_argc; i++) {
argv[i] = temp_argv[i-2];
temp_argv[i-2] = NULL;
}
argv[i] = NULL;
}
} else {
argv = temp_argv;
temp_argv = NULL;
argc = temp_argc;
}
......@@ -357,12 +356,8 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
}
return_and_close:
g_slist_foreach (tofree, (GFunc)g_free, NULL);
g_slist_free (tofree);
/* this was obtained from the popt function and thus free and not
* g_free */
if (temp_argv)
free (temp_argv);
g_strfreev (argv);
g_strfreev (temp_argv);
g_strfreev (envv);
gnome_dialog_close (GNOME_DIALOG (w));
}
......@@ -502,7 +497,7 @@ sync_list_to_entry (GtkWidget *dialog)
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name,
0 /* flags */,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */);
if (ditem != NULL) {
gboolean terminal;
......@@ -841,23 +836,18 @@ simple_contents_shown (GtkWidget *vbox,
static void
unset_pixmap (GtkWidget *gpixmap)
{
gchar *file;
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
DEFAULT_ICON, TRUE, NULL);
if (!file)
if (file == NULL)
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
FALLBACK_DEFAULT_ICON, TRUE, NULL);
if (file)
gnome_pixmap_load_file (GNOME_PIXMAP (gpixmap),
file);
else
/* Clear the pixmap, yay GnomePixmap rules */
gnome_pixmap_load_file (GNOME_PIXMAP (gpixmap),
"I do not exist anywhere 3413hjrneljghlkjflkjf");
gtk_image_set_from_file (GTK_IMAGE (gpixmap), file);
g_free (file);
}
static void
......@@ -947,31 +937,24 @@ select_row_handler (GtkCList *clist,
row);
if (name) {
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name,
0 /* flags */,
NULL /* error */);
if (ditem != NULL) {
QuickDesktopItem *qitem;
qitem = quick_desktop_item_load_file (name /*file */,
"Application" /* expected type */,
TRUE /* run tryexec */);
if (qitem != NULL) {
GdkPixbuf *pixbuf;
const char *name;
const char *comment;
char *icon;
name = gnome_desktop_item_get_string
(ditem, GNOME_DESKTOP_ITEM_NAME);
comment = gnome_desktop_item_get_string
(ditem, GNOME_DESKTOP_ITEM_COMMENT);
if (label != NULL)
gtk_label_set_text (GTK_LABEL (label),
name);
qitem->name);
if (desc_label != NULL)
gtk_label_set_text (GTK_LABEL (desc_label),
sure_string (comment));
sure_string (qitem->comment));
icon = gnome_desktop_item_get_icon (ditem);
icon = quick_desktop_item_find_icon (qitem);
if (icon != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
} else {
......@@ -979,26 +962,12 @@ select_row_handler (GtkCList *clist,
}
if (pixbuf != NULL) {
#ifdef FIXME
GdkPixmap *pixmap;
GdkBitmap *mask;
gdk_pixbuf_render_pixmap_and_mask (pixbuf,
&pixmap, &mask, 128);
/* GnomePixmap bites me */
gdk_pixmap_unref (GNOME_PIXMAP (gpixmap)->pixmap);
gdk_pixmap_unref (GNOME_PIXMAP (gpixmap)->mask);
GNOME_PIXMAP (gpixmap)->pixmap = pixmap;
GNOME_PIXMAP (gpixmap)->mask = mask;
gtk_widget_queue_resize (gpixmap);
gdk_pixbuf_unref (pixbuf);
#endif
gtk_image_set_from_pixbuf (GTK_IMAGE (gpixmap), pixbuf);
} else {
unset_pixmap (gpixmap);
}
gnome_desktop_item_unref (ditem);
quick_desktop_item_destroy (qitem);
}
}
......@@ -1062,7 +1031,7 @@ create_simple_contents (void)
hbox = gtk_hbox_new (FALSE, 3);
gtk_container_add (GTK_CONTAINER (w), hbox);
pixmap = gtk_type_new (GNOME_TYPE_PIXMAP);
pixmap = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 0);
gtk_object_set_data (GTK_OBJECT (run_dialog), "pixmap", pixmap);
......
......@@ -22,6 +22,7 @@
#include <libgnome/libgnome.h>
#include "menu-fentry.h"
#include "quick-desktop-reader.h"
#include "panel-util.h"
#include "panel_config_global.h"
......@@ -248,7 +249,7 @@ get_mfiles_from_menudir (const char *menudir)
}
static char *
get_applet_goad_id_from_ditem(GnomeDesktopItem *ii)
get_applet_goad_id_from_ditem(QuickDesktopItem *ii)
{
printf ("GET THAT GOAD OUT OF HERE...menu-fentry.c get_applet_gaod_id_from_ditem\n");
return NULL;
......@@ -416,7 +417,7 @@ fr_fill_dir(FileRec *fr, int sublevels)
dr->recs = g_slist_prepend(dr->recs,ffr);
}
} else {
GnomeDesktopItem *ditem;
QuickDesktopItem *qitem;
char *tryexec_path;
char *p = strrchr(name,'.');
if (p == NULL ||
......@@ -428,25 +429,24 @@ fr_fill_dir(FileRec *fr, int sublevels)
tryexec_path = NULL;
ditem = gnome_desktop_item_new_from_file (name, GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS, NULL);
if (ditem != NULL) {
const char *tryexec;
tryexec = gnome_desktop_item_get_string (ditem, "TryExec");
if (tryexec != NULL) {
tryexec_path = gnome_is_program_in_path (tryexec);
qitem = quick_desktop_item_load_file (name /* file */,
NULL /* expected_type */,
FALSE /* run_tryexec */);
if (qitem != NULL) {
if (qitem->tryexec != NULL) {
tryexec_path = g_find_program_in_path (qitem->tryexec);
if (tryexec_path == NULL) {
dr->tryexecs = g_slist_prepend (dr->tryexecs, g_strdup (tryexec));
gnome_desktop_item_unref (ditem);
ditem = NULL;
dr->tryexecs = g_slist_prepend (dr->tryexecs,
g_strdup (qitem->tryexec));
quick_desktop_item_destroy (qitem);
qitem = NULL;
}
}
}
if (ditem != NULL) {
const char *type;
if (qitem != NULL) {
ffr = g_chunk_new0 (FileRec, file_chunk);
type = gnome_desktop_item_get_string (ditem, "Type");
if (type != NULL &&
strcasecmp_no_locale (type, "separator") == 0)
if (qitem->type != NULL &&
g_ascii_strcasecmp (qitem->type, "separator") == 0)
ffr->type = FILE_REC_SEP;
else
ffr->type = FILE_REC_FILE;
......@@ -455,13 +455,13 @@ fr_fill_dir(FileRec *fr, int sublevels)
ffr->mtime = s.st_mtime;
ffr->last_stat = curtime;
ffr->parent = dr;
ffr->icon = gnome_desktop_item_get_icon (ditem);
ffr->fullname = g_strdup (gnome_desktop_item_get_localestring (ditem, "Name"));
ffr->comment = g_strdup (gnome_desktop_item_get_localestring (ditem, "Comment"));
ffr->icon = quick_desktop_item_find_icon (qitem);
ffr->fullname = g_strdup (qitem->name);
ffr->comment = g_strdup (qitem->comment);
ffr->tryexec_path = tryexec_path;
ffr->goad_id =
get_applet_goad_id_from_ditem (ditem);
gnome_desktop_item_unref (ditem);
get_applet_goad_id_from_ditem (qitem);
quick_desktop_item_destroy (qitem);
dr->recs = g_slist_prepend (dr->recs, ffr);
} else {
......@@ -535,18 +535,18 @@ fr_read_dir (DirRec *dr, const char *mdir, struct stat *dstat,
fname = g_build_filename (mdir, ".directory", NULL);
if (dr->ditemlast_stat >= curtime-STAT_EVERY ||
stat (fname, &s) != -1) {
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file(fname,
GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
NULL);
if (ditem != NULL) {
QuickDesktopItem *qitem;
qitem = quick_desktop_item_load_file (fname /* file */,
NULL /* expected_type */,
TRUE /* run_tryexec */);
if (qitem != NULL) {
g_free (fr->icon);
fr->icon = gnome_desktop_item_get_icon (ditem);
fr->icon = quick_desktop_item_find_icon (qitem);
g_free (fr->fullname);
fr->fullname = g_strdup (gnome_desktop_item_get_localestring (ditem, "Name"));
fr->fullname = g_strdup (qitem->name);
g_free (fr->comment);
fr->comment = g_strdup (gnome_desktop_item_get_localestring (ditem, "Comment"));
gnome_desktop_item_unref (ditem);
fr->comment = g_strdup (qitem->comment);
quick_desktop_item_destroy (qitem);
} else {
g_free (fr->icon);
fr->icon = NULL;
......@@ -630,7 +630,7 @@ fr_check_and_reread (FileRec *fr)
/* recheck tryexecs */
for (li = dr->tryexecs; ! reread && li != NULL; li = li->next) {
char *tryexec = li->data;
char *p = gnome_is_program_in_path (tryexec);
char *p = g_find_program_in_path (tryexec);
if (p != NULL) {
reread = TRUE;
......@@ -701,16 +701,18 @@ fr_check_and_reread (FileRec *fr)
break;
}
if(ddr->ditemmtime != s.st_mtime) {
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (p, GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS, NULL);
if(ditem) {
QuickDesktopItem *qitem;
qitem = quick_desktop_item_load_file (p /* file */,
NULL /* expected_type */,
TRUE /* run_tryexec */);
if(qitem) {
g_free(ffr->icon);
ffr->icon = gnome_desktop_item_get_icon (ditem);
ffr->icon = quick_desktop_item_find_icon (qitem);
g_free(ffr->fullname);
ffr->fullname = g_strdup (gnome_desktop_item_get_localestring (ditem, "Name"));
ffr->fullname = g_strdup (qitem->name);
g_free(ffr->comment);
ffr->comment = g_strdup (gnome_desktop_item_get_localestring (ditem, "Comment"));
gnome_desktop_item_unref (ditem);
ffr->comment = g_strdup (qitem->comment);
quick_desktop_item_destroy (qitem);
} else {
g_free(ffr->icon);
ffr->icon = NULL;
......@@ -733,21 +735,21 @@ fr_check_and_reread (FileRec *fr)
}
ffr->last_stat = curtime;
if(ffr->mtime != s.st_mtime) {
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (ffr->name,
GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
NULL);
if (ditem != NULL) {
QuickDesktopItem *qitem;
qitem = quick_desktop_item_load_file (ffr->name /* file */,
NULL /* expected_type */,
TRUE /* run_tryexec */);
if (qitem != NULL) {
g_free (ffr->icon);
ffr->icon = gnome_desktop_item_get_icon (ditem);
ffr->icon = quick_desktop_item_find_icon (qitem);
g_free (ffr->fullname);
ffr->fullname = g_strdup (gnome_desktop_item_get_localestring (ditem, "Name"));
ffr->fullname = g_strdup (qitem->name);
g_free (ffr->comment);
ffr->comment = g_strdup (gnome_desktop_item_get_localestring (ditem, "Comment"));
ffr->comment = g_strdup (qitem->comment);
gnome_desktop_item_unref (ditem);
quick_desktop_item_destroy (qitem);
} else {
reread = TRUE;
break;
......
......@@ -133,7 +133,7 @@ got_gmenu (void)
if (checked)
return got_it;
tmp = gnome_is_program_in_path ("gmenu");
tmp = g_find_program_in_path ("gmenu");
if (tmp != NULL)
got_it = TRUE;
else
......
......@@ -319,7 +319,7 @@ activate_app_def (GtkWidget *widget, const char *item_loc)
{
GnomeDesktopItem *item = gnome_desktop_item_new_from_file
(item_loc,
0 /* flags */,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */);
if (item != NULL) {
char *curdir = g_get_current_dir ();
......@@ -1046,7 +1046,7 @@ add_to_run_dialog (GtkWidget *widget, const char *item_loc)
{
GnomeDesktopItem *item =
gnome_desktop_item_new_from_file (item_loc,
0 /* flags */,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */);
if (item != NULL) {
const char *exec;
......@@ -1075,7 +1075,7 @@ show_help_on (GtkWidget *widget, const char *item_loc)
{
GnomeDesktopItem *item =
gnome_desktop_item_new_from_file (item_loc,
0 /* flags */,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */);
if (item != NULL) {
const char *docpath = gnome_desktop_item_get_string
......@@ -1134,7 +1134,7 @@ add_drawers_from_dir (const char *dirname, const char *name,
g_free (dentry_name);
if(!name)
subdir_name = item_info ? gnome_desktop_item_get_string (item_info, "name") : NULL;
subdir_name = item_info ? gnome_desktop_item_get_localestring (item_info, GNOME_DESKTOP_ITEM_NAME) : NULL;
else
subdir_name = name;
pixmap_name = item_info?gnome_desktop_item_get_icon (item_info):NULL;
......@@ -1707,10 +1707,12 @@ show_item_menu (GtkWidget *item, GdkEventButton *bevent, ShowItemMenu *sim)
GTK_OBJECT(item->parent));
}
if (ii != NULL)
tmp = panel_gnome_kde_help_path (gnome_desktop_item_get_string (ii, "DocPath"));
else
if (ii != NULL) {
const char *doc_path = gnome_desktop_item_get_string (ii, "DocPath");
tmp = panel_gnome_kde_help_path (doc_path);
} else {
tmp = NULL;
}
if (tmp != NULL) {
char *title;
......@@ -1722,7 +1724,7 @@ show_item_menu (GtkWidget *item, GdkEventButton *bevent, ShowItemMenu *sim)
/* FIXME
gtk_widget_lock_accelerators (menuitem);
*/
name = gnome_desktop_item_get_localestring (ii, "Name");
name = gnome_desktop_item_get_localestring (ii, GNOME_DESKTOP_ITEM_NAME);
title = g_strdup_printf (_("Help on %s"),
(name != NULL) ? name : _("Application"));
setup_menuitem (menuitem, 0, title);
......@@ -1756,7 +1758,6 @@ show_item_menu (GtkWidget *item, GdkEventButton *bevent, ShowItemMenu *sim)
setup_menuitem (menuitem, 0, _("Properties..."));
gtk_menu_shell_append (GTK_MENU_SHELL (sim->menu), menuitem);
gnome_desktop_item_unref (ii);
}
......@@ -5407,9 +5408,9 @@ create_panel_submenu(GtkWidget *menu, gboolean fake_submenus, gboolean tearoff,
GTK_SIGNAL_FUNC(about_cb),
NULL);
char_tmp = gnome_is_program_in_path("gnome-about");
char_tmp = g_find_program_in_path ("gnome-about");
if(!char_tmp)
char_tmp = gnome_is_program_in_path ("guname");
char_tmp = g_find_program_in_path ("guname");
if (char_tmp) {
menuitem = gtk_menu_item_new ();
......@@ -5450,7 +5451,7 @@ create_desktop_menu (GtkWidget *menu, gboolean fake_submenus, gboolean tearoff)
GTK_SIGNAL_FUNC (desktop_menu_tearoff_new_menu),
NULL);
char_tmp = gnome_is_program_in_path ("xscreensaver");
char_tmp = g_find_program_in_path ("xscreensaver");
if (char_tmp) {
menuitem = gtk_menu_item_new ();
/* FIXME
......@@ -6075,7 +6076,7 @@ load_menu_applet(const char *params, int main_menu_flags, gboolean global_main,
_("Properties..."));
if(params && strcmp(params, ".")==0 &&
(tmp = gnome_is_program_in_path("gmenu"))) {
(tmp = g_find_program_in_path ("gmenu"))) {
g_free(tmp);
panel_applet_add_callback (info,
"edit_menus",
......
......@@ -889,40 +889,6 @@ is_ext (const char *file, const char *ext)
return FALSE;
}
/* Do strcasecmp but ignore locale */
int
strcasecmp_no_locale (const char *s1, const char *s2)
{
int i;
/* Error, but don't make them equal then */
g_return_val_if_fail (s1 != NULL, G_MAXINT);
g_return_val_if_fail (s2 != NULL, G_MININT);
for (i = 0; s1[i] != '\0' && s2[i] != '\0'; i++) {
char a = s1[i];
char b = s2[i];
if (a >= 'A' && a <= 'Z')
a -= 'A' - 'a';
if (b >= 'A' && b <= 'Z')
b -= 'A' - 'a';
if (a < b)
return -1;
else if (a > b)
return 1;
}
/* find out which string is smaller */
if (s2[i] != '\0')
return -1; /* s1 is smaller */
else if (s1[i] != '\0')
return 1; /* s2 is smaller */
else
return 0; /* equal */
}
int
find_applet (GtkWidget *widget)
{
......
......@@ -84,8 +84,6 @@ GtkWidget * panel_error_dialog (const char *class,
gboolean is_ext (const char *file,
const char *ext);
int strcasecmp_no_locale (const char *s1,
const char *s2);
int find_applet (GtkWidget *widget);
......
......@@ -844,8 +844,8 @@ extract_filename (const gchar* uri)
*p = '\0';
/* if really local */
if (strcasecmp_no_locale (hostname, "localhost") == 0 ||
strcasecmp_no_locale (hostname, "localhost.localdomain") == 0) {
if (g_ascii_strcasecmp (hostname, "localhost") == 0 ||
g_ascii_strcasecmp (hostname, "localhost.localdomain") == 0) {
g_free (hostname);
return path;
}
......@@ -858,7 +858,7 @@ extract_filename (const gchar* uri)
/* if really local */
if (localhostname[0] &&
strcasecmp_no_locale (hostname, localhostname) == 0) {
g_ascii_strcasecmp (hostname, localhostname) == 0) {
g_free (hostname);
return path;
}
......@@ -927,7 +927,7 @@ drop_directory (PanelWidget *panel, int pos, const char *dir)
}
g_free (tmp);
tmp = gnome_is_program_in_path ("nautilus");
tmp = g_find_program_in_path ("nautilus");
if (tmp != NULL) {
/* nautilus */
char *exec = g_strdup_printf ("nautilus %s",
......@@ -947,7 +947,7 @@ drop_directory (PanelWidget *panel, int pos, const char *dir)
g_free (exec);
g_free (base);
} else {
tmp = gnome_is_program_in_path ("gmc-client");
tmp = g_find_program_in_path ("gmc-client");
if (tmp != NULL) {
/* gmc */
char *exec = g_strdup_printf ("gmc-client "
......
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* quick-desktop-reader.c - Quick .desktop file reader
Copyright (C) 1999, 2000 Red Hat Inc.
Copyright (C) 2001 Sid Vicious
All rights reserved.
This file is part of the Gnome Library.
Developed by Elliot Lee <sopwith@redhat.com> and Sid Vicious
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distr