Browse Source
(not sure this is done correctly) * add alternative launcher plugin This is definitely unfinished. I consider this my playground, so things will surely break ;-) * keep Brian happy with a detailed cvs commit message ;-) (Old svn revision: 4310)upstream/xfce4-panel-4.10.1

17 changed files with 2723 additions and 79 deletions
@ -0,0 +1,305 @@ |
|||
/* vim: set expandtab ts=8 sw=4: */ |
|||
|
|||
/* $Id$
|
|||
* |
|||
* Copyright © 2004-2005-2005 Jasper Huijsmans <jasper@xfce.org> |
|||
* |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Library General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|||
*/ |
|||
|
|||
#include <stdio.h> |
|||
#include <string.h> |
|||
|
|||
#include <gtk/gtk.h> |
|||
|
|||
#include "xfce-marshal.h" |
|||
#include "xfce-enum-types.h" |
|||
#include "xfce-arrow-button.h" |
|||
|
|||
#define ARROW_WIDTH 8 |
|||
#define ARROW_PADDING 2 |
|||
#define DEFAULT_ARROW_TYPE GTK_ARROW_UP |
|||
|
|||
|
|||
#ifndef _ |
|||
#define _(x) (x) |
|||
#endif |
|||
|
|||
enum |
|||
{ |
|||
ARROW_TYPE_CHANGED, |
|||
LAST_SIGNAL |
|||
}; |
|||
|
|||
enum |
|||
{ |
|||
PROP_0, |
|||
PROP_ARROW_TYPE, |
|||
}; |
|||
|
|||
|
|||
static void xfce_arrow_button_class_init (XfceArrowButtonClass * klass); |
|||
|
|||
static void xfce_arrow_button_init (XfceArrowButton * button); |
|||
|
|||
static void xfce_arrow_button_set_property (GObject * object, |
|||
guint prop_id, |
|||
const GValue * value, |
|||
GParamSpec * pspec); |
|||
|
|||
static void xfce_arrow_button_get_property (GObject * object, |
|||
guint prop_id, |
|||
GValue * value, |
|||
GParamSpec * pspec); |
|||
|
|||
static int xfce_arrow_button_expose (GtkWidget * widget, |
|||
GdkEventExpose * event); |
|||
|
|||
static void xfce_arrow_button_size_request (GtkWidget * widget, |
|||
GtkRequisition * requisition); |
|||
|
|||
static void xfce_arrow_button_add (GtkContainer * container, |
|||
GtkWidget *child); |
|||
|
|||
static GType xfce_arrow_button_child_type (GtkContainer * container); |
|||
|
|||
|
|||
|
|||
/* global vars */ |
|||
static GtkToggleButtonClass *parent_class = NULL; |
|||
|
|||
static guint arrow_button_signals[LAST_SIGNAL] = { 0 }; |
|||
|
|||
|
|||
GType |
|||
xfce_arrow_button_get_type (void) |
|||
{ |
|||
static GtkType type = 0; |
|||
|
|||
if (!type) |
|||
{ |
|||
static const GTypeInfo type_info = { |
|||
sizeof (XfceArrowButtonClass), |
|||
(GBaseInitFunc) NULL, |
|||
(GBaseFinalizeFunc) NULL, |
|||
(GClassInitFunc) xfce_arrow_button_class_init, |
|||
(GClassFinalizeFunc) NULL, |
|||
NULL, |
|||
sizeof (XfceArrowButton), |
|||
0, /* n_preallocs */ |
|||
(GInstanceInitFunc) xfce_arrow_button_init, |
|||
}; |
|||
|
|||
type = g_type_register_static (GTK_TYPE_TOGGLE_BUTTON, |
|||
"XfceArrowButton", &type_info, 0); |
|||
} |
|||
|
|||
return type; |
|||
} |
|||
|
|||
|
|||
static void |
|||
xfce_arrow_button_class_init (XfceArrowButtonClass * klass) |
|||
{ |
|||
GObjectClass *gobject_class; |
|||
GtkWidgetClass *widget_class; |
|||
GtkContainerClass *container_class; |
|||
GParamSpec *pspec; |
|||
|
|||
parent_class = g_type_class_peek_parent (klass); |
|||
|
|||
gobject_class = (GObjectClass *) klass; |
|||
widget_class = (GtkWidgetClass *) klass; |
|||
container_class = (GtkContainerClass *) klass; |
|||
|
|||
gobject_class->get_property = xfce_arrow_button_get_property; |
|||
gobject_class->set_property = xfce_arrow_button_set_property; |
|||
|
|||
widget_class->expose_event = xfce_arrow_button_expose; |
|||
widget_class->size_request = xfce_arrow_button_size_request; |
|||
|
|||
container_class->add = xfce_arrow_button_add; |
|||
container_class->child_type = xfce_arrow_button_child_type; |
|||
|
|||
/* properties */ |
|||
|
|||
/**
|
|||
* XfceArrowButton::arrow_type |
|||
* |
|||
* The arrow type of the button. This value also determines the direction |
|||
* of the popup menu. |
|||
*/ |
|||
pspec = g_param_spec_enum ("arrow_type", |
|||
_("Arrow type"), |
|||
_("The arrow type of the menu button"), |
|||
GTK_TYPE_ARROW_TYPE, |
|||
GTK_ARROW_UP, |
|||
G_PARAM_READWRITE); |
|||
|
|||
g_object_class_install_property (gobject_class, PROP_ARROW_TYPE, pspec); |
|||
|
|||
|
|||
/* signals */ |
|||
|
|||
/**
|
|||
* XfceArrowButton::arrow_type_changed: |
|||
* @button: the object which emitted the signal |
|||
* @type: the new #GtkArrowType of the button |
|||
* |
|||
* Emitted when the arrow direction of the menu button changes. |
|||
* This value also determines the direction of the popup menu. |
|||
*/ |
|||
arrow_button_signals[ARROW_TYPE_CHANGED] = |
|||
g_signal_new ("arrow-type-changed", |
|||
G_OBJECT_CLASS_TYPE (klass), |
|||
G_SIGNAL_RUN_FIRST, |
|||
G_STRUCT_OFFSET (XfceArrowButtonClass, |
|||
arrow_type_changed), |
|||
NULL, NULL, |
|||
g_cclosure_marshal_VOID__ENUM, |
|||
G_TYPE_NONE, 1, GTK_TYPE_ARROW_TYPE); |
|||
} |
|||
|
|||
static void |
|||
xfce_arrow_button_init (XfceArrowButton * arrow_button) |
|||
{ |
|||
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (arrow_button), GTK_NO_WINDOW); |
|||
|
|||
arrow_button->arrow_type = DEFAULT_ARROW_TYPE; |
|||
} |
|||
|
|||
static void |
|||
xfce_arrow_button_set_property (GObject * object, guint prop_id, |
|||
const GValue * value, GParamSpec * pspec) |
|||
{ |
|||
XfceArrowButton *button = XFCE_ARROW_BUTTON (object); |
|||
|
|||
switch (prop_id) |
|||
{ |
|||
case PROP_ARROW_TYPE: |
|||
xfce_arrow_button_set_arrow_type (button, |
|||
g_value_get_enum (value)); |
|||
break; |
|||
default: |
|||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
static void |
|||
xfce_arrow_button_get_property (GObject * object, |
|||
guint prop_id, GValue * value, |
|||
GParamSpec * pspec) |
|||
{ |
|||
XfceArrowButton *button = XFCE_ARROW_BUTTON (object); |
|||
|
|||
switch (prop_id) |
|||
{ |
|||
case PROP_ARROW_TYPE: |
|||
g_value_set_enum (value, button->arrow_type); |
|||
break; |
|||
default: |
|||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
static int |
|||
xfce_arrow_button_expose (GtkWidget * widget, GdkEventExpose *event) |
|||
{ |
|||
if (GTK_WIDGET_DRAWABLE (widget)) |
|||
{ |
|||
int x, y, w; |
|||
|
|||
w = MIN (widget->allocation.height, widget->allocation.width) |
|||
- 2 * MAX (widget->style->xthickness, widget->style->ythickness); |
|||
|
|||
w = MIN (w, ARROW_WIDTH); |
|||
|
|||
x = widget->allocation.x + (widget->allocation.width - w) / 2; |
|||
|
|||
y = widget->allocation.y + (widget->allocation.height - w) / 2; |
|||
|
|||
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); |
|||
|
|||
gtk_paint_arrow (widget->style, widget->window, |
|||
GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE, |
|||
&(event->area), widget, "xfce_arrow_button", |
|||
XFCE_ARROW_BUTTON (widget)->arrow_type, FALSE, |
|||
x, y, w, w); |
|||
} |
|||
|
|||
return TRUE; |
|||
} |
|||
|
|||
static void |
|||
xfce_arrow_button_size_request (GtkWidget * widget, |
|||
GtkRequisition * requisition) |
|||
{ |
|||
int size = ARROW_WIDTH + ARROW_PADDING + |
|||
2 * MAX (widget->style->xthickness, widget->style->ythickness); |
|||
|
|||
requisition->width = requisition->height = size; |
|||
} |
|||
|
|||
static void xfce_arrow_button_add (GtkContainer * container, GtkWidget *child) |
|||
{ |
|||
g_warning ("XfceArrowButton cannot contain any children"); |
|||
} |
|||
|
|||
static GType xfce_arrow_button_child_type (GtkContainer * container) |
|||
{ |
|||
return GTK_TYPE_NONE; |
|||
} |
|||
|
|||
|
|||
/* public interface */ |
|||
|
|||
GtkWidget * |
|||
xfce_arrow_button_new (GtkArrowType type) |
|||
{ |
|||
XfceArrowButton *button; |
|||
|
|||
button = g_object_new (XFCE_TYPE_ARROW_BUTTON, "arrow_type", type, NULL); |
|||
|
|||
return GTK_WIDGET (button); |
|||
} |
|||
|
|||
void |
|||
xfce_arrow_button_set_arrow_type (XfceArrowButton * button, |
|||
GtkArrowType type) |
|||
{ |
|||
g_return_if_fail (XFCE_IS_ARROW_BUTTON (button)); |
|||
|
|||
button->arrow_type = type; |
|||
|
|||
g_signal_emit (button, arrow_button_signals[ARROW_TYPE_CHANGED], |
|||
0, type); |
|||
|
|||
g_object_notify (G_OBJECT (button), "arrow_type"); |
|||
|
|||
gtk_widget_queue_draw (GTK_WIDGET (button)); |
|||
} |
|||
|
|||
GtkArrowType |
|||
xfce_arrow_button_get_arrow_type (XfceArrowButton * button) |
|||
{ |
|||
g_return_val_if_fail (XFCE_IS_ARROW_BUTTON (button), |
|||
DEFAULT_ARROW_TYPE); |
|||
|
|||
return button->arrow_type; |
|||
} |
|||
|
|||
|
@ -0,0 +1,76 @@ |
|||
/* vim: set expandtab ts=8 sw=4: */ |
|||
|
|||
/* $Id$
|
|||
* |
|||
* Copyright © 2004-2005 Jasper Huijsmans <jasper@xfce.org> |
|||
* |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Library General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|||
*/ |
|||
|
|||
#ifndef _XFCE_ARROW_BUTTON_H |
|||
#define _XFCE_ARROW_BUTTON_H |
|||
|
|||
#include <gtk/gtkenums.h> |
|||
#include <gtk/gtkbutton.h> |
|||
|
|||
#define XFCE_TYPE_ARROW_BUTTON (xfce_arrow_button_get_type ()) |
|||
#define XFCE_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButton)) |
|||
#define XFCE_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) |
|||
#define XFCE_IS_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_ARROW_BUTTON)) |
|||
#define XFCE_IS_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_ARROW_BUTTON)) |
|||
#define XFCE_ARROW_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) |
|||
|
|||
|
|||
G_BEGIN_DECLS |
|||
|
|||
typedef struct _XfceArrowButton XfceArrowButton; |
|||
|
|||
typedef struct _XfceArrowButtonClass XfceArrowButtonClass; |
|||
|
|||
struct _XfceArrowButton |
|||
{ |
|||
GtkToggleButton parent; |
|||
|
|||
GtkArrowType arrow_type; |
|||
}; |
|||
|
|||
struct _XfceArrowButtonClass |
|||
{ |
|||
GtkToggleButtonClass parent_class; |
|||
|
|||
/* signals */ |
|||
void (*arrow_type_changed) (GtkWidget * widget, |
|||
GtkArrowType type); |
|||
|
|||
/* Padding for future expansion */ |
|||
void (*_xfce_reserved1) (void); |
|||
void (*_xfce_reserved2) (void); |
|||
void (*_xfce_reserved3) (void); |
|||
}; |
|||
|
|||
|
|||
GType xfce_arrow_button_get_type (void) G_GNUC_CONST; |
|||
|
|||
GtkWidget *xfce_arrow_button_new (GtkArrowType type); |
|||
|
|||
|
|||
GtkArrowType xfce_arrow_button_get_arrow_type (XfceArrowButton * button); |
|||
|
|||
void xfce_arrow_button_set_arrow_type (XfceArrowButton * button, |
|||
GtkArrowType type); |
|||
|
|||
G_END_DECLS |
|||
|
|||
#endif /* _XFCE_ARROW_BUTTON_H */ |
@ -0,0 +1,31 @@ |
|||
plugindir = $(libdir)/xfce4/panel-plugins |
|||
|
|||
plugin_LTLIBRARIES = liblauncher.la |
|||
|
|||
liblauncher_la_LDFLAGS = \
|
|||
-avoid-version \
|
|||
-module |
|||
|
|||
liblauncher_la_SOURCES = \
|
|||
launcher.c |
|||
|
|||
liblauncher_la_CFLAGS = \
|
|||
-I$(top_srcdir) \
|
|||
@LIBXFCEGUI4_CFLAGS@ \
|
|||
@LIBXML_CFLAGS@ \
|
|||
-DLOCALEDIR=\"$(localedir)\" |
|||
|
|||
liblauncher_la_LIBADD = \
|
|||
@LIBS@ |
|||
|
|||
if HAVE_CYGWIN |
|||
liblauncher_la_LDFLAGS += \
|
|||
-no-undefined \
|
|||
-export-symbols $(top_srcdir)/panel/panel.def \
|
|||
@LIBXML_LDFLAGS@ \
|
|||
@LIBX11_LDFLAGS@ |
|||
liblauncher_la_LIBADD += \
|
|||
@LIBXFCEGUI4_LIBS@ \
|
|||
@LIBXML_LIBS@ \
|
|||
@LIBX11_LIBS@ |
|||
endif |
File diff suppressed because it is too large
Loading…
Reference in new issue