Commit 8fd26e3f authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

ported gnome_.*_file -> gnome_program_locate_file

2001-10-18  Mark McLoughlin  <mark@skynet.ie>

        * applet.c, basep-widget.c, button-widget.c,
          conditional.c, drawer.c, extern.c, foobar-widget.c
          gnome-panel-properties.c, gnome-panel-screenshot.c
          gnome-run.c, launcher.c, logout.c, main.c
          menu-properties.c, menu-rh.c, menu.c:
        ported gnome_.*_file -> gnome_program_locate_file
               gnome_unconditional_.*_file ->
gnome_program_locate_file
               g_file_exists -> g_file_test
               g_unix_error_string -> g_strerror
parent 050614cc
2001-10-18 Mark McLoughlin <mark@skynet.ie>
* applet.c, basep-widget.c, button-widget.c,
conditional.c, drawer.c, extern.c, foobar-widget.c
gnome-panel-properties.c, gnome-panel-screenshot.c
gnome-run.c, launcher.c, logout.c, main.c
menu-properties.c, menu-rh.c, menu.c:
ported gnome_.*_file -> gnome_program_locate_file
gnome_unconditional_.*_file -> gnome_program_locate_file
g_file_exists -> g_file_test
g_unix_error_string -> g_strerror
2001-10-18 jacob berkman <jacob@ximian.com>
* session.h (PANEL_CONFIG_PATH): set to panel2.d so you don't
......
......@@ -495,7 +495,8 @@ create_applet_menu (AppletInfo *info, gboolean is_basep)
make_panel_submenu (panel_menu, TRUE, is_basep);
menuitem = gtk_menu_item_new ();
pixmap = gnome_pixmap_file ("gnome-panel.png");
pixmap = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-panel.png", TRUE, NULL);
if (pixmap == NULL) {
g_message (_("Cannot find pixmap file %s"), "gnome-panel.png");
setup_menuitem (menuitem, NULL, _("Panel"));
......
......@@ -861,7 +861,9 @@ make_hidebutton(BasePWidget *basep,
else
gtk_widget_set_usize(w, PANEL_MINIMUM_WIDTH, 0);
pixmap_name=gnome_pixmap_file(pixmaparrow);
pixmap_name = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
pixmaparrow, TRUE, NULL);
if(pixmap_name) {
pixmap = gtk_image_new_from_file(pixmap_name);
g_free(pixmap_name);
......
......@@ -398,10 +398,12 @@ loadup_file(const char *file)
if (string_empty (file))
return NULL;
if ( ! g_path_is_absolute(file)) {
if (!g_path_is_absolute (file)) {
char *f;
f = gnome_pixmap_file (file);
if (f != NULL) {
f = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
file, TRUE, NULL);
if (f) {
pb = gdk_pixbuf_new_from_file (f, NULL);
g_free (f);
}
......
......@@ -359,7 +359,11 @@ conditional_parse (const char *conditional, int len)
if (g_file_test (file, G_FILE_TEST_EXISTS)) {
cond = TRUE;
} else {
char *full = gnome_datadir_file (file);
char *full = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_DATADIR,
file,
TRUE,
NULL);
if (full != NULL)
cond = TRUE;
g_free (full);
......
......@@ -54,14 +54,18 @@ properties_apply_callback(gpointer data)
drawer->tooltip = NULL;
s = hack_icon_entry_get_icon (GNOME_ICON_ENTRY (pixentry));
if (string_empty (s)) {
drawer->pixmap = gnome_pixmap_file ("panel-drawer.png");
drawer->pixmap = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"panel-drawer.png", TRUE, NULL);
button_widget_set_pixmap (BUTTON_WIDGET(drawer->button),
drawer->pixmap,-1);
} else {
if(button_widget_set_pixmap(BUTTON_WIDGET(drawer->button), s, -1))
drawer->pixmap = g_strdup(s);
else {
drawer->pixmap = gnome_pixmap_file ("panel-drawer.png");
drawer->pixmap = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
"panel-drawer.png",
TRUE, NULL);
button_widget_set_pixmap(BUTTON_WIDGET(drawer->button),
drawer->pixmap, -1);
}
......@@ -312,7 +316,8 @@ create_drawer_applet(GtkWidget * drawer_panel,
drawer->tooltip = g_strdup (tooltip);
if (string_empty (pixmap)) {
drawer->pixmap = gnome_pixmap_file ("panel-drawer.png");
drawer->pixmap = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"panel-drawer.png", TRUE, NULL);
} else {
drawer->pixmap = g_strdup (pixmap);
}
......
......@@ -945,11 +945,13 @@ socket_set_loading (GtkWidget *socket, PanelWidget *panel)
size = panel->sz < 14 ? panel->sz : 14;
if ( ! tried_loading) {
if (!tried_loading) {
char *file;
file = gnome_pixmap_file ("gnome-unknown.png");
if (file != NULL) {
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-unknown.png", TRUE, NULL);
if (file) {
pb = gdk_pixbuf_new_from_file (file, NULL);
g_free (file);
......
......@@ -423,11 +423,14 @@ append_folder_menu (GtkWidget *menu_bar, const char *label,
GtkWidget *item, *menu;
char *real_path;
real_path = system
? gnome_unconditional_datadir_file (path)
: gnome_util_home_file (path);
if (system)
real_path = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_DATADIR,
path, FALSE, NULL);
else
real_path = gnome_util_home_file (path);
if (real_path == NULL) {
if (!real_path) {
g_warning (_("can't fine real path"));
return NULL;
}
......@@ -1073,7 +1076,8 @@ foobar_widget_init (FoobarWidget *foo)
gtk_container_add(GTK_CONTAINER(foo->ebox), foo->hbox);
#if 0
path = gnome_pixmap_file ("panel/corner1.png");
path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"panel/corner1.png", TRUE, NULL);
bufmap = gnome_pixmap_new_from_file (path);
g_free (path);
align = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
......@@ -1123,7 +1127,8 @@ foobar_widget_init (FoobarWidget *foo)
gtk_object_set_data (GTK_OBJECT (menu_bar), "menu_panel", foo->panel);
#if 0
path = gnome_pixmap_file ("panel/corner2.png");
path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"panel/corner2.png", TRUE, NULL);
bufmap = gnome_pixmap_new_from_file (path);
g_free (path);
align = gtk_alignment_new (1.0, 0.0, 1.0, 0.0);
......
......@@ -353,7 +353,9 @@ get_full_tile(const char *file)
else if (g_path_is_absolute(file))
return g_strdup(file);
else
return gnome_unconditional_pixmap_file(file);
return gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
file, FALSE, NULL);
}
static void
......
......@@ -353,7 +353,9 @@ get_full_tile(const char *file)
else if (g_path_is_absolute(file))
return g_strdup(file);
else
return gnome_unconditional_pixmap_file(file);
return gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
file, FALSE, NULL);
}
static void
......
......@@ -1028,7 +1028,7 @@ main (int argc, char *argv[])
else
take_screen_shot ();
if (g_file_exists ("gnome-panel-screenshot.glade")) {
if (g_file_test ("gnome-panel-screenshot.glade", G_FILE_TEST_EXISTS)) {
xml = glade_xml_new ("gnome-panel-screenshot.glade", NULL, NULL);
}
if (xml == NULL) {
......
......@@ -353,7 +353,7 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
panel_error_dialog(_("Failed to execute command:\n"
"%s\n"
"%s"),
s, g_unix_error_string(errno));
s, g_strerror (errno));
}
}
......@@ -845,10 +845,12 @@ unset_pixmap (GtkWidget *gpixmap)
gchar *file;
file = gnome_pixmap_file (DEFAULT_ICON);
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
DEFAULT_ICON, TRUE, NULL);
if (file == NULL)
file = gnome_pixmap_file (FALLBACK_DEFAULT_ICON);
if (!file)
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
FALLBACK_DEFAULT_ICON, TRUE, NULL);
if (file)
gnome_pixmap_load_file (GNOME_PIXMAP (gpixmap),
......@@ -1262,7 +1264,8 @@ create_run_widget(void)
GtkWidget *button;
char *pixmap_name;
pixmap_name = gnome_pixmap_file("gnome-run.png");
pixmap_name = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-run.png", TRUE, NULL);
button = button_widget_new(pixmap_name,-1,
MISC_TILE,
......
......@@ -315,8 +315,11 @@ create_launcher (const char *parameters, GnomeDesktopItem *ditem)
{ "text/uri-list", 0, TARGET_URI_LIST }
};
if (default_app_pixmap == NULL)
default_app_pixmap = gnome_pixmap_file ("gnome-unknown.png");
if (!default_app_pixmap)
default_app_pixmap = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
"gnome-unknown.png", TRUE,
NULL);
if (ditem == NULL) {
if (parameters == NULL) {
......@@ -335,12 +338,16 @@ create_launcher (const char *parameters, GnomeDesktopItem *ditem)
apps_par = g_strconcat ("gnome/apps/", parameters,
extension, NULL);
entry = gnome_datadir_file (apps_par);
entry = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
apps_par, TRUE, NULL);
g_free (apps_par);
if (entry == NULL) {
/* perhaps just datadir? */
entry = gnome_datadir_file (parameters);
entry = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
parameters, TRUE, NULL);
}
if (entry == NULL && merge_merge_dir != NULL) {
......
......@@ -72,7 +72,8 @@ create_logout_widget (void)
GtkWidget *button;
char *pixmap_name;
pixmap_name = gnome_pixmap_file ("gnome-term-night.png");
pixmap_name = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-term-night.png", TRUE, NULL);
button = button_widget_new (pixmap_name, -1,
MISC_TILE,
......@@ -132,7 +133,9 @@ create_lock_widget(void)
GtkWidget *button;
char *pixmap_name;
pixmap_name = gnome_pixmap_file("gnome-lockscreen.png");
pixmap_name = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-lockscreen.png",
TRUE, NULL);
button = button_widget_new (pixmap_name, -1,
MISC_TILE,
......
......@@ -234,9 +234,13 @@ check_screen (void)
name = g_strdup_printf ("%cish/%cishanim.png",
'f', 'f');
phsh_file = gnome_pixmap_file (name);
phsh_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
name, TRUE, NULL);
g_free (name);
if (phsh_file == NULL)
if (!phsh_file)
return;
tmp = gdk_pixbuf_new_from_file (phsh_file, NULL);
......
......@@ -63,15 +63,17 @@ get_real_menu_path(const char *arguments)
if (string_empty (arguments))
arguments = ".";
if(strcmp(arguments, ".") == 0)
this_menu = gnome_unconditional_datadir_file ("gnome/apps");
if(!strcmp (arguments, "."))
this_menu = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"gnome/apps", FALSE, NULL);
else if (*arguments == '/')
this_menu = g_strdup (arguments);
else if (*arguments == '~')
this_menu = g_build_filename (g_get_home_dir(),
&arguments[1], NULL);
else
this_menu = gnome_unconditional_datadir_file (arguments);
this_menu = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
arguments, FALSE, NULL);
if ( ! g_file_test (this_menu, G_FILE_TEST_EXISTS)) {
g_warning("menu %s does not exist "
......@@ -87,8 +89,11 @@ char *
get_pixmap(const char *menudir, gboolean main_menu)
{
char *pixmap_name = NULL;
if (main_menu) {
pixmap_name = gnome_unconditional_pixmap_file("gnome-logo-icon-transparent.png");
pixmap_name = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-logo-icon-transparent.png",
FALSE, NULL);
} else {
char *dentry_name;
GnomeDesktopItem *item_info;
......@@ -104,9 +109,11 @@ get_pixmap(const char *menudir, gboolean main_menu)
if (item_info != NULL)
pixmap_name = gnome_desktop_item_get_icon (item_info);
if (pixmap_name == NULL)
pixmap_name =
gnome_unconditional_pixmap_file ("gnome-folder.png");
if (!pixmap_name)
pixmap_name = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
"gnome-folder.png",
FALSE, NULL);
if (item_info != NULL)
gnome_desktop_item_unref (item_info);
......
......@@ -218,7 +218,9 @@ add_redhat_entry(GSList *list, char *file)
if ( ! g_file_test (rh->u.item.icon,
G_FILE_TEST_EXISTS)) {
g_free(rh->u.item.icon);
rh->u.item.icon = gnome_pixmap_file(s);
rh->u.item.icon = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
s, TRUE, NULL);
}
g_free(s);
}
......@@ -237,7 +239,9 @@ add_redhat_entry(GSList *list, char *file)
if ( ! g_file_test (rh->u.item.mini_icon,
G_FILE_TEST_EXISTS)) {
g_free(rh->u.item.mini_icon);
rh->u.item.mini_icon = gnome_pixmap_file(s);
rh->u.item.mini_icon = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
s, TRUE, NULL);
}
g_free(s);
}
......
......@@ -185,12 +185,14 @@ init_menus (void)
/*just load the menus from disk, don't make the widgets
this just reads the .desktops of the top most directory
and a level down*/
menu = gnome_datadir_file ("gnome/apps");
menu = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"gnome/apps", TRUE, NULL);
if (menu != NULL)
fr_read_dir (NULL, menu, NULL, NULL, 2);
g_free (menu);
menu = gnome_datadir_file ("applets");
menu = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"applets", TRUE, NULL);
if (menu != NULL)
fr_read_dir (NULL, menu, NULL, NULL, 2);
g_free (menu);
......@@ -959,7 +961,7 @@ remove_menuitem (GtkWidget *widget, ShowItemMenu *sim)
if (unlink (sim->item_loc) < 0) {
panel_error_dialog("cant_remove_menu_item",
_("Could not remove the menu item %s: %s\n"),
sim->item_loc, g_strerror(errno));
sim->item_loc, g_strerror (errno));
return;
}
......@@ -998,7 +1000,7 @@ remove_menuitem (GtkWidget *widget, ShowItemMenu *sim)
panel_error_dialog("cannot_open_order_file",
_("Could not open .order file: %s\n%s"),
order_out_name,
g_unix_error_string(errno));
g_strerror (errno));
g_free (order_in_name);
g_free (order_out_name);
......@@ -1030,7 +1032,7 @@ remove_menuitem (GtkWidget *widget, ShowItemMenu *sim)
panel_error_dialog("cannot_rename_tmp_file",
_("Could not rename tmp file: %s to %s\n%s"),
order_out_name, order_in_name,
g_unix_error_string(errno));
g_strerror (errno));
}
g_free (order_out_name);
......@@ -3336,7 +3338,10 @@ static GtkWidget *
create_applets_menu (GtkWidget *menu, gboolean fake_submenus, gboolean title)
{
GtkWidget *applet_menu;
char *menudir = gnome_datadir_file ("applets");
char *menudir;
menudir = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"applets", TRUE, NULL);
if (menudir == NULL ||
! g_file_test (menudir, G_FILE_TEST_IS_DIR)) {
......@@ -3683,7 +3688,8 @@ setup_menuitem_try_pixmap (GtkWidget *menuitem, const char *try_file,
}
if (try_file) {
file = gnome_pixmap_file (try_file);
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
try_file, TRUE, NULL);
if (!file)
g_warning (_("Cannot find pixmap file %s"), try_file);
}
......@@ -3708,7 +3714,10 @@ create_system_menu (GtkWidget *menu, gboolean fake_submenus,
gboolean launcher_add,
gboolean favourites_add)
{
char *menudir = gnome_datadir_file ("gnome/apps");
char *menudir;
menudir = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"gnome/apps", TRUE, NULL);
if (menudir &&
g_file_test (menudir, G_FILE_TEST_IS_DIR)) {
......@@ -3794,7 +3803,8 @@ create_distribution_menu (GtkWidget *menu,
return NULL;
if (info->menu_icon != NULL)
pixmap_file = gnome_pixmap_file (info->menu_icon);
pixmap_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
info->menu_icon, TRUE, NULL);
else
pixmap_file = NULL;
......@@ -5879,7 +5889,10 @@ create_menu_applet(PanelWidget *panel, const char *arguments,
return NULL;
if(gnome_folder == NULL)
gnome_folder = gnome_pixmap_file("gnome-folder.png");
gnome_folder = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_PIXMAP,
"gnome-folder.png",
TRUE, NULL);
main_menu = (string_empty (arguments) ||
(strcmp (arguments, ".") == 0));
......
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