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

fixed a crash on closing properties, took out the functions to create

Wed Jun 17 02:20:43 1998  George Lebl  <jirka@5z.com>

        * launcher.c,panel-util.[ch]: fixed a crash on closing properties,
          took out the functions to create label/entry property entries,
          and put those into panel-util.c

        * drawer.[ch],main.[ch],panel.c,menu.c: added drawer name/icon
          configuration
parent 6b3ce989
Wed Jun 17 02:20:43 1998 George Lebl <jirka@5z.com>
* launcher.c,panel-util.[ch]: fixed a crash on closing properties,
took out the functions to create label/entry property entries,
and put those into panel-util.c
* drawer.[ch],main.[ch],panel.c,menu.c: added drawer name/icon
configuration
Sat Jun 13 16:47:08 1998 Tom Tromey <tromey@cygnus.com>
* main.c (parse_an_arg): Disable master connection if --discard
......
Wed Jun 17 02:20:43 1998 George Lebl <jirka@5z.com>
* launcher.c,panel-util.[ch]: fixed a crash on closing properties,
took out the functions to create label/entry property entries,
and put those into panel-util.c
* drawer.[ch],main.[ch],panel.c,menu.c: added drawer name/icon
configuration
Sat Jun 13 16:47:08 1998 Tom Tromey <tromey@cygnus.com>
* main.c (parse_an_arg): Disable master connection if --discard
......
......@@ -19,12 +19,138 @@
#include "panel.h"
#include "panel_config_global.h"
#include "drawer.h"
#include "panel-util.h"
#define DRAWER_PROPERTIES "drawer_properties"
extern GArray *applets;
extern gint applet_count;
extern GlobalConfig global_config;
extern GtkTooltips *panel_tooltips;
static char *default_drawer_pixmap=NULL;
static void
properties_apply_callback(GtkWidget *widget, int page, gpointer data)
{
Drawer *drawer = data;
GtkWidget *pixmap;
GtkWidget *pixentry = gtk_object_get_data(GTK_OBJECT(widget),"pixmap");
GtkWidget *tipentry = gtk_object_get_data(GTK_OBJECT(widget),"tooltip");
gchar *s;
if (page != -1)
return;
if(drawer->pixmap)
g_free(drawer->pixmap);
if(drawer->tooltip)
g_free(drawer->tooltip);
s = gtk_entry_get_text(GTK_ENTRY(pixentry));
if(!s || !*s)
drawer->pixmap = gnome_unconditional_pixmap_file ("gnome-default.png");
else
drawer->pixmap = g_strdup(s);
s = gtk_entry_get_text(GTK_ENTRY(tipentry));
if(!s || !*s)
drawer->tooltip = NULL;
else
drawer->tooltip = g_strdup(s);
gtk_tooltips_set_tip (panel_tooltips,drawer->button->parent,
drawer->tooltip,NULL);
pixmap=GTK_BUTTON(drawer->button)->child;
gtk_container_remove(GTK_CONTAINER(drawer->button),pixmap);
pixmap = gnome_pixmap_new_from_file (drawer->pixmap);
if (!pixmap) {
if (default_drawer_pixmap)
pixmap = gnome_pixmap_new_from_file (default_drawer_pixmap);
else
pixmap = gtk_label_new (_("Drawer"));
}
gtk_container_add (GTK_CONTAINER(drawer->button), pixmap);
gtk_widget_show(pixmap);
/*FIXME: a bad hack to keep it all 48x48*/
gtk_widget_set_usize (drawer->button, 48, 48);
/*gtk_widget_set_usize (prop->launcher->button, pixmap->requisition.width,
pixmap->requisition.height);*/
}
static gint
properties_close_callback(GtkWidget *widget, gpointer data)
{
Drawer *drawer = data;
GtkWidget *pixentry = gtk_object_get_data(GTK_OBJECT(widget),"pixmap");
GtkWidget *tipentry = gtk_object_get_data(GTK_OBJECT(widget),"tooltip");
gtk_object_set_data(GTK_OBJECT(drawer->button),
DRAWER_PROPERTIES,NULL);
gtk_signal_disconnect_by_data(GTK_OBJECT(pixentry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(tipentry),widget);
return FALSE;
}
static GtkWidget *
create_properties_dialog(Drawer *drawer)
{
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *w;
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_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);
table = gtk_table_new(2, 2, FALSE);
gtk_container_border_width(GTK_CONTAINER(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 6);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
w = create_text_entry(table, "drawer_name", 0, _("Tooltip/Name"),
drawer->tooltip, dialog);
gtk_object_set_data(GTK_OBJECT(dialog),"tooltip",w);
w = create_file_entry(table, "icon", 1, _("Icon"), drawer->pixmap,
dialog);
gtk_object_set_data(GTK_OBJECT(dialog),"pixmap",w);
gnome_property_box_append_page (GNOME_PROPERTY_BOX (dialog),
table, gtk_label_new (_("Drawer")));
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
(GtkSignalFunc) properties_close_callback,
drawer);
gtk_signal_connect(GTK_OBJECT(dialog), "apply",
GTK_SIGNAL_FUNC(properties_apply_callback),
drawer);
return dialog;
}
void
drawer_properties(Drawer *drawer)
{
GtkWidget *dialog;
dialog = gtk_object_get_data(GTK_OBJECT(drawer->button),
DRAWER_PROPERTIES);
if(dialog) {
gdk_window_raise(dialog->window);
return;
}
dialog = create_properties_dialog(drawer);
gtk_object_set_data(GTK_OBJECT(drawer->button),
DRAWER_PROPERTIES,dialog);
gtk_widget_show_all (dialog);
}
void
reposition_drawer(Drawer *drawer)
{
......@@ -99,17 +225,31 @@ enter_notify_drawer(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
}
Drawer *
create_drawer_applet(GtkWidget * drawer_panel, PanelOrientType orient)
create_drawer_applet(GtkWidget * drawer_panel, char *tooltip, char *pixmap,
PanelOrientType orient)
{
GtkWidget *pixmap;
GtkWidget *pix;
Drawer *drawer;
char *pixmap_name=NULL;
drawer = g_new(Drawer,1);
/*FIXME: drawers should have their own pixmaps I guess*/
switch(orient) {
if (!default_drawer_pixmap)
default_drawer_pixmap = gnome_pixmap_file ("gnome-unknown.png");
if(!tooltip ||
!*tooltip)
drawer->tooltip = NULL;
else
drawer->tooltip = g_strdup(tooltip);
if(!pixmap ||
!*pixmap)
drawer->pixmap =
gnome_unconditional_pixmap_file ("gnome-default.png");
else
drawer->pixmap = g_strdup(pixmap);
/*well ... I think we should just drop this*/
/*switch(orient) {
case ORIENT_DOWN:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-down.png");
break;
......@@ -122,7 +262,7 @@ create_drawer_applet(GtkWidget * drawer_panel, PanelOrientType orient)
case ORIENT_LEFT:
pixmap_name = gnome_unconditional_pixmap_file ("gnome-menu-left.png");
break;
}
}*/
drawer->orient = orient;
......@@ -130,8 +270,14 @@ create_drawer_applet(GtkWidget * drawer_panel, PanelOrientType orient)
drawer->button = gtk_button_new ();
/*make the pixmap*/
pixmap = gnome_pixmap_new_from_file (pixmap_name);
gtk_widget_show(pixmap);
pix = gnome_pixmap_new_from_file (drawer->pixmap);
if (!pix) {
if (default_drawer_pixmap)
pix = gnome_pixmap_new_from_file (default_drawer_pixmap);
else
pix = gtk_label_new (_("Drawer"));
}
gtk_widget_show(pix);
/*FIXME:this is not right, but it's how we can get the buttons to
be 48x48 (given the icons are 48x48)*/
gtk_widget_set_usize (drawer->button,48,48);
......@@ -139,7 +285,7 @@ create_drawer_applet(GtkWidget * drawer_panel, PanelOrientType orient)
pixmap->requisition.height);*/
/* put pixmap in button */
gtk_container_add (GTK_CONTAINER(drawer->button), pixmap);
gtk_container_add (GTK_CONTAINER(drawer->button), pix);
gtk_widget_show (drawer->button);
drawer->drawer = drawer_panel;
......@@ -159,13 +305,12 @@ create_drawer_applet(GtkWidget * drawer_panel, PanelOrientType orient)
gtk_widget_hide(drawer_panel);
gtk_object_set_data(GTK_OBJECT(drawer_panel),DRAWER_PANEL,drawer);
g_free (pixmap_name);
return drawer;
}
Drawer *
create_empty_drawer_applet(PanelOrientType orient)
create_empty_drawer_applet(char *tooltip, char *pixmap,
PanelOrientType orient)
{
switch(orient) {
case ORIENT_UP:
......@@ -177,6 +322,7 @@ create_empty_drawer_applet(PanelOrientType orient)
0, 0,
DROP_ZONE_LEFT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
tooltip,pixmap,
orient);
case ORIENT_DOWN:
return create_drawer_applet(panel_widget_new(0,
......@@ -187,6 +333,7 @@ create_empty_drawer_applet(PanelOrientType orient)
0, 0,
DROP_ZONE_RIGHT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
tooltip,pixmap,
orient);
case ORIENT_LEFT:
return create_drawer_applet(panel_widget_new(0,
......@@ -197,6 +344,7 @@ create_empty_drawer_applet(PanelOrientType orient)
0, 0,
DROP_ZONE_LEFT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
tooltip,pixmap,
orient);
case ORIENT_RIGHT:
return create_drawer_applet(panel_widget_new(0,
......@@ -207,6 +355,7 @@ create_empty_drawer_applet(PanelOrientType orient)
0, 0,
DROP_ZONE_RIGHT,
PANEL_BACK_NONE, NULL, TRUE, NULL),
tooltip,pixmap,
orient);
}
return NULL;
......@@ -215,16 +364,13 @@ create_empty_drawer_applet(PanelOrientType orient)
void
set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
{
GtkWidget *pixmap;
char *pixmap_name=NULL;
g_return_if_fail(drawer!=NULL);
drawer->orient = orient;
switch (drawer->orient) {
case ORIENT_DOWN:
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-down.png");
/*pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-down.png");*/
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_VERTICAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -233,7 +379,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
break;
case ORIENT_UP:
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-up.png");
/*pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-up.png");*/
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_VERTICAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -241,7 +387,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
DROP_ZONE_LEFT);
break;
case ORIENT_RIGHT:
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-right.png");
/*pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-right.png");*/
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_HORIZONTAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -249,7 +395,7 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
DROP_ZONE_RIGHT);
break;
case ORIENT_LEFT:
pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-left.png");
/*pixmap_name = gnome_unconditional_pixmap_file("gnome-menu-left.png");*/
panel_widget_change_orient(PANEL_WIDGET(drawer->drawer),
PANEL_HORIZONTAL);
panel_widget_change_drop_zone_pos(PANEL_WIDGET(drawer->
......@@ -258,14 +404,13 @@ set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient)
break;
}
pixmap=GTK_BUTTON(drawer->button)->child;
/*pixmap=GTK_BUTTON(drawer->button)->child;
gtk_container_remove(GTK_CONTAINER(drawer->button),pixmap);
/*make the pixmap*/
pixmap = gnome_pixmap_new_from_file (pixmap_name);
gtk_container_add (GTK_CONTAINER(drawer->button), pixmap);
gtk_widget_show (pixmap);
g_free(pixmap_name);
g_free(pixmap_name);*/
}
......@@ -8,20 +8,25 @@ BEGIN_GNOME_DECLS
#define DRAWER_PANEL "drawer_panel"
typedef struct {
char *pixmap;
char *tooltip;
GtkWidget *button;
GtkWidget *drawer;
PanelOrientType orient;
} Drawer;
Drawer * create_drawer_applet(GtkWidget * drawer_panel,
char *tooltip, char *pixmap,
PanelOrientType orient);
void set_drawer_applet_orient(Drawer *drawer, PanelOrientType orient);
Drawer * create_empty_drawer_applet(PanelOrientType orient);
Drawer * create_empty_drawer_applet(char *tooltip, char *pixmap,
PanelOrientType orient);
void reposition_drawer(Drawer *drawer);
void drawer_properties(Drawer *drawer);
END_GNOME_DECLS
......
......@@ -16,12 +16,13 @@
#include <string.h>
#include "gnome.h"
#include "panel.h"
#include "panel-util.h"
#define LAUNCHER_PROPERTIES "launcher_properties"
extern GtkTooltips *panel_tooltips;
static char *default_app_pixmap;
static char *default_app_pixmap=NULL;
typedef struct {
int applet_id;
......@@ -98,7 +99,7 @@ create_launcher (char *parameters)
if (default_app_pixmap)
pixmap = gnome_pixmap_new_from_file (default_app_pixmap);
else
pixmap = gtk_label_new ("App");
pixmap = gtk_label_new (_("App"));
}
gtk_container_add (GTK_CONTAINER(launcher->button), pixmap);
gtk_widget_show (pixmap);
......@@ -110,7 +111,8 @@ create_launcher (char *parameters)
gtk_widget_show (launcher->button);
launcher->signal_click_tag = gtk_signal_connect (GTK_OBJECT(launcher->button), "clicked",
launcher->signal_click_tag = gtk_signal_connect (GTK_OBJECT(launcher->button),
"clicked",
(GtkSignalFunc) launch,
dentry);
......@@ -126,43 +128,6 @@ create_launcher (char *parameters)
return launcher;
}
static void
notify_entry_change (GtkWidget *widget, void *data)
{
GnomePropertyBox *box = GNOME_PROPERTY_BOX (data);
gnome_property_box_changed (box);
}
static GtkWidget *
create_text_entry(GtkWidget *table, int row, char *label, char *text, GtkWidget *w)
{
GtkWidget *wlabel;
GtkWidget *entry;
wlabel = gtk_label_new(label);
gtk_misc_set_alignment(GTK_MISC(wlabel), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), wlabel,
0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_FILL | GTK_SHRINK,
0, 0);
gtk_widget_show(wlabel);
entry = gtk_entry_new();
if (text)
gtk_entry_set_text(GTK_ENTRY(entry), text);
gtk_table_attach(GTK_TABLE(table), entry,
1, 2, row, row + 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_FILL | GTK_SHRINK,
0, 0);
gtk_signal_connect (GTK_OBJECT (entry), "changed",
GTK_SIGNAL_FUNC(notify_entry_change), w);
return entry;
}
static void
check_dentry_save(GnomeDesktopEntry *dentry)
{
......@@ -297,10 +262,24 @@ properties_close_callback(GtkWidget *widget, gpointer data)
Properties *prop = data;
gtk_object_set_data(GTK_OBJECT(prop->launcher->button),
LAUNCHER_PROPERTIES,NULL);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->name_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->comment_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->execute_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->icon_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->documentation_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->terminal_toggle),widget);
g_free (prop);
return FALSE;
}
static void
notify_entry_change (GtkWidget *widget, void *data)
{
GnomePropertyBox *box = GNOME_PROPERTY_BOX (data);
gnome_property_box_changed (box);
}
static GtkWidget *
create_properties_dialog(GnomeDesktopEntry *dentry, Launcher *launcher)
{
......@@ -325,13 +304,28 @@ create_properties_dialog(GnomeDesktopEntry *dentry, Launcher *launcher)
gtk_table_set_col_spacings(GTK_TABLE(table), 6);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
prop->name_entry = create_text_entry(table, 0, _("Name"), dentry->name, dialog);
prop->comment_entry = create_text_entry(table, 1, _("Comment"), dentry->comment, dialog);
prop->name_entry = create_text_entry(table,
"launcher_name", 0,
_("Name"), dentry->name,
dialog);
prop->comment_entry = create_text_entry(table,
"launcher_comment", 1,
_("Comment"),
dentry->comment, dialog);
exec = gnome_string_joinv (" ", dentry->exec);
prop->execute_entry = create_text_entry(table, 2, _("Execute"), exec, dialog);
prop->execute_entry = create_file_entry(table,
"execute", 2,
_("Execute"), exec,
dialog);
g_free (exec);
prop->icon_entry = create_text_entry(table, 3, _("Icon"), dentry->icon, dialog);
prop->documentation_entry = create_text_entry(table, 4, _("Documentation"), dentry->docpath, dialog);
prop->icon_entry = create_file_entry(table,
"icon", 3,
_("Icon"), dentry->icon,
dialog);
prop->documentation_entry = create_text_entry(table,
"launcher_document", 4,
_("Documentation"),
dentry->docpath, dialog);
prop->terminal_toggle = toggle =
gtk_check_button_new_with_label(_("Run inside terminal"));
......@@ -347,7 +341,7 @@ create_properties_dialog(GnomeDesktopEntry *dentry, Launcher *launcher)
0, 0);
gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop->dialog),
table, gtk_label_new ("Item properties"));
table, gtk_label_new (_("Item properties")));
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
(GtkSignalFunc) properties_close_callback,
......
......@@ -69,6 +69,8 @@ struct _LoadApplet {
gchar *id_str;
gchar *path;
gchar *params;
gchar *pixmap;
gchar *tooltip;
gint pos;
gint panel;
gchar *cfgpath;
......@@ -251,6 +253,7 @@ exec_prog(gint applet_id, gchar *path, gchar *param)
static void
queue_load_applet(gchar *id_str, gchar *path, gchar *params,
gchar *pixmap, gchar *tooltip,
gint pos, gint panel, gchar *cfgpath)
{
LoadApplet *l;
......@@ -260,6 +263,8 @@ queue_load_applet(gchar *id_str, gchar *path, gchar *params,
if(path) l->path=g_strdup(path);
else l->path = NULL;
l->params=g_strdup(params);
l->pixmap=g_strdup(pixmap);
l->tooltip=g_strdup(tooltip);
l->pos=pos;
l->panel=panel;
l->cfgpath=g_strdup(cfgpath);
......@@ -343,6 +348,7 @@ get_applet_orient(PanelWidget *panel)
void
load_applet(gchar *id_str, gchar *path, gchar *params,
gchar *pixmap, gchar *tooltip,
gint pos, gint panel, gchar *cfgpath)
{
if(strcmp(id_str,EXTERN_ID) == 0) {
......@@ -368,11 +374,10 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
/*VERY UGLY compatibility hack for the old launcher applet*/
if(strcmp(path,"#panel.application.launcher")==0) {
gchar *p;
p = g_copy_strings(cfgpath,"path=",NULL);
fullpath = gnome_config_get_string(p);
g_free(p);
load_applet(LAUNCHER_ID,NULL,fullpath,pos,panel,
gnome_config_push_prefix(cfgpath);
fullpath = gnome_config_get_string("path=");
gnome_config_pop_prefix();
load_applet(LAUNCHER_ID,NULL,fullpath,NULL,NULL,pos,panel,
cfgpath);
g_free(cfgpath);
g_free(fullpath);
......@@ -439,6 +444,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
if(!params) {
drawer = create_empty_drawer_applet(
tooltip,pixmap,
get_applet_orient(parent));
panel_setup(PANEL_WIDGET(drawer->drawer));
panels = g_list_append(panels,drawer->drawer);
......@@ -447,6 +453,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
sscanf(params,"%d",&i);
drawer=create_drawer_applet(g_list_nth(panels,i)->data,
tooltip,pixmap,
get_applet_orient(parent));
}
......@@ -461,14 +468,23 @@ load_applet(gchar *id_str, gchar *path, gchar *params,
gtk_signal_connect(GTK_OBJECT(drawer->button), "clicked",
GTK_SIGNAL_FUNC(monitor_drawers),
panelarr);
/*default is open so we track it*/
panelarr[1]->drawers_open++;
/*pop up, if popped down*/
panel_widget_pop_up(panelarr[1]);
if(PANEL_WIDGET(drawer->drawer)->mode == PANEL_SHOWN) {
/*drawer is open so we track it*/
panelarr[1]->drawers_open++;
/*pop up, if popped down*/
panel_widget_pop_up(panelarr[1]);
} else
gtk_widget_hide(drawer->drawer);
reposition_drawer(drawer);
panel_widget_add_forbidden(PANEL_WIDGET(drawer->drawer));
gtk_tooltips_set_tip (panel_tooltips,drawer->button->parent,
drawer->tooltip,NULL);
applet_add_callback(applet_count-1,"properties",
GNOME_STOCK_MENU_PROP,
_("Properties..."));
} else if(strcmp(id_str,SWALLOW_ID) == 0) {
Swallow *swallow;
......@@ -494,10 +510,13 @@ load_queued_applets(void)
for(list = load_queue;list!=NULL;list=g_list_next(list)) {
LoadApplet *l=list->data;
load_applet(l->id_str,l->path,l->params,
l->pixmap,l->tooltip,
l->pos,l->panel,l->cfgpath);
g_free(l->id_str);
if(l->path) g_free(l->path);
g_free(l->params);
g_free(l->pixmap);
g_free(l->tooltip);
g_free(l->cfgpath);
g_free(l);
}
......@@ -519,9 +538,9 @@ add_forbidden_to_panels(void)
static void
load_default_applets(void)
{
queue_load_applet(MENU_ID, NULL, ".",
queue_load_applet(MENU_ID, NULL, ".", NULL, NULL,
PANEL_UNKNOWN_APPLET_POSITION, 0,NULL);
queue_load_applet(EXTERN_ID, "gen_util_applet", "--clock",
queue_load_applet(EXTERN_ID, "gen_util_applet", "--clock", NULL, NULL,
PANEL_UNKNOWN_APPLET_POSITION,0,NULL);
}
......@@ -530,6 +549,8 @@ init_user_applets(void)
{
char *applet_name;
char *applet_params;
char *applet_pixmap;
char *applet_tooltip;
char *applet_path;
int pos=0,panel;
char buf[256];
......@@ -552,6 +573,8 @@ init_user_applets(void)
applet_path = NULL;
applet_params = gnome_config_get_string("parameters=");
}
applet_pixmap = gnome_config_get_string("pixmap=");
applet_tooltip = gnome_config_get_string("tooltip=");
g_snprintf(buf,256,"position=%d",
PANEL_UNKNOWN_APPLET_POSITION);
......@@ -567,6 +590,7 @@ init_user_applets(void)
loads*/
g_snprintf(buf,256,"%sApplet_%d/",old_panel_cfg_path,num);
queue_load_applet(applet_name, applet_path, applet_params,
applet_pixmap, applet_tooltip,
pos, panel, buf);
gnome_config_pop_prefix();
......@@ -574,6 +598,8 @@ init_user_applets(void)
g_free(applet_name);
if(applet_path) g_free(applet_path);
g_free(applet_params);
g_free(applet_pixmap);
g_free(applet_tooltip);
}
}
......
......@@ -4,6 +4,7 @@
BEGIN_GNOME_DECLS
void load_applet(char *id, char *path, char *params,
char *pixmap, char *tooltip,
int pos, int panel, char *cfgpath);
void orientation_change(gint applet_id, PanelWidget *panel);
void back_change(gint applet_id, PanelWidget *panel);
......
......@@ -150,7 +150,7 @@ free_string (GtkWidget *widget, void *data)
static gint
add_to_panel (char *applet, char *path, char *arg)
{
load_applet(applet,path,arg,
load_applet(applet,path,arg,NULL,NULL,
PANEL_UNKNOWN_APPLET_POSITION,0,NULL);
return TRUE;
}
......
......@@ -116,3 +116,85 @@ string_is_in_list(GList *list,char *text)
return TRUE;
return FALSE;
}
/*these ones are used in internal property dialogs:*/
static void
notify_entry_change (GtkWidget *widget, void *data)
{
GnomePropertyBox *box = GNOME_PROPERTY_BOX (data);
gnome_property_box_changed (box);
}
/*FIXME: use gnome_entry*/
GtkWidget *
create_text_entry(GtkWidget *table,
char *history_id,
int row,
char *label,
char *text,
GtkWidget *w)
{
GtkWidget *wlabel;
GtkWidget *entry;
wlabel = gtk_label_new(label);
gtk_misc_set_alignment(GTK_MISC(wlabel), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), wlabel,
0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_FILL | GTK_SHRINK,
0, 0);
gtk_widget_show(wlabel);
entry = gtk_entry_new();
if (text)
gtk_entry_set_text(GTK_ENTRY(entry), text);
gtk_table_attach(GTK_TABLE(table), entry,
1, 2, row, row + 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_FILL | GTK_SHRINK,
0, 0);
gtk_signal_connect (GTK_OBJECT (entry), "changed",
GTK_SIGNAL_FUNC(notify_entry_change), w);
return entry;
}
GtkWidget *
create_file_entry(GtkWidget *table,
char *history_id,
int row,
char *label,
char *text,
GtkWidget *w)
{
GtkWidget *wlabel;
GtkWidget *entry;
GtkWidget *t;
wlabel = gtk_label_new(label);
gtk_misc_set_alignment(GTK_MISC(wlabel), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), wlabel,
0, 1, row, row + 1,