Exemplo n.º 1
0
GtkActionGroup *
nautilus_window_create_toolbar_action_group (NautilusWindow *window)
{
	NautilusNavigationState *navigation_state;
	GtkActionGroup *action_group;
	GtkAction *action;

	action_group = gtk_action_group_new ("ToolbarActions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);

	action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
			       "name", NAUTILUS_ACTION_BACK,
			       "label", _("_Back"),
			       "stock_id", GTK_STOCK_GO_BACK,
			       "tooltip", _("Go to the previous visited location"),
			       "arrow-tooltip", _("Back history"),
			       "window", window,
			       "direction", NAUTILUS_NAVIGATION_DIRECTION_BACK,
			       "sensitive", FALSE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_back_callback), window);
	gtk_action_group_add_action (action_group, action);

	g_object_unref (action);

	action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
			       "name", NAUTILUS_ACTION_FORWARD,
			       "label", _("_Forward"),
			       "stock_id", GTK_STOCK_GO_FORWARD,
			       "tooltip", _("Go to the next visited location"),
			       "arrow-tooltip", _("Forward history"),
			       "window", window,
			       "direction", NAUTILUS_NAVIGATION_DIRECTION_FORWARD,
			       "sensitive", FALSE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_forward_callback), window);
	gtk_action_group_add_action (action_group, action);

	g_object_unref (action);

	action = GTK_ACTION
		(gtk_toggle_action_new (NAUTILUS_ACTION_SEARCH,
					_("Search"),
					_("Search documents and folders by name"),
					NULL));
	gtk_action_group_add_action (action_group, action);
	gtk_action_set_icon_name (GTK_ACTION (action), "edit-find-symbolic");
	gtk_action_set_is_important (GTK_ACTION (action), TRUE);

	g_object_unref (action);

	navigation_state = nautilus_window_get_navigation_state (window);
	nautilus_navigation_state_add_group (navigation_state, action_group);

	return action_group;
}
Exemplo n.º 2
0
GimpAction *
gimp_action_new (const gchar *name,
                 const gchar *label,
                 const gchar *tooltip,
                 const gchar *stock_id)
{
  GimpAction *action;

  action = g_object_new (GIMP_TYPE_ACTION,
                         "name",     name,
                         "label",    label,
                         "tooltip",  tooltip,
                         "stock-id", stock_id,
                         NULL);

  if (stock_id)
    {
      if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), stock_id))
        gtk_action_set_icon_name (GTK_ACTION (action), stock_id);
    }

  return action;
}
Exemplo n.º 3
0
static GList*
thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
                                      GtkWidget           *window,
                                      GList               *files)
{
  GtkTreeRowReference *row;
  ThunarUcaProvider   *uca_provider = THUNAR_UCA_PROVIDER (menu_provider);
  ThunarUcaContext    *uca_context = NULL;
  GtkTreeIter          iter;
  GtkAction           *action;
  GList               *actions = NULL;
  GList               *paths;
  GList               *lp;
  gchar               *icon_name;
  gchar               *tooltip;
  gchar               *label;
  gchar               *name;

  paths = thunar_uca_model_match (uca_provider->model, files);
  for (lp = g_list_last (paths); lp != NULL; lp = lp->prev)
    {
      /* try to lookup the tree iter for the specified tree path */
      if (gtk_tree_model_get_iter (GTK_TREE_MODEL (uca_provider->model), &iter, lp->data))
        {
          /* determine the label, tooltip and stock-id for the item */
          gtk_tree_model_get (GTK_TREE_MODEL (uca_provider->model), &iter,
                              THUNAR_UCA_MODEL_COLUMN_NAME, &label,
                              THUNAR_UCA_MODEL_COLUMN_ICON, &icon_name,
                              THUNAR_UCA_MODEL_COLUMN_DESCRIPTION, &tooltip,
                              -1);

          /* generate a unique action name */
          name = g_strdup_printf ("ThunarUca::action-%d", ++uca_provider->last_action_id);

          /* create the new action with the given parameters */
          action = gtk_action_new (name, label, tooltip, NULL);
#if GTK_CHECK_VERSION (2, 16, 0)
          gtk_action_set_icon_name (action, icon_name);
#else
          g_object_set (G_OBJECT (action), "icon-name", icon_name, NULL);
#endif

          /* grab a tree row reference on the given path */
          row = gtk_tree_row_reference_new (GTK_TREE_MODEL (uca_provider->model), lp->data);
          g_object_set_qdata_full (G_OBJECT (action), thunar_uca_row_quark, row,
                                   (GDestroyNotify) gtk_tree_row_reference_free);

          /* allocate a new context on-demand */
          if (G_LIKELY (uca_context == NULL))
            uca_context = thunar_uca_context_new (window, files);
          else
            uca_context = thunar_uca_context_ref (uca_context);
          g_object_set_qdata_full (G_OBJECT (action), thunar_uca_context_quark, uca_context, (GDestroyNotify) thunar_uca_context_unref);

          /* connect the "activate" signal */
          g_signal_connect_data (G_OBJECT (action), "activate", G_CALLBACK (thunar_uca_provider_activated),
                                 g_object_ref (G_OBJECT (uca_provider)), (GClosureNotify) g_object_unref,
                                 G_CONNECT_SWAPPED);

          /* add the action to the return list */
          actions = g_list_prepend (actions, action);

          /* cleanup */
          g_free (icon_name);
          g_free (tooltip);
          g_free (label);
          g_free (name);
        }

      /* release the tree path */
      gtk_tree_path_free (lp->data);
    }
  g_list_free (paths);

  return actions;
}
Exemplo n.º 4
0
void
ghb_queue_buttons_grey(signal_user_data_t *ud)
{
    GtkWidget *widget;
    GtkAction *action;
    gint queue_count;
    gint titleindex;
    gint queue_state, scan_state;
    gboolean show_start, show_stop, paused;

    queue_count = ghb_array_len(ud->queue);
    titleindex = ghb_settings_combo_int(ud->settings, "title");

    queue_state = ghb_get_queue_state();
    scan_state = ghb_get_scan_state();

    show_stop = queue_state & 
                (GHB_STATE_WORKING | GHB_STATE_SEARCHING | 
                 GHB_STATE_SCANNING | GHB_STATE_MUXING);
    show_start = !(scan_state & GHB_STATE_SCANNING) && 
                    (titleindex >= 0 || queue_count > 0);


    paused = queue_state & GHB_STATE_PAUSED;

    widget = GHB_WIDGET(ud->builder, "queue_add");
    gtk_widget_set_sensitive(widget, show_start);
    action = GHB_ACTION(ud->builder, "queue_add_menu");
    gtk_action_set_sensitive(action, show_start);
    action = GHB_ACTION(ud->builder, "queue_add_all_menu");
    gtk_action_set_sensitive(action, show_start);

    widget = GHB_WIDGET (ud->builder, "queue_start1");
    if (show_stop)
    {
        gtk_widget_set_sensitive (widget, TRUE);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_start);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_start2");
    if (show_stop)
    {
        gtk_widget_set_sensitive (widget, TRUE);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_start);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_pause1");
    if (paused)
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_pause2");
    if (paused)
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
    }

    action = GHB_ACTION (ud->builder, "queue_start_menu");
    if (show_stop)
    {
        gtk_action_set_sensitive (action, TRUE);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-stop");
        gtk_action_set_label(action, "S_top Queue");
        gtk_action_set_tooltip(action, "Stop Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                            ghb_string_value("hb-stop"));
        g_object_set_property(G_OBJECT(action), "label",
                                            ghb_string_value("S_top Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                            ghb_string_value("Stop Encoding"));
#endif
    }
    else
    {
        gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-start");
        gtk_action_set_label(action, "_Start Queue");
        gtk_action_set_tooltip(action, "Start Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                            ghb_string_value("hb-start"));
        g_object_set_property(G_OBJECT(action), "label",
                                            ghb_string_value("_Start Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                            ghb_string_value("Start Encoding"));
#endif
    }
    action = GHB_ACTION (ud->builder, "queue_pause_menu");
    if (paused)
    {
        gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-start");
        gtk_action_set_label(action, "_Resume Queue");
        gtk_action_set_tooltip(action, "Resume Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                        ghb_string_value("hb-start"));
        g_object_set_property(G_OBJECT(action), "label",
                                        ghb_string_value("_Resume Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                        ghb_string_value("Resume Encoding"));
#endif
    }
    else
    {
        gtk_action_set_sensitive (action, show_stop);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-pause");
        gtk_action_set_label(action, "_Pause Queue");
        gtk_action_set_tooltip(action, "Pause Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                        ghb_string_value("hb-pause"));
        g_object_set_property(G_OBJECT(action), "label",
                                        ghb_string_value("_Pause Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                        ghb_string_value("Pause Encoding"));
#endif
    }
}
Exemplo n.º 5
0
static void
gtk_action_set_property (GObject         *object,
			 guint            prop_id,
			 const GValue    *value,
			 GParamSpec      *pspec)
{
  GtkAction *action;
  
  action = GTK_ACTION (object);

  switch (prop_id)
    {
    case PROP_NAME:
      action->private_data->name = g_intern_string (g_value_get_string (value));
      break;
    case PROP_LABEL:
      gtk_action_set_label (action, g_value_get_string (value));
      break;
    case PROP_SHORT_LABEL:
      gtk_action_set_short_label (action, g_value_get_string (value));
      break;
    case PROP_TOOLTIP:
      gtk_action_set_tooltip (action, g_value_get_string (value));
      break;
    case PROP_STOCK_ID:
      gtk_action_set_stock_id (action, g_value_get_string (value));
      break;
    case PROP_GICON:
      gtk_action_set_gicon (action, g_value_get_object (value));
      break;
    case PROP_ICON_NAME:
      gtk_action_set_icon_name (action, g_value_get_string (value));
      break;
    case PROP_VISIBLE_HORIZONTAL:
      gtk_action_set_visible_horizontal (action, g_value_get_boolean (value));
      break;
    case PROP_VISIBLE_VERTICAL:
      gtk_action_set_visible_vertical (action, g_value_get_boolean (value));
      break;
    case PROP_VISIBLE_OVERFLOWN:
      action->private_data->visible_overflown = g_value_get_boolean (value);
      break;
    case PROP_IS_IMPORTANT:
      gtk_action_set_is_important (action, g_value_get_boolean (value));
      break;
    case PROP_HIDE_IF_EMPTY:
      action->private_data->hide_if_empty = g_value_get_boolean (value);
      break;
    case PROP_SENSITIVE:
      gtk_action_set_sensitive (action, g_value_get_boolean (value));
      break;
    case PROP_VISIBLE:
      gtk_action_set_visible (action, g_value_get_boolean (value));
      break;
    case PROP_ACTION_GROUP:
      gtk_action_set_action_group (action, g_value_get_object (value));
      break;
    case PROP_ALWAYS_SHOW_IMAGE:
      gtk_action_set_always_show_image (action, g_value_get_boolean (value));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Exemplo n.º 6
0
GtkActionGroup *
nemo_window_create_toolbar_action_group (NemoWindow *window)
{
	gboolean show_label_search_icon_toolbar;

	NemoNavigationState *navigation_state;
	GtkActionGroup *action_group;
	GtkAction *action;

	action_group = gtk_action_group_new ("ToolbarActions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);

	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
			       "name", NEMO_ACTION_BACK,
			       "label", _("_Back"),
			       "stock_id", GTK_STOCK_GO_BACK,
			       "tooltip", _("Go to the previous visited location"),
			       "arrow-tooltip", _("Back history"),
			       "window", window,
			       "direction", NEMO_NAVIGATION_DIRECTION_BACK,
			       "sensitive", FALSE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_back_callback), window);
	gtk_action_group_add_action (action_group, action);

	g_object_unref (action);

	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
			       "name", NEMO_ACTION_FORWARD,
			       "label", _("_Forward"),
			       "stock_id", GTK_STOCK_GO_FORWARD,
			       "tooltip", _("Go to the next visited location"),
			       "arrow-tooltip", _("Forward history"),
			       "window", window,
			       "direction", NEMO_NAVIGATION_DIRECTION_FORWARD,
			       "sensitive", FALSE,
			       NULL);
	g_signal_connect (action, "activate",
			  G_CALLBACK (action_forward_callback), window);
	gtk_action_group_add_action (action_group, action);

	g_object_unref (action);

	/**
	 * Nemo 2.30/2.32 type actions
	 */
   	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
   			       "name", NEMO_ACTION_UP,
   			       "label", _("_Up"),
   			       "stock_id", GTK_STOCK_GO_UP,
   			       "tooltip", _("Go to parent folder"),
   			       "arrow-tooltip", _("Forward history"),
   			       "window", window,
   			       "direction", NEMO_NAVIGATION_DIRECTION_UP,
   			       NULL);
   	g_signal_connect (action, "activate",
   			  G_CALLBACK (action_up_callback), window);
   	gtk_action_group_add_action (action_group, action);
   
   	g_object_unref (action);
  
   	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
   			       "name", NEMO_ACTION_RELOAD,
   			       "label", _("_Reload"),
   			       "stock_id", GTK_STOCK_REFRESH,
   			       "tooltip", _("Reload the current location"),
   			       "window", window,
   			       "direction", NEMO_NAVIGATION_DIRECTION_RELOAD,
   			       NULL);
   	g_signal_connect (action, "activate",
   			  G_CALLBACK (action_reload_callback), window);
   	gtk_action_group_add_action (action_group, action);
   	
   	g_object_unref (action);
   
   	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
   			       "name", NEMO_ACTION_HOME,
   			       "label", _("_Home"),
   			       "stock_id", GTK_STOCK_HOME,
   			       "tooltip", _("Go to home directory"),
   			       "window", window,
   			       "direction", NEMO_NAVIGATION_DIRECTION_HOME,
   			       NULL);
   	g_signal_connect (action, "activate",
   			  G_CALLBACK (action_home_callback), window);
   	gtk_action_group_add_action (action_group, action);
   
   	g_object_unref (action);
   
   	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
   			       "name", NEMO_ACTION_COMPUTER,
   			       "label", _("_Computer"),
   			       "icon_name", "computer",
   			       "tooltip", _("Go to Computer"),
   			       "window", window,
   			       "direction", NEMO_NAVIGATION_DIRECTION_COMPUTER,
   			       NULL);
   	g_signal_connect (action, "activate",
   			  G_CALLBACK (action_go_to_computer_callback), window);
   	gtk_action_group_add_action (action_group, action);
   
   	g_object_unref (action);
 
   	action = g_object_new (NEMO_TYPE_NAVIGATION_ACTION,
   			       "name", NEMO_ACTION_EDIT_LOCATION,
   			       "label", _("Location"),
   			       "stock_id", GTK_STOCK_EDIT,
   			       "tooltip", _("Toggle Location bar / Path bar"),
   			       "window", window,
    			       "direction", NEMO_NAVIGATION_DIRECTION_EDIT,
   			       NULL);
   	g_signal_connect (action, "activate",
   			  G_CALLBACK (action_edit_location_callback), window);
   	gtk_action_group_add_action (action_group, action);
  
   	g_object_unref (action);

 	action = GTK_ACTION (gtk_toggle_action_new (NEMO_ACTION_SEARCH,
 				_("Search"),_("Search documents and folders by name"),
 				NULL));
 
  	gtk_action_group_add_action (action_group, action);
  	gtk_action_set_icon_name (GTK_ACTION (action), "edit-find");
 
 
 	show_label_search_icon_toolbar = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_LABEL_SEARCH_ICON_TOOLBAR);
 	gtk_action_set_is_important (GTK_ACTION (action), show_label_search_icon_toolbar);
  
  	g_object_unref (action);

	navigation_state = nemo_window_get_navigation_state (window);
	nemo_navigation_state_add_group (navigation_state, action_group);

	return action_group;
}
Exemplo n.º 7
0
static void
nautilus_toolbar_constructed (GObject *obj)
{
	NautilusToolbar *self = NAUTILUS_TOOLBAR (obj);
	GtkWidget *toolbar;
	GtkWidget *button;
	GtkWidget *menu;
	GtkWidget *box;
	GtkWidget *separator;
	GtkUIManager *ui_manager;
	gboolean rtl;

	G_OBJECT_CLASS (nautilus_toolbar_parent_class)->constructed (obj);

	gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
				     "header-bar");

	self->priv->toolbar = toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_set (toolbar, "margin", 8, NULL);
	gtk_container_add (GTK_CONTAINER (self), toolbar);

	rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;

	ui_manager = nautilus_window_get_ui_manager (self->priv->window);

	gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)),
					      GTK_JUNCTION_BOTTOM);

	/* Back and Forward */
	box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

	/* Back */
	button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_BACK, NULL);
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)),
				  rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic");
	navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_BACK);
	gtk_container_add (GTK_CONTAINER (box), button);

	/* Forward */
	button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_FORWARD, NULL);
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)),
				  rtl ? "go-next-rtl-symbolic" : "go-next-symbolic");
	navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_FORWARD);
	gtk_container_add (GTK_CONTAINER (box), button);

	gtk_style_context_add_class (gtk_widget_get_style_context (box),
				     GTK_STYLE_CLASS_RAISED);
	gtk_style_context_add_class (gtk_widget_get_style_context (box),
				     GTK_STYLE_CLASS_LINKED);

	gtk_box_pack_start (GTK_BOX (toolbar), box, FALSE, FALSE, 0);

	if (rtl) {
		gtk_widget_set_margin_left (box, 12);
	} else {
		gtk_widget_set_margin_right (box, 12);
	}

	/* regular path bar */
	box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

	self->priv->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
	gtk_box_pack_start (GTK_BOX (box), self->priv->path_bar, TRUE, TRUE, 0);

	/* entry-like location bar */
	self->priv->location_entry = nautilus_location_entry_new ();
	gtk_box_pack_start (GTK_BOX (box), self->priv->location_entry, TRUE, TRUE, 0);

	gtk_box_pack_start (GTK_BOX (toolbar), box, TRUE, TRUE, 0);

	/* search */
	button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_SEARCH, NULL);
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_container_add (GTK_CONTAINER (toolbar), button);
	if (rtl) {
		gtk_widget_set_margin_right (button, 76);
	} else {
		gtk_widget_set_margin_left (button, 76);
	}

	/* View buttons */
	box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

	button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_LIST, NULL);
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_container_add (GTK_CONTAINER (box), button);
	button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_GRID, NULL);
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_container_add (GTK_CONTAINER (box), button);
	button = toolbar_create_toolbutton (self, TRUE, FALSE, "go-down-symbolic", _("View options"));
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	gtk_container_add (GTK_CONTAINER (box), button);
	menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenu");
	gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);

	gtk_style_context_add_class (gtk_widget_get_style_context (box),
				     GTK_STYLE_CLASS_RAISED);
	gtk_style_context_add_class (gtk_widget_get_style_context (box),
				     GTK_STYLE_CLASS_LINKED);

	gtk_container_add (GTK_CONTAINER (toolbar), box);
	if (rtl) {
		gtk_widget_set_margin_right (box, 12);
	} else {
		gtk_widget_set_margin_left (box, 12);
	}

	/* Action Menu */
	button = toolbar_create_toolbutton (self, TRUE, FALSE, "emblem-system-symbolic", _("Location options"));
	gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
	menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu");
	gtk_widget_set_halign (menu, GTK_ALIGN_END);
	gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
	gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.gear-menu");
        g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self);

	gtk_container_add (GTK_CONTAINER (toolbar), button);
	if (rtl) {
		gtk_widget_set_margin_right (button, 12);
	} else {
		gtk_widget_set_margin_left (button, 12);
	}

	/* Separator and Close */
	separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
	gtk_container_add (GTK_CONTAINER (toolbar), separator);

	if (rtl) {
		gtk_widget_set_margin_right (separator, 8);
	} else {
		gtk_widget_set_margin_left (separator, 8);
	}

	button = gtk_button_new_from_icon_name ("window-close-symbolic",
						GTK_ICON_SIZE_MENU);
	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
	g_signal_connect (button, "clicked",
			  G_CALLBACK (close_button_clicked), self);
	gtk_container_add (GTK_CONTAINER (toolbar), button);

	if (rtl) {
		gtk_widget_set_margin_right (button, 6);
	} else {
		gtk_widget_set_margin_left (button, 6);
	}

	g_signal_connect_swapped (nautilus_preferences,
				  "changed::" NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
				  G_CALLBACK (toolbar_update_appearance), self);

	gtk_widget_show_all (toolbar);
	toolbar_update_appearance (self);
}