Commit a2b2165d authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

panel: remove old launcher object

Existing launcher objects will be turned into applets.
parent d1344d2c
Pipeline #170398 passed with stages
in 12 minutes and 52 seconds
......@@ -16,7 +16,6 @@ gsettings_SCHEMAS = \
org.gnome.gnome-panel.applet.clock.gschema.xml \
org.gnome.gnome-panel.applet.initial-settings.gschema.xml \
org.gnome.gnome-panel.gschema.xml \
org.gnome.gnome-panel.launcher.gschema.xml \
org.gnome.gnome-panel.object.gschema.xml \
org.gnome.gnome-panel.toplevel.gschema.xml \
$(NULL)
......
<schemalist gettext-domain="gnome-panel">
<schema id="org.gnome.gnome-panel.launcher">
<key name="location" type="s">
<default>''</default>
<summary>Launcher location</summary>
<description>The location of the .desktop file describing the launcher. This key is only relevant if the object_type key is "launcher-object".</description>
</key>
</schema>
</schemalist>
......@@ -33,7 +33,6 @@ panel_sources = \
panel-util.c \
panel-run-dialog.c \
panel-context-menu.c \
launcher.c \
panel-applet-frame.c \
panel-applets-manager.c \
panel-action-button.c \
......@@ -47,7 +46,6 @@ panel_sources = \
panel-force-quit.c \
panel-lockdown.c \
panel-addto-dialog.c \
panel-ditem-editor.c \
panel-layout.c \
panel-object-loader.c \
panel-applet-info.c
......@@ -61,7 +59,6 @@ panel_headers = \
panel-util.h \
panel-run-dialog.h \
panel-context-menu.h \
launcher.h \
panel-applet-frame.h \
panel-applets-manager.h \
panel-action-button.h \
......@@ -77,7 +74,6 @@ panel_headers = \
panel-force-quit.h \
panel-lockdown.h \
panel-addto-dialog.h \
panel-ditem-editor.h \
panel-icon-names.h \
panel-layout.h \
panel-object-loader.h \
......
......@@ -19,7 +19,6 @@
#include <libpanel-util/panel-show.h>
#include "button-widget.h"
#include "launcher.h"
#include "panel.h"
#include "panel-bindings.h"
#include "panel-applet-frame.h"
......@@ -72,9 +71,6 @@ panel_applet_clean (AppletInfo *info)
{
g_return_if_fail (info != NULL);
if (info->type == PANEL_OBJECT_LAUNCHER)
panel_launcher_delete (info->data);
if (info->widget) {
GtkWidget *widget = info->widget;
......@@ -136,12 +132,6 @@ applet_callback_callback (GtkWidget *widget,
g_return_if_fail (menu->info != NULL);
switch (menu->info->type) {
case PANEL_OBJECT_LAUNCHER:
if (!strcmp (menu->name, "launch"))
launcher_launch (menu->info->data, widget);
else if (!strcmp (menu->name, "properties"))
launcher_properties (menu->info->data);
break;
case PANEL_OBJECT_ACTION:
panel_action_button_invoke_menu (
PANEL_ACTION_BUTTON (menu->info->widget), menu->name);
......@@ -181,7 +171,7 @@ applet_menu_deactivate (GtkWidget *w,
panel_toplevel_pop_autohide_disabler (panel_widget->toplevel);
}
AppletUserMenu *
static AppletUserMenu *
panel_applet_get_callback (GList *user_menu,
const char *name)
{
......
......@@ -64,9 +64,6 @@ void panel_applet_add_callback (AppletInfo *info,
const gchar *menuitem_text,
CallbackEnabledFunc is_enabled_func);
AppletUserMenu *panel_applet_get_callback (GList *user_menu,
const gchar *name);
void panel_applet_save_position (AppletInfo *applet_info,
const char *id,
gboolean immediate);
......
......@@ -25,7 +25,6 @@ struct _ButtonWidgetPrivate {
int size;
guint activatable : 1;
guint dnd_highlight : 1;
};
static void button_widget_icon_theme_changed (ButtonWidget *button);
......@@ -34,7 +33,6 @@ static void button_widget_reload_pixbuf (ButtonWidget *button);
enum {
PROP_0,
PROP_ACTIVATABLE,
PROP_DND_HIGHLIGHT,
PROP_ORIENTATION,
PROP_ICON_NAME
};
......@@ -213,9 +211,6 @@ button_widget_get_property (GObject *object,
case PROP_ACTIVATABLE:
g_value_set_boolean (value, button->priv->activatable);
break;
case PROP_DND_HIGHLIGHT:
g_value_set_boolean (value, button->priv->dnd_highlight);
break;
case PROP_ORIENTATION:
g_value_set_enum (value, button->priv->orientation);
break;
......@@ -242,9 +237,6 @@ button_widget_set_property (GObject *object,
case PROP_ACTIVATABLE:
button_widget_set_activatable (button, g_value_get_boolean (value));
break;
case PROP_DND_HIGHLIGHT:
button_widget_set_dnd_highlight (button, g_value_get_boolean (value));
break;
case PROP_ORIENTATION:
button_widget_set_orientation (button, g_value_get_enum (value));
break;
......@@ -313,15 +305,6 @@ button_widget_draw (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
if (button_widget->priv->dnd_highlight) {
cairo_save (cr);
cairo_set_line_width (cr, 1);
cairo_set_source_rgb (cr, 0., 0., 0.);
cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
cairo_stroke (cr);
cairo_restore (cr);
}
if (gtk_widget_has_focus (widget)) {
gtk_style_context_save (context);
gtk_style_context_set_state (context, state_flags);
......@@ -525,15 +508,14 @@ button_widget_init (ButtonWidget *button)
button->priv->pixbuf_hc = NULL;
button->priv->filename = NULL;
button->priv->orientation = PANEL_ORIENTATION_TOP;
context = gtk_widget_get_style_context (GTK_WIDGET (button));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
button->priv->size = 0;
button->priv->activatable = FALSE;
button->priv->dnd_highlight = FALSE;
}
static void
......@@ -568,15 +550,6 @@ button_widget_class_init (ButtonWidgetClass *klass)
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (
gobject_class,
PROP_DND_HIGHLIGHT,
g_param_spec_boolean ("dnd-highlight",
"Drag and drop Highlight",
"Whether or not to highlight the icon during drag and drop",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (
gobject_class,
PROP_ORIENTATION,
......@@ -605,21 +578,6 @@ button_widget_class_init (ButtonWidgetClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
GtkWidget *
button_widget_new (const char *filename,
PanelOrientation orientation)
{
GtkWidget *retval;
retval = g_object_new (
BUTTON_TYPE_WIDGET,
"orientation", orientation,
"icon-name", filename,
NULL);
return retval;
}
void
button_widget_set_activatable (ButtonWidget *button,
gboolean activatable)
......@@ -687,48 +645,3 @@ button_widget_set_orientation (ButtonWidget *button,
g_object_notify (G_OBJECT (button), "orientation");
}
PanelOrientation
button_widget_get_orientation (ButtonWidget *button)
{
g_return_val_if_fail (BUTTON_IS_WIDGET (button), 0);
return button->priv->orientation;
}
void
button_widget_set_dnd_highlight (ButtonWidget *button,
gboolean dnd_highlight)
{
g_return_if_fail (BUTTON_IS_WIDGET (button));
dnd_highlight = dnd_highlight != FALSE;
if (button->priv->dnd_highlight == dnd_highlight)
return;
button->priv->dnd_highlight = dnd_highlight;
gtk_widget_queue_draw (GTK_WIDGET (button));
g_object_notify (G_OBJECT (button), "dnd-highlight");
}
GtkIconTheme *
button_widget_get_icon_theme (ButtonWidget *button)
{
g_return_val_if_fail (BUTTON_IS_WIDGET (button), NULL);
return button->priv->icon_theme;
}
GdkPixbuf *
button_widget_get_pixbuf (ButtonWidget *button)
{
g_return_val_if_fail (BUTTON_IS_WIDGET (button), NULL);
if (!button->priv->pixbuf)
return NULL;
return g_object_ref (button->priv->pixbuf);
}
......@@ -27,19 +27,12 @@ struct _ButtonWidgetClass {
};
GType button_widget_get_type (void) G_GNUC_CONST;
GtkWidget * button_widget_new (const char *pixmap,
PanelOrientation orientation);
void button_widget_set_activatable (ButtonWidget *button,
gboolean activatable);
void button_widget_set_icon_name (ButtonWidget *button,
const char *icon_name);
void button_widget_set_orientation (ButtonWidget *button,
PanelOrientation orientation);
PanelOrientation button_widget_get_orientation (ButtonWidget *button);
void button_widget_set_dnd_highlight (ButtonWidget *button,
gboolean dnd_highlight);
GtkIconTheme *button_widget_get_icon_theme (ButtonWidget *button);
GdkPixbuf *button_widget_get_pixbuf (ButtonWidget *button);
G_END_DECLS
......
This diff is collapsed.
/*
* GNOME panel launcher module.
* (C) 1997 The Free Software Foundation
*
* Authors: Miguel de Icaza
* Federico Mena
* CORBAized by George Lebl
* de-CORBAized by George Lebl
*/
#ifndef LAUNCHER_H
#define LAUNCHER_H
#include "applet.h"
#include "panel-widget.h"
G_BEGIN_DECLS
typedef struct {
AppletInfo *info;
GtkWidget *button;
char *location;
GKeyFile *key_file;
GtkWidget *prop_dialog;
GSList *error_dialogs;
gulong destroy_handler;
} Launcher;
void panel_launcher_create (PanelToplevel *toplevel,
PanelObjectPackType pack_type,
int pack_index,
const char *location);
void launcher_launch (Launcher *launcher,
GtkWidget *widget);
void launcher_properties (Launcher *launcher);
void launcher_load (PanelWidget *panel_widget,
const char *id,
GSettings *settings);
void panel_launcher_delete (Launcher *launcher);
void ask_about_launcher (const char *file,
PanelWidget *panel,
PanelObjectPackType pack_type);
void launcher_properties_destroy (Launcher *launcher);
G_END_DECLS
#endif
......@@ -38,8 +38,6 @@ libpanel_util_la_SOURCES = \
panel-gsettings.h \
panel-gtk.c \
panel-gtk.h \
panel-icon-chooser.c \
panel-icon-chooser.h \
panel-keyfile.c \
panel-keyfile.h \
panel-launch.c \
......
/*
* panel-icon-chooser.c: An icon chooser widget
*
* Copyright (C) 2010 Novell, Inc.
*
* 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Vincent Untz <vuntz@gnome.org>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "panel-gtk.h"
#include "panel-xdg.h"
#include "panel-icon-chooser.h"
#define PANEL_ICON_CHOOSER_ICON_SIZE GTK_ICON_SIZE_DIALOG
struct _PanelIconChooserPrivate
{
char *fallback_icon_name;
char *icon;
char *icon_theme_dir;
GtkWidget *image;
GtkWidget *filechooser;
};
enum {
CHANGED,
LAST_SIGNAL
};
enum {
PROP_0,
PROP_FALLBACK_ICON,
PROP_ICON
};
static guint panel_icon_chooser_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (PanelIconChooser, panel_icon_chooser, GTK_TYPE_BUTTON)
static void _panel_icon_chooser_clicked (GtkButton *button);
static void _panel_icon_chooser_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void _panel_icon_chooser_screen_changed (GtkWidget *widget,
GdkScreen *prev_screen);
/* gobject stuff */
static GObject *
panel_icon_chooser_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *obj;
PanelIconChooser *chooser;
obj = G_OBJECT_CLASS (panel_icon_chooser_parent_class)->constructor (type,
n_construct_properties,
construct_properties);
chooser = PANEL_ICON_CHOOSER (obj);
gtk_container_add (GTK_CONTAINER (chooser), chooser->priv->image);
gtk_widget_show (chooser->priv->image);
return obj;
}
static void
panel_icon_chooser_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PanelIconChooser *chooser;
g_return_if_fail (PANEL_IS_ICON_CHOOSER (object));
chooser = PANEL_ICON_CHOOSER (object);
switch (prop_id) {
case PROP_FALLBACK_ICON:
g_value_set_string (value, panel_icon_chooser_get_fallback_icon_name (chooser));
break;
case PROP_ICON:
g_value_set_string (value, panel_icon_chooser_get_icon (chooser));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
panel_icon_chooser_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PanelIconChooser *chooser;
g_return_if_fail (PANEL_IS_ICON_CHOOSER (object));
chooser = PANEL_ICON_CHOOSER (object);
switch (prop_id) {
case PROP_FALLBACK_ICON:
panel_icon_chooser_set_fallback_icon_name (chooser,
g_value_get_string (value));
break;
case PROP_ICON:
panel_icon_chooser_set_icon (chooser,
g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
panel_icon_chooser_dispose (GObject *object)
{
PanelIconChooser *chooser;
chooser = PANEL_ICON_CHOOSER (object);
if (chooser->priv->filechooser) {
gtk_widget_destroy (chooser->priv->filechooser);
chooser->priv->filechooser = NULL;
}
/* remember, destroy can be run multiple times! */
if (chooser->priv->fallback_icon_name != NULL)
g_free (chooser->priv->fallback_icon_name);
chooser->priv->fallback_icon_name = NULL;
if (chooser->priv->icon != NULL)
g_free (chooser->priv->icon);
chooser->priv->icon = NULL;
if (chooser->priv->icon_theme_dir != NULL)
g_free (chooser->priv->icon_theme_dir);
chooser->priv->icon_theme_dir = NULL;
G_OBJECT_CLASS (panel_icon_chooser_parent_class)->dispose (object);
}
static void
panel_icon_chooser_class_init (PanelIconChooserClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (class);
GtkButtonClass *gtkbutton_class = GTK_BUTTON_CLASS (class);
gobject_class->constructor = panel_icon_chooser_constructor;
gobject_class->get_property = panel_icon_chooser_get_property;
gobject_class->set_property = panel_icon_chooser_set_property;
gobject_class->dispose = panel_icon_chooser_dispose;
gtkwidget_class->style_set = _panel_icon_chooser_style_set;
gtkwidget_class->screen_changed = _panel_icon_chooser_screen_changed;
gtkbutton_class->clicked = _panel_icon_chooser_clicked;
panel_icon_chooser_signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (PanelIconChooserClass,
changed),
NULL,
NULL,
NULL,
G_TYPE_NONE, 1,
G_TYPE_STRING);
g_object_class_install_property (
gobject_class,
PROP_FALLBACK_ICON,
g_param_spec_string ("fallback-icon-name",
"Fallback Icon Name",
"Icon name of the icon displayed (but not returned) if the current icon does not exit",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (
gobject_class,
PROP_ICON,
g_param_spec_string ("icon",
"Icon",
"Icon name or path",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
panel_icon_chooser_init (PanelIconChooser *chooser)
{
PanelIconChooserPrivate *priv;
priv = panel_icon_chooser_get_instance_private (chooser);
chooser->priv = priv;
priv->fallback_icon_name = g_strdup ("gtk-missing-image");
priv->icon = NULL;
priv->icon_theme_dir = NULL;
priv->image = gtk_image_new_from_icon_name (priv->fallback_icon_name,
PANEL_ICON_CHOOSER_ICON_SIZE);
priv->filechooser = NULL;
}
/* internal code */
static void
_panel_icon_chooser_update (PanelIconChooser *chooser)
{
if (!chooser->priv->icon) {
gtk_image_set_from_icon_name (GTK_IMAGE (chooser->priv->image),
chooser->priv->fallback_icon_name,
PANEL_ICON_CHOOSER_ICON_SIZE);
} else if (g_path_is_absolute (chooser->priv->icon)) {
gboolean fallback;
fallback = TRUE;
if (g_file_test (chooser->priv->icon, G_FILE_TEST_EXISTS)) {
/* we pass via a pixbuf to force the size we want */
GdkPixbuf *pixbuf;
int width, height;
gtk_icon_size_lookup (PANEL_ICON_CHOOSER_ICON_SIZE,
&width, &height);
pixbuf = gdk_pixbuf_new_from_file_at_size (chooser->priv->icon,
width, height,
NULL);
if (pixbuf) {
gtk_image_set_from_pixbuf (GTK_IMAGE (chooser->priv->image),
pixbuf);
g_object_unref (pixbuf);
fallback = FALSE;
}
}
if (fallback) {
gtk_image_set_from_icon_name (GTK_IMAGE (chooser->priv->image),
chooser->priv->fallback_icon_name,
PANEL_ICON_CHOOSER_ICON_SIZE);
}
} else {
/* Note: using GThemedIcon doesn't work well, see bug #606752.
* When we'll remove the alternative code, we won't need the
* style_set/screen_changed handlers anymore.
*/
#if 0
GIcon *icon;
char *names[2];
names[0] = panel_xdg_icon_remove_extension (chooser->priv->icon);
names[1] = chooser->priv->fallback_icon_name;
icon = g_themed_icon_new_from_names (names, 2);
gtk_image_set_from_gicon (GTK_IMAGE (chooser->priv->image),
icon,
PANEL_ICON_CHOOSER_ICON_SIZE);
g_free (names[0]);
#endif
GtkIconTheme *icon_theme;
const char *icon;
char *no_ext;