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

Some renaming of functions and minor cleanup of cruft.

Thu Jan 17 01:43:20 2002  George Lebl <jirka@5z.com>

	* panel-util.[ch], applet.c, basep-widget.c, drawer.c, logout.c,
	  menu.c: Some renaming of functions and minor cleanup of cruft.

	* panel-applet-frame.c, applet.c, panel.c:  Don't use the 'data'
	  field to store the frame, that's what the 'widget' item is for

	* xstuff.c, swallow.c: port the status and swallow checking to
	  libwnck and some swallowing cleanup including a ditem launch
	  error dialog
parent 94619052
Thu Jan 17 01:43:20 2002 George Lebl <jirka@5z.com>
* panel-util.[ch], applet.c, basep-widget.c, drawer.c, logout.c,
menu.c: Some renaming of functions and minor cleanup of cruft.
* panel-applet-frame.c, applet.c, panel.c: Don't use the 'data'
field to store the frame, that's what the 'widget' item is for
* xstuff.c, swallow.c: port the status and swallow checking to
libwnck and some swallowing cleanup including a ditem launch
error dialog
Wed Jan 16 18:14:43 2002 George Lebl <jirka@5z.com>
* panel-util.[ch], applet.c , launcher.c, menu.c: Reenable the
......
......@@ -1017,7 +1017,7 @@ panel_applet_save_to_gconf (AppletInfo *applet_info)
switch (applet_info->type) {
case APPLET_BONOBO:
panel_applet_frame_save_to_gconf (PANEL_APPLET_FRAME (applet_info->data),
panel_applet_frame_save_to_gconf (PANEL_APPLET_FRAME (applet_info->widget),
applet_info->gconf_key);
break;
case APPLET_DRAWER:
......
......@@ -303,12 +303,12 @@ basep_widget_realize (GtkWidget *w)
basep_widget_update_winhints (basep);
xstuff_set_no_group_and_no_input (w->window);
set_frame_colors (PANEL_WIDGET (basep->panel),
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
panel_set_frame_colors (PANEL_WIDGET (basep->panel),
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
if (basep->strut_left != 0 ||
basep->strut_right != 0 ||
......@@ -1413,12 +1413,12 @@ basep_back_change (PanelWidget *panel,
{
basep_update_frame (basep);
set_frame_colors (panel,
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
panel_set_frame_colors (panel,
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
}
static void
......@@ -1439,12 +1439,12 @@ basep_style_set (GtkWidget *widget, GtkStyle *previous_style)
if (GTK_WIDGET_CLASS (basep_widget_parent_class)->style_set)
GTK_WIDGET_CLASS (basep_widget_parent_class)->style_set (widget, previous_style);
set_frame_colors (panel,
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
panel_set_frame_colors (panel,
basep->frame,
basep->hidebutton_n,
basep->hidebutton_e,
basep->hidebutton_w,
basep->hidebutton_s);
}
static void
......
......@@ -296,7 +296,7 @@ drag_data_get_cb (GtkWidget *widget,
{
char *foo;
foo = g_strdup_printf ("DRAWER:%d", find_applet (widget));
foo = g_strdup_printf ("DRAWER:%d", panel_find_applet (widget));
gtk_selection_data_set (selection_data,
selection_data->target, 8, (guchar *)foo,
......
......@@ -53,7 +53,7 @@ drag_data_get_cb (GtkWidget *widget,
g_return_if_fail (type != NULL);
foo = g_strdup_printf ("%s:%d", type, find_applet (widget));
foo = g_strdup_printf ("%s:%d", type, panel_find_applet (widget));
gtk_selection_data_set (selection_data,
selection_data->target, 8, (guchar *)foo,
......
......@@ -341,7 +341,7 @@ activate_app_def (GtkWidget *widget, const char *item_loc)
0 /* flags */,
&error);
if (error != NULL) {
panel_error_dialog ("cant_load_entry",
panel_error_dialog ("cant_launch_entry",
_("<b>Can't launch entry</b>\n\n"
"Details: %s"), error->message);
g_clear_error (&error);
......@@ -3877,7 +3877,7 @@ drag_data_get_cb (GtkWidget *widget,
{
char *foo;
foo = g_strdup_printf ("MENU:%d", find_applet (widget));
foo = g_strdup_printf ("MENU:%d", panel_find_applet (widget));
gtk_selection_data_set (selection_data,
selection_data->target, 8, (guchar *)foo,
......
......@@ -174,8 +174,8 @@ panel_applet_frame_load (const gchar *iid,
gtk_widget_show_all (frame);
info = panel_applet_register (frame,
frame, /* FIXME: ref? */
NULL, /* FIXME: data_destroy */
NULL /* data */,
NULL /* data_destroy */,
panel,
pos,
FALSE,
......
......@@ -550,9 +550,9 @@ set_color_back (GtkWidget *widget, PanelWidget *panel)
}
void
set_frame_colors (PanelWidget *panel, GtkWidget *frame,
GtkWidget *but1, GtkWidget *but2,
GtkWidget *but3, GtkWidget *but4)
panel_set_frame_colors (PanelWidget *panel, GtkWidget *frame,
GtkWidget *but1, GtkWidget *but2,
GtkWidget *but3, GtkWidget *but4)
{
if (panel->back_type == PANEL_BACK_COLOR) {
set_color_back (frame, panel);
......@@ -569,36 +569,6 @@ set_frame_colors (PanelWidget *panel, GtkWidget *frame,
}
}
void
remove_directory(const char *dirname, gboolean just_clean)
{
DIR *dir;
struct dirent *dent;
char *oldcwd;
dir = opendir (dirname);
if(!dir) return;
oldcwd = g_get_current_dir();
chdir(dirname);
while((dent = readdir (dir)) != NULL) {
if(strcmp(dent->d_name,".")==0 ||
strcmp(dent->d_name,"..")==0)
continue;
if(g_file_test(dent->d_name,G_FILE_TEST_IS_DIR))
remove_directory(dent->d_name, FALSE);
else
unlink(dent->d_name);
}
closedir(dir);
chdir(oldcwd);
if(!just_clean)
rmdir(dirname);
g_free(oldcwd);
}
gboolean
convert_string_to_keysym_state(const char *string,
guint *keysym,
......@@ -710,16 +680,6 @@ panel_info_dialog (const char *class,
return w;
}
gboolean
string_empty (const char *string)
{
if (string == NULL ||
string[0] == '\0')
return TRUE;
else
return FALSE;
}
gboolean
is_ext (const char *file, const char *ext)
{
......@@ -758,7 +718,7 @@ is_ext2 (const char *file,
}
int
find_applet (GtkWidget *widget)
panel_find_applet (GtkWidget *widget)
{
int i;
GSList *li;
......
......@@ -10,9 +10,10 @@ G_BEGIN_DECLS
typedef void (*UpdateFunction) (gpointer);
/* return TRUE if string is NULL or the first character is '\0' */
gboolean string_empty (const char *string);
#define sure_string(s) ((s)!=NULL?(s):"")
/* TRUE if string is NULL or the first character is '\0' */
#define string_empty(s) ((s)==NULL||((char *)(s))[0]=='\0')
#define sure_string(s) ((const char *)((s)!=NULL?(s):""))
GtkWidget * create_text_entry (GtkWidget *table,
const char *history_id,
......@@ -47,20 +48,13 @@ GList * panel_g_list_resort_item(GList *list,
void panel_g_list_deep_free (GList *list);
void panel_g_slist_deep_free (GSList *list);
void set_frame_colors (PanelWidget *panel,
void panel_set_frame_colors (PanelWidget *panel,
GtkWidget *frame,
GtkWidget *but1,
GtkWidget *but2,
GtkWidget *but3,
GtkWidget *but4);
/* recursively remove directory, if just_clean is true, then
the directory itself is also removed, otherwise just it's
contents, it does not give any error output and will fail
silently, but it will remove as much as possible */
void remove_directory (const char *dirname,
gboolean just_clean);
gboolean convert_string_to_keysym_state (const char *string,
guint *keysym,
GdkModifierType *state);
......@@ -80,7 +74,7 @@ gboolean is_ext2 (const char *file,
const char *ext1,
const char *ext2);
int find_applet (GtkWidget *widget);
int panel_find_applet (GtkWidget *widget);
int get_requisition_width (GtkWidget *widget);
int get_requisition_height (GtkWidget *widget);
......
......@@ -213,7 +213,7 @@ orientation_change (AppletInfo *info,
switch (info->type) {
case APPLET_BONOBO:
panel_applet_frame_change_orient ((PanelAppletFrame *) info->data,
panel_applet_frame_change_orient (PANEL_APPLET_FRAME (info->widget),
get_applet_orient (panel));
break;
case APPLET_MENU:
......@@ -308,7 +308,7 @@ size_change (AppletInfo *info,
switch (info->type) {
case APPLET_BONOBO:
panel_applet_frame_change_size (
PANEL_APPLET_FRAME (info->data), size);
PANEL_APPLET_FRAME (info->widget), size);
break;
case APPLET_STATUS: {
StatusApplet *status = info->data;
......@@ -350,7 +350,7 @@ back_change (AppletInfo *info,
PanelWidget *panel)
{
if (info->type == APPLET_BONOBO) {
PanelAppletFrame *frame = PANEL_APPLET_FRAME (info->data);
PanelAppletFrame *frame = PANEL_APPLET_FRAME (info->widget);
switch (panel->back_type) {
case PANEL_BACK_PIXMAP:
......
......@@ -63,29 +63,29 @@ socket_realized (GtkWidget *w, gpointer data)
static void
swallow_launch (Swallow *swallow)
{
if (swallow->path && swallow->path [0] != '\0') {
char *p = strrchr (swallow->path, '.');
if ( ! string_empty (swallow->path)) {
GnomeDesktopItem *item;
/*only if such a file exists and ends in a .desktop, should
we try to launch it as such*/
if(p != NULL &&
(strcmp (p, ".desktop") == 0 ||
strcmp (p, ".kdelnk") == 0) &&
g_file_test (swallow->path, G_FILE_TEST_EXISTS) &&
(item = gnome_desktop_item_new_from_file (swallow->path, 0, NULL)) != NULL) {
char *curdir = g_get_current_dir ();
chdir (g_get_home_dir ());
if (is_ext2 (swallow->path, ".desktop", ".kdelnk") &&
g_file_test (swallow->path, G_FILE_TEST_EXISTS) &&
(item = gnome_desktop_item_new_from_file (swallow->path, 0, NULL)) != NULL) {
GError *error = NULL;
gnome_desktop_item_launch (item,
NULL /* file_list */,
0 /* flags */,
NULL /* error */);
/* FIXME: handle_errors */
&error);
gnome_desktop_item_unref (item);
chdir (curdir);
g_free (curdir);
if (error != NULL) {
panel_error_dialog ("cant_launch_entry",
_("<b>Can't launch entry</b>\n\n"
"Details: %s"), error->message);
g_clear_error (&error);
}
} else {
gnome_execute_shell (g_get_home_dir (), swallow->path);
}
......
......@@ -75,7 +75,6 @@ steal_statusspot(StatusSpot *ss, Window winid)
protocol, TRUE);
}
#ifdef FIXME
static void
try_adding_status(guint32 winid)
{
......@@ -101,19 +100,24 @@ try_adding_status(guint32 winid)
}
static void
try_checking_swallows (GwmhTask *task)
try_checking_swallows (WnckWindow *window)
{
gulong xid;
const char *name;
GList *li;
if (!task->name)
name = wnck_window_get_name (window);
xid = wnck_window_get_xid (window);
if (name == NULL)
return;
for (li = check_swallows; li; li = li->next) {
Swallow *swallow = li->data;
if (strstr (task->name, swallow->title) != NULL) {
swallow->wid = task->xwin;
gtk_socket_steal (GTK_SOCKET (swallow->socket),
swallow->wid);
if (strstr (name, swallow->title) != NULL) {
swallow->wid = xid;
gtk_socket_add_id (GTK_SOCKET (swallow->socket),
(GdkNativeWindow)xid);
check_swallows =
g_list_remove (check_swallows, swallow);
break;
......@@ -121,29 +125,36 @@ try_checking_swallows (GwmhTask *task)
}
}
#endif /* FIXME */
void
xstuff_go_through_client_list (void)
{
#ifdef FIXME
GList *li;
WnckScreen *screen = wnck_screen_get (0 /* FIXME screen number */);
GList *windows, *li;
windows = g_list_copy (wnck_screen_get_windows (screen));
gdk_error_trap_push ();
/* FIXME: is this a possible race? Can the WnckWindows disappear while
* we're traversing them? I think they can, fix this! */
/* just for status dock stuff for now */
for (li = gwmh_task_list_get (); li != NULL; li = li->next) {
GwmhTask *task = li->data;
for (li = windows; li != NULL; li = li->next) {
WnckWindow *window = li->data;
const char *name = wnck_window_get_name (window);
/* skip own windows */
if (task->name != NULL &&
strcmp (task->name, "panel") == 0)
if (name != NULL &&
strcmp (name, "panel") == 0)
continue;
if (check_swallows != NULL)
try_checking_swallows (task);
try_adding_status (task->xwin);
try_checking_swallows (window);
try_adding_status (wnck_window_get_xid (window));
}
gdk_flush();
gdk_error_trap_pop ();
#endif
g_list_free (windows);
}
void
......
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