static void
panel_menu_bar_object_size_allocate (GtkWidget     *widget,
                                     GtkAllocation *allocation)
{
    GtkAllocation    old_allocation;
    GtkAllocation    widget_allocation;
    PanelBackground *background;

    gtk_widget_get_allocation (widget, &widget_allocation);

    old_allocation.x      = widget_allocation.x;
    old_allocation.y      = widget_allocation.y;
    old_allocation.width  = widget_allocation.width;
    old_allocation.height = widget_allocation.height;

    GTK_WIDGET_CLASS (panel_menu_bar_object_parent_class)->size_allocate (widget, allocation);

    if (old_allocation.x      == allocation->x &&
            old_allocation.y      == allocation->y &&
            old_allocation.width  == allocation->width &&
            old_allocation.height == allocation->height)
        return;

    background = &PANEL_MENU_BAR_OBJECT (widget)->priv->panel->background;

    if (background->type == PANEL_BACK_NONE ||
            (background->type == PANEL_BACK_COLOR && !background->has_alpha))
        return;

    panel_menu_bar_object_change_background (PANEL_MENU_BAR_OBJECT (widget));
}
Пример #2
0
void
orientation_change (AppletInfo  *info,
		    PanelWidget *panel)
{
	PanelOrientation orientation;

	orientation = panel_widget_get_applet_orientation (panel);

	switch (info->type) {
	case PANEL_OBJECT_APPLET:
		panel_applet_frame_change_orientation (
				PANEL_APPLET_FRAME (info->widget), orientation);
		break;
	case PANEL_OBJECT_MENU:
	case PANEL_OBJECT_LAUNCHER:
	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;
	case PANEL_OBJECT_SEPARATOR:
		panel_separator_set_orientation (PANEL_SEPARATOR (info->widget),
						 orientation);
		break;
	default:
		break;
	}
}
Пример #3
0
void
back_change (AppletInfo  *info,
	     PanelWidget *panel)
{
	switch (info->type) {
	case PANEL_OBJECT_APPLET:
		panel_applet_frame_change_background (
			PANEL_APPLET_FRAME (info->widget), panel->background.type);
		break;
	case PANEL_OBJECT_MENU_BAR:
	case PANEL_OBJECT_USER_MENU:
		panel_menu_bar_object_change_background (PANEL_MENU_BAR_OBJECT (info->widget));
		break;
	case PANEL_OBJECT_SEPARATOR:
		panel_separator_change_background (PANEL_SEPARATOR (info->widget));
		break;
	default:
		break;
	}
}
static void
panel_menu_bar_object_get_property (GObject	*object,
                                    guint	 prop_id,
                                    GValue	*value,
                                    GParamSpec	*pspec)
{
    PanelMenuBarObject *menubar;

    g_return_if_fail (PANEL_IS_MENU_BAR_OBJECT (object));

    menubar = PANEL_MENU_BAR_OBJECT (object);

    switch (prop_id) {
    case PROP_ORIENTATION:
        g_value_set_enum (value, menubar->priv->orientation);
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
Пример #5
0
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",
					   NULL,
					   _("_Edit Menus"),
					   panel_lockdown_get_not_panels_locked_down_s);
	}

	panel_applet_add_callback (menubar->priv->info,
				   "help",
				   GTK_STOCK_HELP,
				   _("_Help"),
				   NULL);

	panel_menu_bar_object_object_load_finish (PANEL_MENU_BAR_OBJECT (menubar),
						  panel);
}
Пример #6
0
void
panel_user_menu_load (PanelWidget *panel,
		     const char  *id,
		     GSettings   *settings)
{
	PanelUserMenu *usermenu;

	g_return_if_fail (panel != NULL);

	usermenu = g_object_new (PANEL_TYPE_USER_MENU, NULL);

	usermenu->priv->info = panel_applet_register (
					GTK_WIDGET (usermenu), panel,
					PANEL_OBJECT_USER_MENU, id,
					settings,
					NULL, NULL);
	if (!usermenu->priv->info) {
		gtk_widget_destroy (GTK_WIDGET (usermenu));
		return;
	}

	panel_menu_bar_object_object_load_finish (PANEL_MENU_BAR_OBJECT (usermenu),
						  panel);
}