Ejemplo n.º 1
0
/**
 * gtk_action_create_menu:
 * @action: a #GtkAction
 *
 * If @action provides a #GtkMenu widget as a submenu for the menu
 * item or the toolbar item it creates, this function returns an
 * instance of that menu.
 *
 * Return value: (transfer none): the menu item provided by the
 *               action, or %NULL.
 *
 * Since: 2.12
 */
GtkWidget *
gtk_action_create_menu (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  if (GTK_ACTION_GET_CLASS (action)->create_menu)
    return GTK_ACTION_GET_CLASS (action)->create_menu (action);

  return NULL;
}
Ejemplo n.º 2
0
static GtkWidget *
create_menu_item (GtkAction *action)
{
  NemoWidgetAction *widget_action;
  GType menu_item_type;
  GtkWidget *w, *ret;
  gint slot;

  widget_action = NEMO_WIDGET_ACTION (action);
  menu_item_type = GTK_ACTION_GET_CLASS (action)->menu_item_type;

  if (!widget_action->a_used) {
    w = widget_action->widget_a;
    widget_action->a_used = TRUE;
    slot = ACTION_SLOT_A;
  } else if (!widget_action->b_used) {
    w = widget_action->widget_b;
    widget_action->b_used = TRUE;
    slot = ACTION_SLOT_B;
  } else
    return NULL;

  ret = g_object_new (menu_item_type,
                      "child-widget", w,
                      "action-slot", slot,
                      NULL);

  gtk_activatable_set_related_action (GTK_ACTIVATABLE (ret), action);

  return ret;
}
Ejemplo n.º 3
0
void
_gtk_action_remove_from_proxy_list (GtkAction     *action,
				    GtkWidget     *proxy)
{
  g_return_if_fail (GTK_IS_ACTION (action));
  g_return_if_fail (GTK_IS_WIDGET (proxy));

  GTK_ACTION_GET_CLASS (action)->disconnect_proxy (action, proxy);
}
Ejemplo n.º 4
0
static GtkWidget *
create_tool_item (GtkAction *action)
{
  GType toolbar_item_type;

  toolbar_item_type = GTK_ACTION_GET_CLASS (action)->toolbar_item_type;

  return g_object_new (toolbar_item_type, NULL);
}
Ejemplo n.º 5
0
static GtkWidget *
create_menu_item (GtkAction *action)
{
  GType menu_item_type;

  menu_item_type = GTK_ACTION_GET_CLASS (action)->menu_item_type;

  return g_object_new (menu_item_type, NULL);
}
Ejemplo n.º 6
0
/**
 * gtk_action_create_tool_item:
 * @action: the action object
 *
 * Creates a toolbar item widget that proxies for the given action.
 *
 * Returns: (transfer none): a toolbar item connected to the action.
 *
 * Since: 2.4
 */
GtkWidget *
gtk_action_create_tool_item (GtkAction *action)
{
  GtkWidget *button;

  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  button = GTK_ACTION_GET_CLASS (action)->create_tool_item (action);

  gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), TRUE);
  gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);

  return button;
}
Ejemplo n.º 7
0
/**
 * gtk_action_create_menu_item:
 * @action: the action object
 *
 * Creates a menu item widget that proxies for the given action.
 *
 * Returns: (transfer none): a menu item connected to the action.
 *
 * Since: 2.4
 */
GtkWidget *
gtk_action_create_menu_item (GtkAction *action)
{
  GtkWidget *menu_item;

  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action);

  gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (menu_item), TRUE);
  gtk_activatable_set_related_action (GTK_ACTIVATABLE (menu_item), action);

  return menu_item;
}