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

use KDEDIR to try to find kde, only then use what was passed on the

Sun Jan 23 15:37:01 2000  George Lebl <jirka@5z.com>

	* main.c,menu.c,menu-util.c,session.c,panel.c: use KDEDIR to try
	  to find kde, only then use what was passed on the configure command
	  line and try several other standard prefixes to try to find it,
	  if not always just fallback to the configure option.
parent ceec1f97
Sun Jan 23 15:37:01 2000 George Lebl <jirka@5z.com>
* main.c,menu.c,menu-util.c,session.c,panel.c: use KDEDIR to try
to find kde, only then use what was passed on the configure command
line and try several other standard prefixes to try to find it,
if not always just fallback to the configure option.
Fri Jan 21 22:38:07 2000 George Lebl <jirka@5z.com>
* panel-widget.c: always look for an empty spot first unless
......
Sun Jan 23 15:37:01 2000 George Lebl <jirka@5z.com>
* main.c,menu.c,menu-util.c,session.c,panel.c: use KDEDIR to try
to find kde, only then use what was passed on the configure command
line and try several other standard prefixes to try to find it,
if not always just fallback to the configure option.
Fri Jan 21 22:38:07 2000 George Lebl <jirka@5z.com>
* panel-widget.c: always look for an empty spot first unless
......
......@@ -42,6 +42,10 @@ GnomeClient *client = NULL;
/*a list of started extern applet child processes*/
extern GList * children;
char *kde_menudir = NULL;
char *kde_icondir = NULL;
char *kde_mini_icondir = NULL;
static int
menu_age_timeout(gpointer data)
{
......@@ -91,7 +95,51 @@ try_config_sync(gpointer data)
return TRUE;
}
static void
find_kde_directory(void)
{
int i;
char *kdedir = getenv("KDEDIR");
char *try_prefixes[] = {
"/usr",
"/opt/kde",
"/usr/local",
"/kde",
NULL
};
if(kdedir) {
kde_menudir = g_concat_dir_and_file(kdedir,"share/applnk");
kde_icondir = g_concat_dir_and_file(kdedir,"share/icons");
kde_mini_icondir = g_concat_dir_and_file(kdedir,"share/icons/mini");
return;
}
/* if what configure gave us works use that */
if(g_file_test(KDE_MENUDIR,G_FILE_TEST_ISDIR)) {
kde_menudir = g_strdup(KDE_MENUDIR);
kde_icondir = g_strdup(KDE_ICONDIR);
kde_mini_icondir = g_strdup(KDE_MINI_ICONDIR);
return;
}
for(i=0;try_prefixes[i];i++) {
char *try;
try = g_concat_dir_and_file(try_prefixes[i],"share/applnk");
if(g_file_test(try,G_FILE_TEST_ISDIR)) {
kde_menudir = try;
kde_icondir = g_concat_dir_and_file(try_prefixes[i],"share/icons");
kde_mini_icondir = g_concat_dir_and_file(try_prefixes[i],"share/icons/mini");
return;
}
g_free(try);
}
/* absolute fallback, these don't exist, but we're out of options
here */
kde_menudir = g_strdup(KDE_MENUDIR);
kde_icondir = g_strdup(KDE_ICONDIR);
kde_mini_icondir = g_strdup(KDE_MINI_ICONDIR);
}
int
main(int argc, char **argv)
......@@ -135,6 +183,8 @@ main(int argc, char **argv)
}
}
find_kde_directory();
client = gnome_master_client ();
gnome_client_set_restart_style (client, duplicate
......
......@@ -13,6 +13,10 @@
/*#define PANEL_DEBUG 1*/
extern char *kde_menudir;
extern char *kde_icondir;
extern char *kde_mini_icondir;
void
add_menu_separator (GtkWidget *menu)
{
......@@ -85,7 +89,7 @@ get_default_menu_flags ()
flags |= MAIN_MENU_REDHAT_SUB;
/*guess KDE menus*/
if(g_file_exists(KDE_MENUDIR))
if(g_file_exists(kde_menudir))
flags |= MAIN_MENU_KDE_SUB;
/*guess debian menus*/
......
......@@ -48,6 +48,10 @@ extern int panels_to_sync;
extern int applets_to_sync;
extern int need_complete_save;
extern char *kde_menudir;
extern char *kde_icondir;
extern char *kde_mini_icondir;
/*???? this might be ugly, but I guess we can safely assume that we can only
have one menu open and that nothing weird will happen to the panel that
opened that menu whilethe user is looking over the choices*/
......@@ -456,7 +460,7 @@ add_menu_to_panel (GtkWidget *widget, gpointer data)
flags |= MAIN_MENU_REDHAT_SUB;
/*guess KDE menus*/
if(g_file_exists(KDE_MENUDIR))
if(g_file_exists(kde_menudir))
flags |= MAIN_MENU_KDE_SUB;
/*guess debian menus*/
......@@ -2262,16 +2266,18 @@ static GtkWidget *
create_kde_menu(GtkWidget *menu, int fake_submenus,
int force, int fake)
{
char *pixmap_name = g_concat_dir_and_file (KDE_MINI_ICONDIR, "exec.xpm");
char *pixmap_name;
pixmap_name = g_concat_dir_and_file (kde_mini_icondir, "exec.xpm");
if(!fake || menu) {
menu = create_menu_at (menu,
KDE_MENUDIR, FALSE,
kde_menudir, FALSE,
_("KDE menus"),
pixmap_name,
fake_submenus,
force);
} else {
menu = create_fake_menu_at (KDE_MENUDIR, FALSE,
menu = create_fake_menu_at (kde_menudir, FALSE,
_("KDE menus"),
pixmap_name);
}
......@@ -3481,7 +3487,8 @@ create_root_menu(int fake_submenus, int flags, int tearoff)
GtkWidget *pixmap = NULL;
char *pixmap_path;
menu = create_kde_menu(NULL, fake_submenus, TRUE, TRUE);
pixmap_path = g_concat_dir_and_file (KDE_MINI_ICONDIR, "exec.xpm");
pixmap_path = g_concat_dir_and_file (kde_mini_icondir,
"exec.xpm");
if (g_file_exists(pixmap_path)) {
pixmap = gnome_stock_pixmap_widget_at_size (
NULL, pixmap_path, SMALL_ICON_SIZE,
......
......@@ -48,6 +48,11 @@ extern GtkTooltips *panel_tooltips;
opened that menu whilethe user is looking over the choices*/
extern PanelWidget *current_panel;
extern char *kde_menudir;
extern char *kde_icondir;
extern char *kde_mini_icondir;
/*the types of stuff we accept*/
enum {
......@@ -843,7 +848,7 @@ drop_menu(PanelWidget *panel, int pos, char *dir)
if(g_file_exists("/etc/X11/wmconfig"))
flags |= MAIN_MENU_REDHAT_SUB;
/* Guess KDE menus */
if(g_file_exists(KDE_MENUDIR))
if(g_file_exists(kde_menudir))
flags |= MAIN_MENU_KDE_SUB;
load_menu_applet(dir, flags, panel, pos, TRUE);
}
......
......@@ -41,6 +41,10 @@ char *old_panel_cfg_path=NULL;
/*list of all panel widgets created*/
extern GSList *panel_list;
extern char *kde_menudir;
extern char *kde_icondir;
extern char *kde_mini_icondir;
int ss_cur_applet = 0;
int ss_done_save = FALSE;
gushort ss_cookie = 0;
......@@ -897,7 +901,7 @@ init_user_applets(void)
if(g_file_exists("/etc/X11/wmconfig"))
flags |= MAIN_MENU_REDHAT_SUB;
/*guess KDE menus */
if(g_file_exists(KDE_MENUDIR))
if(g_file_exists(kde_menudir))
flags |= MAIN_MENU_KDE_SUB;
/*guess debian menus*/
if (g_file_exists(DEBIAN_MENUDIR))
......
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