Commit 1d01dce4 authored by Anders Carlsson's avatar Anders Carlsson Committed by Anders Carlsson

Ref/Sink our menu, scale the panel menu icon.

2001-12-09  Anders Carlsson  <andersca@gnu.org>

	* applet.c: (panel_applet_add_callback), (setup_an_item),
	(applet_setup_panel_menu), (panel_applet_create_menu):
	Ref/Sink our menu, scale the panel menu icon.

	* main.c: (main): Don't respawn if I_LOVE_PANEL_CRACK is set.

	* menu.c: (setup_full_menuitem): gtk_widget_show our image.

	* panel.c: (drop_urilist): Implement so we can dnd urls to the panel.

Now I too am a panel hacker!
parent 2e986212
2001-12-09 Anders Carlsson <andersca@gnu.org>
* applet.c: (panel_applet_add_callback), (setup_an_item),
(applet_setup_panel_menu), (panel_applet_create_menu):
Ref/Sink our menu, scale the panel menu icon.
* main.c: (main): Don't respawn if I_LOVE_PANEL_CRACK is set.
* menu.c: (setup_full_menuitem): gtk_widget_show our image.
* panel.c: (drop_urilist): Implement so we can dnd urls to the panel.
Sun Dec 09 03:34:18 2001 George Lebl <jirka@5z.com>
* Makefile.am, tasklist_icon.[ch], foobar-widget.c, main.c, menu.c,
......
......@@ -260,7 +260,7 @@ panel_applet_add_callback (AppletInfo *info,
AppletUserMenu *menu;
g_return_if_fail (info != NULL);
menu = panel_applet_get_callback (info->user_menu, callback_name);
if (menu == NULL) {
menu = g_new0 (AppletUserMenu, 1);
......@@ -365,6 +365,7 @@ setup_an_item(AppletUserMenu *menu,
int is_submenu)
{
menu->menuitem = gtk_image_menu_item_new ();
g_signal_connect (G_OBJECT (menu->menuitem), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&menu->menuitem);
......@@ -483,8 +484,25 @@ applet_setup_panel_menu (gboolean is_basep)
pixmap_path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
"gnome-panel.png", TRUE, NULL);
if (pixmap_path) {
GdkPixbuf *pixbuf, *scaled_pixbuf = NULL;
GtkWidget *image = NULL;
pixbuf = gdk_pixbuf_new_from_file (pixmap_path, NULL);
if (pixbuf) {
scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
SMALL_ICON_SIZE,
SMALL_ICON_SIZE,
GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
}
if (scaled_pixbuf)
image = gtk_image_new_from_pixbuf (scaled_pixbuf);
g_object_unref (scaled_pixbuf);
setup_menuitem (menuitem,
gtk_image_new_from_file (pixmap_path),
image,
_("Panel"));
g_free (pixmap_path);
......@@ -510,7 +528,8 @@ panel_applet_create_menu (AppletInfo *info,
GtkWidget *menuitem;
GList *l;
info->menu = gtk_menu_new ();
info->menu = g_object_ref (gtk_menu_new ());
gtk_object_sink (GTK_OBJECT (info->menu));
if (!commie_mode) {
GtkWidget *image;
......
......@@ -465,7 +465,8 @@ main(int argc, char **argv)
client = gnome_master_client ();
gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
if (g_getenv ("I_LOVE_PANEL_CRACK") == NULL)
gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
gnome_client_set_priority (client, 40);
......
......@@ -1730,6 +1730,7 @@ setup_full_menuitem (GtkWidget *menuitem, GtkWidget *pixmap,
gtk_container_add (GTK_CONTAINER (menuitem), label);
if (icons_in_menus && pixmap) {
gtk_widget_show (pixmap);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), pixmap);
} else if (pixmap) {
gtk_widget_unref (pixmap);
......
......@@ -17,6 +17,8 @@
#include <libgnome/libgnome.h>
#include <libbonobo.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include "panel.h"
......@@ -962,20 +964,17 @@ static void
drop_urilist (PanelWidget *panel, int pos, char *urilist,
gboolean background_drops)
{
g_warning ("FIXME: drop_urilist() not implemented");
#ifdef FIXME
GList *li, *files;
struct stat s;
files = gnome_uri_list_extract_uris(urilist);
files = gnome_vfs_uri_list_parse (urilist);
for(li = files; li; li = li->next) {
char *uri;
for (li = files; li; li = li->next) {
GnomeVFSURI *vfs_uri = li->data;
gchar *uri = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_NONE);
const char *mimetype;
char *filename;
uri = li->data;
if (strncmp (uri, "http:", strlen ("http:")) == 0 ||
strncmp (uri, "https:", strlen ("https:")) == 0 ||
strncmp (uri, "ftp:", strlen ("ftp:")) == 0 ||
......@@ -987,7 +986,8 @@ drop_urilist (PanelWidget *panel, int pos, char *urilist,
continue;
}
filename = extract_filename (li->data);
/* FIXME: We should probably use a gnome-vfs function here instead. */
filename = extract_filename (uri);
if(filename == NULL)
continue;
......@@ -995,20 +995,20 @@ drop_urilist (PanelWidget *panel, int pos, char *urilist,
g_free(filename);
continue;
}
mimetype = gnome_mime_type(filename);
mimetype = gnome_vfs_mime_type_from_name(filename);
if (background_drops &&
mimetype != NULL &&
strncmp(mimetype, "image", sizeof("image")-1) == 0) {
panel_widget_set_back_pixmap (panel, filename);
} else if (mimetype != NULL &&
(strcmp(mimetype, "application/x-gnome-app-info") == 0 ||
strcmp(mimetype, "application/x-kde-app-info") == 0)) {
(strcmp(mimetype, "application/x-gnome-app-info") == 0 ||
strcmp(mimetype, "application/x-kde-app-info") == 0)) {
Launcher *launcher;
launcher = load_launcher_applet (filename, panel, pos, TRUE);
if (launcher != NULL)
launcher_hoard (launcher);
} else if (S_ISDIR(s.st_mode)) {
......@@ -1016,10 +1016,10 @@ drop_urilist (PanelWidget *panel, int pos, char *urilist,
} else if (S_IEXEC & s.st_mode) /*executable?*/
ask_about_launcher (filename, panel, pos, TRUE);
g_free (filename);
g_free (uri);
}
gnome_uri_list_free_strings (files);
#endif
gnome_vfs_uri_list_free (files);
}
static 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