Commit 97e8610e authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

panel: remove old menu bar object

parent 6b112843
......@@ -37,7 +37,6 @@ panel_sources = \
panel-stock-icons.c \
panel-action-button.c \
panel-image-menu-item.c \
panel-menu-bar.c \
panel-menu-bar-object.c \
panel-menu-button.c \
panel-menu-items.c \
......@@ -75,7 +74,6 @@ panel_headers = \
panel-stock-icons.h \
panel-action-button.h \
panel-image-menu-item.h \
panel-menu-bar.h \
panel-menu-bar-object.h \
panel-menu-button.h \
panel-menu-items.h \
......
......@@ -24,7 +24,6 @@
#include "panel-bindings.h"
#include "panel-applet-frame.h"
#include "panel-action-button.h"
#include "panel-menu-bar.h"
#include "panel-toplevel.h"
#include "panel-util.h"
#include "panel-menu-button.h"
......@@ -64,7 +63,6 @@ panel_applet_set_dnd_enabled (AppletInfo *info,
panel_action_button_set_dnd_enabled (PANEL_ACTION_BUTTON (info->widget),
dnd_enabled);
break;
case PANEL_OBJECT_MENU_BAR:
case PANEL_OBJECT_USER_MENU:
break;
default:
......@@ -180,10 +178,6 @@ applet_callback_callback (GtkWidget *widget,
panel_action_button_invoke_menu (
PANEL_ACTION_BUTTON (menu->info->widget), menu->name);
break;
case PANEL_OBJECT_MENU_BAR:
panel_menu_bar_invoke_menu (
PANEL_MENU_BAR (menu->info->widget), menu->name);
break;
case PANEL_OBJECT_APPLET:
/*
......
......@@ -35,7 +35,6 @@
#include "panel-force-quit.h"
#include "panel-run-dialog.h"
#include "panel-menu-button.h"
#include "panel-menu-bar.h"
static Atom atom_gnome_panel_action = None;
static Atom atom_gnome_panel_action_main_menu = None;
......@@ -54,13 +53,6 @@ panel_action_protocol_main_menu (GdkScreen *screen,
if (panel_applet_activate_main_menu (activate_time))
return;
info = panel_applet_get_by_type (PANEL_OBJECT_MENU_BAR, screen);
if (info) {
panel_menu_bar_popup_menu (PANEL_MENU_BAR (info->widget),
activate_time);
return;
}
info = panel_applet_get_by_type (PANEL_OBJECT_MENU, screen);
if (info && panel_menu_button_is_main_menu (PANEL_MENU_BUTTON (info->widget))) {
panel_menu_button_popup_menu (PANEL_MENU_BUTTON (info->widget),
......
......@@ -36,7 +36,6 @@
#include "panel-applets-manager.h"
#include "panel-applet-frame.h"
#include "panel-action-button.h"
#include "panel-menu-bar.h"
#include "panel-toplevel.h"
#include "panel-menu-button.h"
#include "panel-layout.h"
......@@ -88,7 +87,6 @@ typedef enum {
PANEL_ADDTO_LAUNCHER,
PANEL_ADDTO_LAUNCHER_NEW,
PANEL_ADDTO_MENU,
PANEL_ADDTO_MENUBAR,
PANEL_ADDTO_USER_MENU
} PanelAddtoItemType;
......@@ -143,15 +141,6 @@ prepend_internal_applets (GSList *list)
internal->action_type = PANEL_ACTION_NONE;
internal->iid = g_strdup ("MENU:MAIN");
list = g_slist_prepend (list, internal);
internal = g_new0 (PanelAddtoItemInfo, 1);
internal->type = PANEL_ADDTO_MENUBAR;
internal->name = g_strdup (_("Menu Bar"));
internal->description = g_strdup (_("A custom menu bar"));
internal->icon = g_themed_icon_new (PANEL_ICON_MAIN_MENU);
internal->action_type = PANEL_ACTION_NONE;
internal->iid = g_strdup ("MENUBAR:NEW");
list = g_slist_prepend (list, internal);
internal = g_new0 (PanelAddtoItemInfo, 1);
internal->type = PANEL_ADDTO_USER_MENU;
......@@ -752,11 +741,6 @@ panel_addto_add_item (PanelAddtoDialog *dialog,
item_info->menu_path,
item_info->name);
break;
case PANEL_ADDTO_MENUBAR:
panel_menu_bar_create (dialog->panel_widget->toplevel,
dialog->insert_pack_type,
pack_index);
break;
case PANEL_ADDTO_USER_MENU:
panel_user_menu_create (dialog->panel_widget->toplevel,
dialog->insert_pack_type,
......
......@@ -36,7 +36,6 @@ typedef enum {
PANEL_OBJECT_LAUNCHER,
PANEL_OBJECT_APPLET,
PANEL_OBJECT_ACTION,
PANEL_OBJECT_MENU_BAR,
PANEL_OBJECT_USER_MENU
} PanelObjectType;
......
/*
* panel-menu-bar.c: panel Applications/Places/Desktop menu bar
*
* Copyright (C) 2003 Sun Microsystems, Inc.
* Copyright (C) 2004 Vincent Untz
*
* 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:
* Mark McLoughlin <mark@skynet.ie>
* Vincent Untz <vincent@vuntz.net>
*/
#include <config.h>
#include "panel-menu-bar.h"
#include <string.h>
#include <glib/gi18n.h>
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
#include "applet.h"
#include "menu.h"
#include "panel-layout.h"
#include "panel-lockdown.h"
#include "panel-icon-names.h"
#include "panel-menu-bar-object.h"
#include "panel-menu-items.h"
#include "panel-util.h"
G_DEFINE_TYPE (PanelMenuBar, panel_menu_bar, PANEL_TYPE_MENU_BAR_OBJECT)
#define PANEL_MENU_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_MENU_BAR, PanelMenuBarPrivate))
struct _PanelMenuBarPrivate {
AppletInfo *info;
PanelWidget *panel;
GtkWidget *image;
GtkWidget *applications_menu;
GtkWidget *applications_item;
GtkWidget *places_item;
};
static gboolean
panel_menu_bar_reinit_tooltip (GtkWidget *widget,
PanelMenuBar *menubar)
{
g_object_set (menubar->priv->applications_item,
"has-tooltip", TRUE, NULL);
g_object_set (menubar->priv->places_item,
"has-tooltip", TRUE, NULL);
return FALSE;
}
static gboolean
panel_menu_bar_hide_tooltip_and_focus (GtkWidget *widget,
PanelMenuBar *menubar)
{
/* remove focus that would be drawn on the currently focused child of
* the toplevel. See bug#308632. */
gtk_window_set_focus (GTK_WINDOW (menubar->priv->panel->toplevel),
NULL);
g_object_set (widget, "has-tooltip", FALSE, NULL);
return FALSE;
}
static void
panel_menu_bar_setup_tooltip (PanelMenuBar *menubar)
{
panel_util_set_tooltip_text (menubar->priv->applications_item,
_("Browse and run installed applications"));
panel_util_set_tooltip_text (menubar->priv->places_item,
_("Access documents, folders and network places"));
//FIXME: this doesn't handle the right-click case. Sigh.
/* Hide tooltip if a menu is activated */
g_signal_connect (menubar->priv->applications_item,
"activate",
G_CALLBACK (panel_menu_bar_hide_tooltip_and_focus),
menubar);
g_signal_connect (menubar->priv->places_item,
"activate",
G_CALLBACK (panel_menu_bar_hide_tooltip_and_focus),
menubar);
/* Reset tooltip when the menu bar is not used */
g_signal_connect (GTK_MENU_SHELL (menubar),
"deactivate",
G_CALLBACK (panel_menu_bar_reinit_tooltip),
menubar);
}
static void
panel_menu_bar_init (PanelMenuBar *menubar)
{
gchar *applications_menu;
GtkIconSize icon_size;
GtkWidget *label;
GtkStyleContext *context;
menubar->priv = PANEL_MENU_BAR_GET_PRIVATE (menubar);
menubar->priv->info = NULL;
applications_menu = get_applications_menu ();
menubar->priv->applications_menu = create_applications_menu (applications_menu, NULL);
g_free (applications_menu);
menubar->priv->applications_item = panel_image_menu_item_new2 ();
gtk_menu_item_set_label (GTK_MENU_ITEM (menubar->priv->applications_item),
_("Applications"));
label = gtk_bin_get_child (GTK_BIN (menubar->priv->applications_item));
context = gtk_widget_get_style_context (label);
gtk_style_context_add_class (context, "gp-text-color");
icon_size = panel_menu_bar_object_icon_get_size ();
menubar->priv->image = gtk_image_new_from_icon_name (PANEL_ICON_MAIN_MENU, icon_size);
gtk_image_set_pixel_size (GTK_IMAGE (menubar->priv->image),
panel_menu_bar_object_icon_get_pixel_size (icon_size));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar->priv->applications_item),
menubar->priv->applications_menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar),
menubar->priv->applications_item);
gtk_widget_show (menubar->priv->applications_item);
menubar->priv->places_item = panel_place_menu_item_new (FALSE, TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar),
menubar->priv->places_item);
gtk_widget_show (menubar->priv->places_item);
panel_menu_bar_setup_tooltip (menubar);
}
static void
panel_menu_bar_parent_set (GtkWidget *widget,
GtkWidget *previous_parent)
{
PanelMenuBar *menubar = PANEL_MENU_BAR (widget);
GtkWidget *parent;
parent = gtk_widget_get_parent (widget);
g_assert (!parent || PANEL_IS_WIDGET (parent));
menubar->priv->panel = (PanelWidget *) parent;
}
static void
panel_menu_bar_style_updated (GtkWidget *widget)
{
PanelMenuBar *menubar = PANEL_MENU_BAR (widget);
gboolean visible;
GTK_WIDGET_CLASS (panel_menu_bar_parent_class)->style_updated (widget);
gtk_widget_style_get (widget, "icon-visible", &visible, NULL);
if (visible)
panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menubar->priv->applications_item), menubar->priv->image);
else
panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menubar->priv->applications_item), NULL);
}
static void
panel_menu_bar_class_init (PanelMenuBarClass *klass)
{
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
widget_class->parent_set = panel_menu_bar_parent_set;
widget_class->style_updated = panel_menu_bar_style_updated;
g_type_class_add_private (klass, sizeof (PanelMenuBarPrivate));
gtk_widget_class_install_style_property (
widget_class,
g_param_spec_boolean ("icon-visible",
"Icon visible",
"Whether the menubar icon is visible",
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
void
panel_menu_bar_load (PanelWidget *panel,
const char *id,
GSettings *settings)
{
PanelMenuBar *menubar;
g_return_if_fail (panel != NULL);
menubar = g_object_new (PANEL_TYPE_MENU_BAR, NULL);
menubar->priv->info = panel_applet_register (
GTK_WIDGET (menubar), panel,
PANEL_OBJECT_MENU_BAR, id,
settings,
NULL, NULL);
if (!menubar->priv->info) {
gtk_widget_destroy (GTK_WIDGET (menubar));
return;
}
if (panel_is_program_in_path ("alacarte") ||
panel_is_program_in_path ("gmenu-simple-editor")) {
panel_applet_add_callback (menubar->priv->info,
"edit",
_("_Edit Menus"),
panel_lockdown_get_not_panels_locked_down_s);
}
panel_menu_bar_style_updated (GTK_WIDGET (menubar));
panel_menu_bar_object_object_load_finish (PANEL_MENU_BAR_OBJECT (menubar),
panel);
}
void
panel_menu_bar_create (PanelToplevel *toplevel,
PanelObjectPackType pack_type,
int pack_index)
{
panel_layout_object_create (PANEL_OBJECT_MENU_BAR, NULL,
panel_toplevel_get_id (toplevel),
pack_type, pack_index);
}
void
panel_menu_bar_invoke_menu (PanelMenuBar *menubar,
const char *callback_name)
{
GdkScreen *screen;
g_return_if_fail (PANEL_IS_MENU_BAR (menubar));
g_return_if_fail (callback_name != NULL);
screen = gtk_widget_get_screen (GTK_WIDGET (menubar));
if (!strcmp (callback_name, "edit")) {
GError *error = NULL;
panel_launch_desktop_file_with_fallback ("alacarte.desktop",
"alacarte",
screen, &error);
if (error) {
g_error_free (error);
panel_launch_desktop_file_with_fallback (
"gmenu-simple-editor.desktop",
"gmenu-simple-editor",
screen, NULL);
}
}
}
void
panel_menu_bar_popup_menu (PanelMenuBar *menubar,
guint32 activate_time)
{
g_return_if_fail (PANEL_IS_MENU_BAR (menubar));
gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar),
menubar->priv->applications_item);
}
/*
* panel-menu-bar.h: panel Applications/Places/Desktop menu bar
*
* Copyright (C) 2003 Sun Microsystems, 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:
* Mark McLoughlin <mark@skynet.ie>
*/
#ifndef __PANEL_MENU_BAR_H__
#define __PANEL_MENU_BAR_H__
#include <gtk/gtk.h>
#include "panel-menu-bar-object.h"
#include "panel-widget.h"
G_BEGIN_DECLS
#define PANEL_TYPE_MENU_BAR (panel_menu_bar_get_type ())
#define PANEL_MENU_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PANEL_TYPE_MENU_BAR, PanelMenuBar))
#define PANEL_MENU_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PANEL_TYPE_MENU_BAR, PanelMenuBarClass))
#define PANEL_IS_MENU_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PANEL_TYPE_MENU_BAR))
#define PANEL_IS_MENU_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PANEL_TYPE_MENU_BAR))
#define PANEL_MENU_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PANEL_TYPE_MENU_BAR, PanelMenuBarClass))
typedef struct _PanelMenuBar PanelMenuBar;
typedef struct _PanelMenuBarClass PanelMenuBarClass;
typedef struct _PanelMenuBarPrivate PanelMenuBarPrivate;
struct _PanelMenuBar{
PanelMenuBarObject menubar;
PanelMenuBarPrivate *priv;
};
struct _PanelMenuBarClass {
PanelMenuBarObjectClass menubar_class;
};
GType panel_menu_bar_get_type (void) G_GNUC_CONST;
void panel_menu_bar_create (PanelToplevel *toplevel,
PanelObjectPackType pack_type,
int pack_index);
void panel_menu_bar_load (PanelWidget *panel,
const char *id,
GSettings *settings);
void panel_menu_bar_invoke_menu (PanelMenuBar *menubar,
const char *callback_name);
void panel_menu_bar_popup_menu (PanelMenuBar *menubar,
guint32 activate_time);
G_END_DECLS
#endif /* __PANEL_MENU_BAR_H__ */
......@@ -39,7 +39,6 @@
#include "launcher.h"
#include "panel-action-button.h"
#include "panel-applet-frame.h"
#include "panel-menu-bar.h"
#include "panel-menu-button.h"
#include "panel-user-menu.h"
......@@ -219,11 +218,6 @@ panel_object_loader_idle_handler (gpointer dummy)
object->settings,
object_type_detail);
break;
case PANEL_OBJECT_MENU_BAR:
panel_menu_bar_load (panel_widget,
object->id,
object->settings);
break;
case PANEL_OBJECT_USER_MENU:
panel_user_menu_load (panel_widget,
object->id,
......@@ -364,7 +358,6 @@ static struct {
gboolean has_detail;
} panel_object_iid_map[] = {
{ PANEL_OBJECT_ACTION, "ActionButton" , TRUE },
{ PANEL_OBJECT_MENU_BAR, "MenuBar" , FALSE },
{ PANEL_OBJECT_MENU, "MenuButton" , FALSE },
{ PANEL_OBJECT_LAUNCHER, "Launcher" , FALSE },
{ PANEL_OBJECT_USER_MENU, "UserMenu" , FALSE }
......
......@@ -32,7 +32,6 @@
#include "panel-util.h"
#include "panel-applet-frame.h"
#include "panel-action-button.h"
#include "panel-menu-bar.h"
#include "panel-multiscreen.h"
#include "panel-toplevel.h"
#include "panel-menu-button.h"
......@@ -82,7 +81,6 @@ orientation_change (AppletInfo *info,
case PANEL_OBJECT_ACTION:
button_widget_set_orientation (BUTTON_WIDGET (info->widget), orientation);
break;
case PANEL_OBJECT_MENU_BAR:
case PANEL_OBJECT_USER_MENU:
panel_menu_bar_object_set_orientation (PANEL_MENU_BAR_OBJECT (info->widget), orientation);
break;
......@@ -834,15 +832,6 @@ drop_internal_applet (PanelWidget *panel,
success = FALSE;
}
} else if (!strcmp (applet_type, "MENUBAR:NEW")) {
if (panel_layout_is_writable ()) {
panel_menu_bar_create (panel->toplevel,
pack_type, pack_index);
success = TRUE;
} else {
success = FALSE;
}
} else if (!strcmp (applet_type, "USERMENU:NEW")) {
if (panel_layout_is_writable ()) {
panel_user_menu_create (panel->toplevel,
......
......@@ -35,7 +35,6 @@ gnome-panel/panel-context-menu.c
gnome-panel/panel-ditem-editor.c
gnome-panel/panel-force-quit.c
gnome-panel/panel-layout.c
gnome-panel/panel-menu-bar.c
gnome-panel/panel-menu-button.c
gnome-panel/panel-menu-items.c
gnome-panel/panel-image-menu-item.c
......
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