Commit e4ab7d32 authored by Anders Carlsson's avatar Anders Carlsson Committed by Anders Carlsson

Re-add gnome-panel-screenshot

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

	* Makefile.am: Re-add gnome-panel-screenshot

	* gnome-panel-screenshot.c: (main): Build with gnome2.

	* gnome-panel-screenshot.glade: Switch button order.

	* panel-applet-frame.c: (panel_applet_frame_load),
	(panel_applet_frame_construct), (panel_applet_frame_new):
	* panel-applet-frame.h:
	Don't segfault when applets can't be loaded.

	* panel-gconf.c: (panel_notify_object_dead),
	(panel_gconf_notify_add_while_alive):
	Use g_object_weak_ref here instead.

	* panel.c: (drop_background_reset), (drop_bgimage),
	(get_target_list), (drag_data_recieved_cb):
	Use x-special/gnome-reset-background to reset backgrounds.
parent 0bb37447
2001-12-21 Anders Carlsson <andersca@gnu.org>
* Makefile.am: Re-add gnome-panel-screenshot
* gnome-panel-screenshot.c: (main): Build with gnome2.
* gnome-panel-screenshot.glade: Switch button order.
* panel-applet-frame.c: (panel_applet_frame_load),
(panel_applet_frame_construct), (panel_applet_frame_new):
* panel-applet-frame.h:
Don't segfault when applets can't be loaded.
* panel-gconf.c: (panel_notify_object_dead),
(panel_gconf_notify_add_while_alive):
Use g_object_weak_ref here instead.
* panel.c: (drop_background_reset), (drop_bgimage),
(get_target_list), (drag_data_recieved_cb):
Use x-special/gnome-reset-background to reset backgrounds.
2001-12-21 Glynn Foster <glynn.foster@sun.com>
* aligned-widget.c, aligned-widget.h, basep-widget.c, basep-widget.h,
......
......@@ -27,7 +27,10 @@ INCLUDES = \
$(WARN_CFLAGS) \
$(NULL)
bin_PROGRAMS = gnome-panel-2 gnome-panel-properties
bin_PROGRAMS = \
gnome-panel-2 \
gnome-panel-properties \
gnome-panel-screenshot
CORBA_SRCLIST = \
GNOME_Panel-stubs.c \
......@@ -151,6 +154,16 @@ gnome_panel_properties_LDADD = $(PANELCONFIG_LIBS)
gnome_panel_properties_LDFLAGS = -export-dynamic
gnome_panel_screenshot_SOURCES = \
gnome-panel-screenshot.c
gnome_panel_screenshot_LDFLAGS = -export-dynamic
gnome_panel_screenshot_LDADD = \
$(PANELCONFIG_LIBS) \
$(PNG_LIBS)
EXTRA_DIST = \
APPLET_WRITING \
GNOME_Panel.server.in \
......@@ -168,14 +181,25 @@ EXTRA_DIST = \
panel-marshal.list
gladedir = $(datadir)/gnome/panel
glade_DATA = gnome-panel-properties.glade2
glade_src = gnome-panel-properties.glade
glade_msgs = gnome-panel-properties.glade.h
glade_DATA = \
gnome-panel-properties.glade2 \
gnome-panel-screenshot.glade2
glade_src = \
gnome-panel-properties.glade \
gnome-panel-screenshot.glade
glade_msgs = \
gnome-panel-properties.glade.h \
gnome-panel-screenshot.glade.h
gnome-panel-properties.glade2: gnome-panel-properties.glade $(LIBGLADE_CONVERT)
$(LIBGLADE_CONVERT) $(srcdir)/gnome-panel-properties.glade > gnome-panel-properties.glade.tmp \
&& mv gnome-panel-properties.glade.tmp gnome-panel-properties.glade2
gnome-panel-screenshot.glade2: gnome-panel-screenshot.glade $(LIBGLADE_CONVERT)
$(LIBGLADE_CONVERT) $(srcdir)/gnome-panel-screenshot.glade > gnome-panel-screenshot.glade.tmp \
&& mv gnome-panel-screenshot.glade.tmp gnome-panel-screenshot.glade2
hintsdir = $(datadir)/gnome/hints
hints_DATA = panel.hints
......
......@@ -24,7 +24,7 @@
/* IF YOU WANT YOUR OWN FEATURE -- WRITE THE DAMN THING YOURSELF (-:*/
#include <config.h>
#include <libgnomeui/libgnomeui.h>
#include <gnome.h>
#include <glade/glade.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
......@@ -1034,17 +1034,17 @@ main (int argc, char *argv[])
else
take_screen_shot ();
if (g_file_test ("gnome-panel-screenshot.glade", G_FILE_TEST_EXISTS)) {
xml = glade_xml_new ("gnome-panel-screenshot.glade", NULL, NULL);
if (g_file_test ("gnome-panel-screenshot.glade2", G_FILE_TEST_EXISTS)) {
xml = glade_xml_new ("gnome-panel-screenshot.glade2", NULL, NULL);
}
if (xml == NULL) {
xml = glade_xml_new (GLADEDIR "/gnome-panel-screenshot.glade",
xml = glade_xml_new (GLADEDIR "/gnome-panel-screenshot.glade2",
NULL, NULL);
}
if (xml == NULL) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new
(NULL /* parent */
(NULL /* parent */,
0 /* flags */,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
......@@ -1066,7 +1066,7 @@ main (int argc, char *argv[])
if (screenshot == NULL) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new
(NULL /* parent */
(NULL /* parent */,
0 /* flags */,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
......
......@@ -223,30 +223,24 @@
<widget>
<class>GtkButton</class>
<name>ok_button</name>
<name>cancel_button</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_ok_button_clicked</handler>
<last_modification_time>Wed, 23 May 2001 12:58:22 GMT</last_modification_time>
<handler>on_cancel_button_clicked</handler>
<last_modification_time>Wed, 23 May 2001 12:58:52 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>cancel_button</name>
<name>ok_button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_cancel_button_clicked</handler>
<last_modification_time>Wed, 23 May 2001 12:58:52 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
......
......@@ -100,6 +100,21 @@ panel_applet_frame_load (const gchar *iid,
frame = panel_applet_frame_new (iid);
if (!frame) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("There was a problem loading the applet."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return;
}
gtk_widget_show_all (frame);
info = panel_applet_register (frame,
......@@ -320,7 +335,7 @@ panel_applet_frame_get_applet_shell (Bonobo_Control control)
return retval;
}
void
GtkWidget *
panel_applet_frame_construct (PanelAppletFrame *frame,
const gchar *iid)
{
......@@ -341,7 +356,7 @@ panel_applet_frame_construct (PanelAppletFrame *frame,
if (!widget) {
g_warning (G_STRLOC ": failed to load %s", iid);
return;
return NULL;
}
frame->priv->iid = g_strdup (iid);
......@@ -375,6 +390,8 @@ panel_applet_frame_construct (PanelAppletFrame *frame,
bonobo_ui_component_add_verb_list_with_data (ui_component, popup_verbs, frame);
gtk_container_add (GTK_CONTAINER (frame), widget);
return widget;
}
GtkWidget *
......@@ -384,7 +401,10 @@ panel_applet_frame_new (const gchar *iid)
frame = g_object_new (PANEL_TYPE_APPLET_FRAME, NULL);
panel_applet_frame_construct (frame, iid);
if (!panel_applet_frame_construct (frame, iid)) {
g_object_unref (frame);
return NULL;
}
return GTK_WIDGET (frame);
}
......@@ -57,7 +57,7 @@ GType panel_applet_frame_get_type (void) G_GNUC_CONST;
GtkWidget *panel_applet_frame_new (const gchar *iid);
void panel_applet_frame_construct (PanelAppletFrame *frame,
GtkWidget *panel_applet_frame_construct (PanelAppletFrame *frame,
const gchar *iid);
void panel_applet_frame_set_info (PanelAppletFrame *frame,
......
......@@ -170,9 +170,8 @@ panel_gconf_notify_add (const gchar *key, GConfClientNotifyFunc notify_func, gpo
}
static void
panel_notify_object_dead (gpointer data)
panel_notify_object_dead (guint notify_id)
{
guint notify_id = GPOINTER_TO_UINT (data);
gconf_client_notify_remove (panel_gconf_get_client (),
notify_id);
}
......@@ -188,16 +187,11 @@ panel_gconf_notify_add_while_alive (const gchar *key,
notify_id = panel_gconf_notify_add (key, notify_func, alive_object);
if (notify_id > 0) {
static int cookie = 0;
char *str;
/* eek a hack, we want a unique key each time,
* how else do we hook into the destruction of an object?? */
str = g_strdup_printf ("PanelGConfNotify-%d", cookie++);
g_object_set_data_full (alive_object,
str,
GUINT_TO_POINTER (notify_id),
panel_notify_object_dead);
g_free (str);
/* Add a weak reference to the object so that we can
* remove the notification when the object's gone. */
g_object_weak_ref (alive_object,
(GWeakNotify)panel_notify_object_dead,
GUINT_TO_POINTER (notify_id));
}
return notify_id;
}
......
......@@ -42,10 +42,6 @@
#include "swallow.h"
#include "panel-applet-frame.h"
/* nautilus uses this UTTER HACK to reset backgrounds, ugly ugly ugly,
* broken, ugly ugly, but whatever */
#define RESET_IMAGE_NAME "/nautilus/backgrounds/reset.png"
#define PANEL_EVENT_MASK (GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK | \
GDK_POINTER_MOTION_MASK | \
......@@ -83,7 +79,8 @@ enum {
TARGET_APPLET,
TARGET_APPLET_INTERNAL,
TARGET_ICON_INTERNAL,
TARGET_BGIMAGE
TARGET_BGIMAGE,
TARGET_BACKGROUND_RESET,
};
static void
......@@ -1019,6 +1016,20 @@ drop_urilist (PanelWidget *panel, int pos, char *urilist,
gnome_vfs_uri_list_free (files);
}
static void
drop_background_reset (PanelWidget *panel)
{
panel_widget_change_params (panel,
panel->orient,
panel->sz,
PANEL_BACK_NONE,
panel->back_pixmap,
panel->fit_pixmap_bg,
panel->stretch_pixmap_bg,
panel->rotate_pixmap_bg,
&panel->back_color);
}
static void
drop_bgimage (PanelWidget *panel, const char *bgimage)
{
......@@ -1026,21 +1037,7 @@ drop_bgimage (PanelWidget *panel, const char *bgimage)
filename = extract_filename (bgimage);
if (filename != NULL) {
/* an incredible hack, no, worse, INCREDIBLE FUCKING HACK,
* whatever, we need to work with nautilus on this one */
if (strstr (filename, RESET_IMAGE_NAME) != NULL) {
panel_widget_change_params (panel,
panel->orient,
panel->sz,
PANEL_BACK_NONE,
panel->back_pixmap,
panel->fit_pixmap_bg,
panel->stretch_pixmap_bg,
panel->rotate_pixmap_bg,
&panel->back_color);
} else {
panel_widget_set_back_pixmap (panel, filename);
}
panel_widget_set_back_pixmap (panel, filename);
g_free (filename);
}
......@@ -1184,7 +1181,8 @@ get_target_list (void)
{ "application/x-panel-applet-internal", 0, TARGET_APPLET_INTERNAL },
{ "application/x-panel-icon-internal", 0, TARGET_ICON_INTERNAL },
{ "application/x-color", 0, TARGET_COLOR },
{ "property/bgimage", 0, TARGET_BGIMAGE }
{ "property/bgimage", 0, TARGET_BGIMAGE },
{ "x-special/gnome-reset-background", 0, TARGET_BACKGROUND_RESET },
};
static GtkTargetList *target_list = NULL;
......@@ -1411,6 +1409,10 @@ drag_data_recieved_cb (GtkWidget *widget,
if ( ! FOOBAR_IS_WIDGET(widget))
drop_bgimage (panel, (char *)selection_data->data);
break;
case TARGET_BACKGROUND_RESET:
if ( ! FOOBAR_IS_WIDGET(widget))
drop_background_reset (panel);
break;
case TARGET_DIRECTORY:
drop_directory (panel, pos, (char *)selection_data->data);
break;
......
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