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

add .directory files to the checked file list as well

Tue Jul 28 03:46:58 1998  George Lebl  <jirka@5z.com>

        * menu.c: add .directory files to the checked file list as well

        * menu.c: "add" button added to menuitems, no longer is there
          an "add app to panel" menu since it can all be done from the
          main menu, this makes it much nicer to add launchers to
          the panel

        * panel.c,menu.c: put the panel menu creation routine into menu.c

        * *.c: don't center dialogs, they now act nicely without it

        * launcher.c,menu.c: add a way to create a new launcher

        * orbit-applet-lib.c,applet-lib.cc,main.c: cookies are now
          per display which should allow two panels to run ...

        * panel-widget.c: very unsuccessful attempt at fixing the geometry
          bugs in the widget, I will have to spend more time on this
parent 8c723537
Tue Jul 28 03:46:58 1998 George Lebl <jirka@5z.com>
* menu.c: add .directory files to the checked file list as well
* menu.c: "add" button added to menuitems, no longer is there
an "add app to panel" menu since it can all be done from the
main menu, this makes it much nicer to add launchers to
the panel
* panel.c,menu.c: put the panel menu creation routine into menu.c
* *.c: don't center dialogs, they now act nicely without it
* launcher.c,menu.c: add a way to create a new launcher
* orbit-applet-lib.c,applet-lib.cc,main.c: cookies are now
per display which should allow two panels to run ...
* panel-widget.c: very unsuccessful attempt at fixing the geometry
bugs in the widget, I will have to spend more time on this
Mon Jul 27 03:38:22 1998 George Lebl <jirka@5z.com>
* menu.[ch],panel.c: unified the "Panel" submenu in root
......
Tue Jul 28 03:46:58 1998 George Lebl <jirka@5z.com>
* menu.c: add .directory files to the checked file list as well
* menu.c: "add" button added to menuitems, no longer is there
an "add app to panel" menu since it can all be done from the
main menu, this makes it much nicer to add launchers to
the panel
* panel.c,menu.c: put the panel menu creation routine into menu.c
* *.c: don't center dialogs, they now act nicely without it
* launcher.c,menu.c: add a way to create a new launcher
* orbit-applet-lib.c,applet-lib.cc,main.c: cookies are now
per display which should allow two panels to run ...
* panel-widget.c: very unsuccessful attempt at fixing the geometry
bugs in the widget, I will have to spend more time on this
Mon Jul 27 03:38:22 1998 George Lebl <jirka@5z.com>
* menu.[ch],panel.c: unified the "Panel" submenu in root
......
......@@ -135,6 +135,7 @@ gnome_panel_applet_init_corba (void)
char *name;
char *iior;
char hostname [1024];
char buf[256];
int i;
gethostname (hostname, sizeof (hostname));
......@@ -156,7 +157,10 @@ gnome_panel_applet_init_corba (void)
if(!iior)
return 0;
cookie = gnome_config_private_get_string ("/panel/Secret/cookie=");
g_snprintf(buf,256,"/panel/Secret/cookie-DISPLAY-%s=",
getenv("DISPLAY"));
cookie = gnome_config_private_get_string (buf);
panel_initialize_corba (&orb_ptr, &boa_ptr);
......@@ -175,6 +179,7 @@ gnome_panel_applet_reinit_corba (void)
char *name;
char *iior;
char hostname [1024];
char buf[256];
int i;
gethostname (hostname, sizeof (hostname));
......@@ -196,7 +201,9 @@ gnome_panel_applet_reinit_corba (void)
if(!iior)
return 0;
cookie = gnome_config_private_get_string ("/panel/Secret/cookie=");
g_snprintf(buf,256,"/panel/Secret/cookie-DISPLAY-%s=",
getenv("DISPLAY"));
cookie = gnome_config_private_get_string (buf);
CORBA::Object_var obj = orb_ptr->string_to_object (iior);
......
......@@ -103,7 +103,7 @@ create_properties_dialog(Drawer *drawer)
dialog = gnome_property_box_new();
gtk_window_set_title(GTK_WINDOW(dialog), _("Drawer properties"));
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);
table = gtk_table_new(2, 2, FALSE);
......
......@@ -25,6 +25,7 @@ extern int applet_count;
static char *default_app_pixmap=NULL;
extern PanelWidget *current_panel;
static void
launch (GtkWidget *widget, void *data)
......@@ -35,33 +36,38 @@ launch (GtkWidget *widget, void *data)
}
Launcher *
create_launcher (char *parameters)
create_launcher (char *parameters, GnomeDesktopEntry *dentry)
{
GtkWidget *pixmap;
GnomeDesktopEntry *dentry;
char *icon;
Launcher *launcher;
if (!default_app_pixmap)
default_app_pixmap = gnome_pixmap_file ("gnome-unknown.png");
if (*parameters == '/')
dentry = gnome_desktop_entry_load (parameters);
else {
char *apps_par, *entry, *extension;
if (strstr (parameters, ".desktop"))
extension = NULL;
else
extension = ".desktop";
apps_par = g_copy_strings ("apps/", parameters, extension, NULL);
entry = gnome_datadir_file (apps_par);
g_free (apps_par);
if (!entry)
if(!dentry) {
if (!parameters)
return NULL;
dentry = gnome_desktop_entry_load (entry);
g_free (entry);
else if (*parameters == '/')
dentry = gnome_desktop_entry_load (parameters);
else {
char *apps_par, *entry, *extension;
if (strstr (parameters, ".desktop"))
extension = NULL;
else
extension = ".desktop";
apps_par = g_copy_strings ("apps/", parameters,
extension, NULL);
entry = gnome_datadir_file (apps_par);
g_free (apps_par);
if (!entry)
return NULL;
dentry = gnome_desktop_entry_load (entry);
g_free (entry);
}
}
if (!dentry)
return NULL; /*button is null*/
......@@ -71,10 +77,15 @@ create_launcher (char *parameters)
launcher->button = gtk_button_new ();
launcher->dedit = NULL;
pixmap = NULL;
if(dentry->icon)
icon = dentry->icon;
if (icon && *icon) {
/* Sigh, now we need to make them local to the gnome install */
if (*icon != '/') {
dentry->icon = gnome_pixmap_file (icon);
g_free (icon);
}
pixmap = gnome_pixmap_new_from_file (dentry->icon);
else
pixmap = NULL;
}
if (!pixmap) {
if (default_app_pixmap)
pixmap = gnome_pixmap_new_from_file(default_app_pixmap);
......@@ -91,10 +102,11 @@ create_launcher (char *parameters)
gtk_widget_show (launcher->button);
launcher->signal_click_tag = gtk_signal_connect (GTK_OBJECT(launcher->button),
"clicked",
(GtkSignalFunc) launch,
dentry);
launcher->signal_click_tag =
gtk_signal_connect (GTK_OBJECT(launcher->button),
"clicked",
(GtkSignalFunc) launch,
dentry);
gtk_object_set_user_data(GTK_OBJECT(launcher->button), launcher);
......@@ -187,7 +199,7 @@ create_properties_dialog(GnomeDesktopEntry *dentry, Launcher *launcher)
dialog = gnome_property_box_new();
gtk_window_set_title(GTK_WINDOW(dialog), _("Launcher properties"));
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);
launcher->dedit =
......@@ -232,12 +244,13 @@ launcher_properties(Launcher *launcher)
gtk_widget_show_all (dialog);
}
void
load_launcher_applet(char *params, int pos, PanelWidget *panel)
static void
_load_launcher_applet(char *params, GnomeDesktopEntry *dentry,
int pos, PanelWidget *panel)
{
Launcher *launcher;
launcher = create_launcher(params);
launcher = create_launcher(params,dentry);
if(launcher) {
register_toy(launcher->button,launcher, pos,panel,
......@@ -252,3 +265,48 @@ load_launcher_applet(char *params, int pos, PanelWidget *panel)
_("Properties..."));
}
}
static void
really_add_launcher(GtkWidget *d,int button, gpointer data)
{
GnomeDEntryEdit *dedit = GNOME_DENTRY_EDIT(data);
if(button==0)
_load_launcher_applet(NULL, gnome_dentry_get_dentry(dedit),
0, current_panel);
gtk_widget_destroy(d);
}
void
ask_about_launcher(void)
{
GtkWidget *d;
GtkWidget *notebook;
GtkObject *dedit;
d = gnome_dialog_new(_("Create launcher applet"),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
/*gtk_window_position(GTK_WINDOW(d), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(d), FALSE, FALSE, TRUE);
notebook = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(d)->vbox),notebook,
TRUE,TRUE,5);
dedit = gnome_dentry_edit_new(GTK_NOTEBOOK(notebook));
gtk_signal_connect(GTK_OBJECT(d),"clicked",
GTK_SIGNAL_FUNC(really_add_launcher),
dedit);
gnome_dialog_close_hides(GNOME_DIALOG(d),FALSE);
gnome_dialog_set_default(GNOME_DIALOG(d),0);
gtk_widget_show_all(d);
}
void
load_launcher_applet(char *params, int pos, PanelWidget *panel)
{
_load_launcher_applet(params,NULL,pos,panel);
}
......@@ -26,6 +26,8 @@ typedef struct {
void load_launcher_applet(char *params, int pos, PanelWidget *panel);
void launcher_properties(Launcher *launcher);
void ask_about_launcher(void);
END_GNOME_DECLS
#endif
......@@ -111,31 +111,36 @@ sigchld_handler(int type)
for(list=children;list!=NULL;list=g_list_next(list)) {
AppletChild *child=list->data;
if(child->pid == pid) {
AppletInfo *info = get_applet_info(child->applet_id);
if(info &&
info->widget) {
Extern *ext = info->data;
if(ext && ext->ior) {
int i;
char *s = g_strdup(ext->ior);
for(i=0,info=(AppletInfo *)applets->data;
i<applet_count;
i++,info++) {
Extern *ext = info->data;
if(ext->ior &&
strcmp(ext->ior,s)==0)
panel_clean_applet(info->applet_id);
}
g_free(s);
AppletInfo *info;
if(child->pid != pid)
continue;
info = get_applet_info(child->applet_id);
if(info && !info->widget) {
Extern *ext = info->data;
if(ext && ext->ior) {
int i;
AppletInfo *in;
for(i=0,in=(AppletInfo *)applets->data;
i<applet_count;
i++,in++) {
Extern *e;
if(in->type != APPLET_EXTERN &&
in->type != APPLET_EXTERN_PENDING &&
in->type != APPLET_EXTERN_RESERVED)
continue;
e = in->data;
if(e && e->ior &&
strcmp(ext->ior,e->ior)==0)
panel_clean_applet(in->applet_id);
}
}
exec_queue_done(child->applet_id);
g_free(child);
children=g_list_remove_link(children,list);
return;
}
exec_queue_done(child->applet_id);
g_free(child);
children=g_list_remove_link(children,list);
return;
}
}
......@@ -170,7 +175,8 @@ main(int argc, char **argv)
/* Setup the cookie */
cookie = create_cookie ();
gnome_config_private_set_string ("/panel/Secret/cookie", cookie);
g_snprintf(buf,256,"/panel/Secret/cookie-DISPLAY-%s",getenv("DISPLAY"));
gnome_config_private_set_string (buf, cookie);
gnome_config_sync();
panel_corba_gtk_init();
......
This diff is collapsed.
......@@ -30,6 +30,8 @@ void set_show_small_icons(void);
void setup_menuitem (GtkWidget *menuitem, GtkWidget *pixmap, char *title);
void make_panel_submenu (GtkWidget *menu, int fake_submenus);
GtkWidget * create_panel_root_menu(GtkWidget *panel);
END_GNOME_DECLS
#endif
......@@ -146,6 +146,7 @@ int gnome_panel_applet_reinit_corba(void)
char *name;
char *iior;
char hostname [1024];
char buf[256];
int i;
gethostname (hostname, sizeof (hostname));
......@@ -167,7 +168,8 @@ int gnome_panel_applet_reinit_corba(void)
if(!iior)
return 0;
cookie = gnome_config_private_get_string ("/panel/Secret/cookie=");
g_snprintf(buf,256,"/panel/Secret/cookie-DISPLAY-%s=",getenv("DISPLAY"));
cookie = gnome_config_private_get_string (buf);
if(panel_client)
CORBA_Object_release(panel_client, &ev);
......
......@@ -760,7 +760,7 @@ panel_config(GtkWidget *panel)
/* main window */
ppc->config_window = gnome_property_box_new ();
gtk_window_position(GTK_WINDOW(ppc->config_window), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(ppc->config_window), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(ppc->config_window), FALSE, FALSE, TRUE);
gtk_signal_connect(GTK_OBJECT(ppc->config_window), "destroy",
......
......@@ -251,8 +251,12 @@ panel_widget_applet_put(PanelWidget *panel,AppletData *ad, int force)
g_return_if_fail(ad->applet!=NULL);
gdk_window_get_geometry(ad->applet->window,&oldx,&oldy,
&width,&height,NULL);
oldx = ad->applet->allocation.x;
oldy = ad->applet->allocation.y;
width = ad->applet->allocation.width;
height = ad->applet->allocation.height;
/*gdk_window_get_geometry(ad->applet->window,&oldx,&oldy,
&width,&height,NULL);*/
if(panel->orient==PANEL_HORIZONTAL) {
x = (PANEL_CELL_SIZE*ad->pos) +
......@@ -784,11 +788,13 @@ panel_widget_adjust_applet(PanelWidget *panel, AppletData *ad)
g_return_if_fail(ad!=NULL);
gdk_window_get_size(ad->applet->window,&width,&height);
width = ad->applet->allocation.width;
height = ad->applet->allocation.height;
/*gdk_window_get_size(ad->applet->window,&width,&height);*/
/*don't adjust applets out of range, wait for
then to be pushed into range*/
if(panel->packed && ad->pos>=panel->size)
them to be pushed into range*/
if(!panel->packed && ad->pos>=panel->size)
return;
if(panel->orient==PANEL_HORIZONTAL) {
......@@ -814,20 +820,24 @@ send_applet_move(PanelWidget *panel, AppletData *ad)
if(!ad->applet->window)
return;
gdk_window_get_origin(ad->applet->window,&x,&y);
gdk_window_get_size(ad->applet->window,&w,&h);
w = ad->applet->allocation.width;
h = ad->applet->allocation.height;
/*gdk_window_get_size(ad->applet->window,&w,&h);*/
if(ad->prevwidth!=w ||
ad->prevheight!=h) {
int thick;
printf("w: %d h: %d\n",w,h);
ad->prevwidth = w;
ad->prevheight = h;
thick = panel_widget_get_thick(panel);
if(panel->thick != thick) {
if(panel->thick != thick)
panel->thick = thick;
}
panel_widget_adjust_applet(panel,ad);
/*FIXME:
panel_widget_adjust_applet(panel,ad);*/
}
panel_widget_adjust_applet(panel,ad);
if(ad->prevx!=x ||
ad->prevy!=y) {
ad->prevx = x;
......@@ -849,7 +859,7 @@ panel_widget_applet_size_allocate (GtkWidget *widget,
panel = gtk_object_get_data(GTK_OBJECT(widget),PANEL_APPLET_PARENT_KEY);
ad = gtk_object_get_data(GTK_OBJECT(widget),PANEL_APPLET_DATA);
if(ad->pos == -1)
return FALSE;
......@@ -883,11 +893,17 @@ adjust_applets_idle(gpointer data)
{
PanelWidget *panel = data;
GList *list;
GList *local = NULL;
panel->postpone_adjust = FALSE;
for(list = panel->applet_list;
list != NULL;
list = g_list_next(list))
panel_widget_adjust_applet(panel, list->data);
local = g_list_prepend(local,list->data);
while(local) {
panel_widget_adjust_applet(panel, local->data);
local = g_list_remove_link(local,local);
}
panel->adjust_applet_idle = 0;
return FALSE;
}
......@@ -948,17 +964,22 @@ panel_widget_fixed_size_allocate(GtkWidget *widget,
if(!GTK_WIDGET_REALIZED(widget))
return FALSE;
/*if(allocation->width == widget->allocation.width &&
allocation->height == widget->allocation.height)
return FALSE;*/
if(!panel->packed)
panel_widget_apply_size_limit(panel);
/*adjust all applets make it run at idle time, so that
we know that all events have been processed so this
would be the last fixed size_allocate for a while*/
if(!panel->adjust_applet_idle)
if(panel->postpone_adjust && !panel->adjust_applet_idle) {
panel->adjust_applet_idle =
gtk_idle_add_priority(GTK_PRIORITY_LOW,
adjust_applets_idle, panel);
}
if(panel->fit_pixmap_bg && panel->back_type == PANEL_BACK_PIXMAP)
panel_resize_pixmap(panel);
......@@ -968,6 +989,7 @@ panel_widget_fixed_size_allocate(GtkWidget *widget,
return FALSE;
}
#if 0
/*FIXME: we need to somehow get the size_allocates of the toplevel window*/
static int
panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation,
......@@ -990,6 +1012,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation,
return FALSE;
}
#endif
static void
panel_widget_dnd_dropped_filename (GtkWidget *widget,
......@@ -1278,13 +1301,12 @@ panel_widget_init (PanelWidget *panel)
gtk_signal_connect_after(GTK_OBJECT(panel->fixed),
"size_allocate",
GTK_SIGNAL_FUNC(
panel_widget_fixed_size_allocate),
GTK_SIGNAL_FUNC(panel_widget_fixed_size_allocate),
panel);
gtk_signal_connect_after(GTK_OBJECT(panel),
/*gtk_signal_connect_after(GTK_OBJECT(panel),
"size_allocate",
GTK_SIGNAL_FUNC(panel_widget_size_allocate),
panel);
panel);*/
gtk_signal_connect(GTK_OBJECT(panel),
"destroy",
GTK_SIGNAL_FUNC(panel_widget_destroy),
......@@ -1571,7 +1593,6 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
GtkWidget *applet;
GList *forb;
g_assert(panel->currently_dragged_applet);
applet = panel->currently_dragged_applet->applet;
g_assert(GTK_IS_WIDGET(applet));
forb = gtk_object_get_data(GTK_OBJECT(applet),
......@@ -1807,6 +1828,9 @@ panel_widget_applet_destroy(GtkWidget *applet, gpointer data)
p = gtk_object_get_data(GTK_OBJECT(applet),
PANEL_APPLET_ASSOC_PANEL_KEY);
if(panel->currently_dragged_applet == ad)
panel->currently_dragged_applet = NULL;
/*we already "took care" of this applet*/
if(!ad)
return FALSE;
......@@ -2091,11 +2115,11 @@ panel_widget_reparent (PanelWidget *old_panel,
gtk_widget_hide(applet);
/*this should have worked I guess*/
#if 0
/*this should work right I guess*/
#if 1
/*reparent applet*/
gtk_widget_reparent(applet,new_panel->fixed);
/*it will get moved to the right position on size_allocate*/
if(new_panel->orient == PANEL_HORIZONTAL)
gtk_fixed_move(GTK_FIXED(new_panel->fixed),applet,
......
......@@ -63,41 +63,6 @@ panel_add_main_menu(GtkWidget *w, gpointer data)
load_menu_applet(NULL,0, 0, panel);
}
GtkWidget *
create_panel_root_menu(GtkWidget *panel)
{
GtkWidget *menuitem;
GtkWidget *panel_menu;
panel_menu = gtk_menu_new();
make_panel_submenu(panel_menu,TRUE);
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem, NULL, _("Remove this panel"));
gtk_menu_append (GTK_MENU (panel_menu), menuitem);
gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(panel));
gtk_object_set_data(GTK_OBJECT(panel),"remove_item",menuitem);
menuitem = gtk_menu_item_new();
gtk_menu_append(GTK_MENU(panel_menu), menuitem);
gtk_widget_show(menuitem);
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem,
gnome_stock_pixmap_widget(panel_menu,
GNOME_STOCK_PIXMAP_QUIT),
_("Log out"));
gtk_menu_append (GTK_MENU (panel_menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(panel_quit),
NULL);
return panel_menu;
}
/*get the default panel widget if the panel has more then one or
just get the that one*/
......
......@@ -21,8 +21,6 @@ struct _PanelData {
GtkWidget *panel;
};
GtkWidget * create_panel_root_menu(GtkWidget *panel);
/*get the default panel widget if the panel has more then one or
just get the that one*/
PanelWidget * get_def_panel_widget(GtkWidget *panel);
......
......@@ -760,7 +760,7 @@ panel_config(GtkWidget *panel)
/* main window */
ppc->config_window = gnome_property_box_new ();
gtk_window_position(GTK_WINDOW(ppc->config_window), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(ppc->config_window), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(ppc->config_window), FALSE, FALSE, TRUE);
gtk_signal_connect(GTK_OBJECT(ppc->config_window), "destroy",
......
......@@ -328,7 +328,7 @@ panel_config_global(void)
/* main window */
box = gnome_property_box_new ();
gtk_window_position(GTK_WINDOW(box), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(box), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(box), FALSE, FALSE, TRUE);
gtk_signal_connect(GTK_OBJECT(box), "destroy",
GTK_SIGNAL_FUNC (config_destroy), NULL);
......
......@@ -506,7 +506,7 @@ panel_quit(void)
GNOME_STOCK_BUTTON_YES,
GNOME_STOCK_BUTTON_NO,
NULL);
gtk_window_position(GTK_WINDOW(box), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(box), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(box), FALSE, FALSE, TRUE);
gtk_signal_connect (GTK_OBJECT (box), "clicked",
......
......@@ -159,7 +159,7 @@ ask_about_swallowing(void)
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gtk_window_position(GTK_WINDOW(d), GTK_WIN_POS_CENTER);
/*gtk_window_position(GTK_WINDOW(d), GTK_WIN_POS_CENTER);*/
gtk_window_set_policy(GTK_WINDOW(d), FALSE, FALSE, TRUE);
box = gtk_hbox_new(FALSE,5);
......
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