Пример #1
0
static void
assistant_instert_book_options_page (hierarchy_data *data)
{
    GtkWidget *vbox = gtk_vbox_new (FALSE, 0);

    data->options = gnc_option_db_new_for_type (QOF_ID_BOOK);
    qof_book_load_options (gnc_get_current_book (),
			   gnc_option_db_load, data->options);
    gnc_option_db_clean (data->options);

    data->optionwin = gnc_options_dialog_new_modal (TRUE, _("New Book Options"));
    gnc_options_dialog_build_contents_full (data->optionwin, data->options, FALSE);

    gnc_options_dialog_set_close_cb (data->optionwin,
                                     book_options_dialog_close_cb,
                                     (gpointer)data->options);
    gnc_options_dialog_set_new_book_option_values (data->options);

    gtk_widget_reparent (gnc_options_dialog_notebook (data->optionwin), vbox);
    gtk_widget_show_all (vbox);
    gtk_assistant_insert_page (GTK_ASSISTANT(data->dialog), vbox, 2);
    gtk_assistant_set_page_title (GTK_ASSISTANT(data->dialog), vbox, _("New Book Options"));
    gtk_assistant_set_page_complete (GTK_ASSISTANT(data->dialog), vbox, TRUE);

}
static GObject *
cc_keyboard_panel_constructor (GType                  gtype,
                               guint                  n_properties,
                               GObjectConstructParam *properties)
{
  GObject *obj;
  CcKeyboardPanel *self;
  CcKeyboardPanelPrivate *priv;
  GtkWidget *widget;

  obj = G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->constructor (gtype, n_properties, properties);

  self = CC_KEYBOARD_PANEL (obj);
  priv = self->priv;

  keyboard_general_init (CC_PANEL (self), priv->builder);
  keyboard_shortcuts_init (CC_PANEL (self), priv->builder);

  widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
                                                 "keyboard_notebook");

  gtk_widget_reparent (widget, (GtkWidget *) self);

  return obj;
}
Пример #3
0
void iupdrvReparent(Ihandle* ih)
{
  GtkFixed* fixed = gtkGetFixedParent(ih);
  GtkWidget* widget = (GtkWidget*)iupAttribGet(ih, "_IUP_EXTRAPARENT");
  if (!widget) widget = ih->handle;
  gtk_widget_reparent(widget, (GtkWidget*)fixed);
}
static void
carrick_list_drag_begin (GtkWidget      *widget,
                         GdkDragContext *context,
                         CarrickList    *list)
{
  CarrickListPrivate *priv = list->priv;
  gint                x, y;

  carrick_service_item_set_active (CARRICK_SERVICE_ITEM (widget), FALSE);

  /* save old place in list for drag-failures */
  gtk_container_child_get (GTK_CONTAINER (priv->box),
                           widget,
                           "position", &priv->drag_position,
                           NULL);
  priv->drop_position = priv->drag_position;

  /* remove widget from list and setup dnd popup window */
  priv->drag_window = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_widget_set_size_request (priv->drag_window,
                               widget->allocation.width,
                               widget->allocation.height);
  gtk_widget_get_pointer (widget, &x, &y);
  gtk_widget_reparent (widget, priv->drag_window);
  gtk_drag_set_icon_widget (context,
                            priv->drag_window,
                            x, y);
}
Пример #5
0
// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
    gtk_tool_item_set_homogeneous(m_item, false);
    GtkWidget* box;
    GtkWidget* arrow;
    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
    {
        box = gtk_vbox_new(false, 0);
        arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
    }
    else
    {
        box = gtk_hbox_new(false, 0);
        arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
    }
    GtkWidget* tool_button = GTK_BIN(m_item)->child;
    gtk_widget_reparent(tool_button, box);
    GtkWidget* arrow_button = gtk_toggle_button_new();
    gtk_button_set_relief(GTK_BUTTON(arrow_button),
        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
    gtk_container_add(GTK_CONTAINER(box), arrow_button);
    gtk_widget_show_all(box);
    gtk_container_add(GTK_CONTAINER(m_item), box);

    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
    g_signal_connect(arrow_button, "button_press_event",
        G_CALLBACK(arrow_button_press_event), this);
}
Пример #6
0
void gMainWindow::embedMenuBar(GtkWidget *border)
{
	if (menuBar)
	{
		// layout is automatically destroyed ?
		layout = GTK_FIXED(gtk_fixed_new());

		g_object_ref(G_OBJECT(menuBar));
		
		if (gtk_widget_get_parent(GTK_WIDGET(menuBar)))
			gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(GTK_WIDGET(menuBar))), GTK_WIDGET(menuBar));
	
		gtk_fixed_put(layout, GTK_WIDGET(menuBar), 0, 0);

		g_object_unref(G_OBJECT(menuBar));
	
		gtk_widget_reparent(widget, GTK_WIDGET(layout));
		gtk_container_add(GTK_CONTAINER(border), GTK_WIDGET(layout));
	
		gtk_widget_show(GTK_WIDGET(menuBar));
		gtk_widget_show(GTK_WIDGET(layout));
		gtk_widget_show(GTK_WIDGET(widget));
		
		gMenu::updateFont(this);
		gMenu::updateColor(this);
		
		checkMenuBar();
	}
}
Пример #7
0
void wxFrame::SetToolBar(wxToolBar *toolbar)
{
    bool hadTbar = m_frameToolBar != NULL;

    wxFrameBase::SetToolBar(toolbar);

    if ( m_frameToolBar )
    {
        // insert into toolbar area if not already there
        if ((m_frameToolBar->m_widget->parent) &&
            (m_frameToolBar->m_widget->parent != m_mainWidget))
        {
            GetChildren().DeleteObject( m_frameToolBar );

            gtk_widget_reparent( m_frameToolBar->m_widget, m_mainWidget );
            GtkUpdateSize();
        }
    }
    else // toolbar unset
    {
        // still need to update size if it had been there before
        if ( hadTbar )
        {
            GtkUpdateSize();
        }
    }
}
Пример #8
0
static void
main_window_init (MainWindow *app)
{
    GtkBuilder *builder;
    GError     *error = NULL;
    GtkBox *main_window_outer_vbox;

    builder = gtk_builder_new();
    if(!gtk_builder_add_from_file(builder, UI_FILE, &error))
    {
        g_warning("%s", error->message);
        exit(1);
    }

    main_window_outer_vbox = GTK_BOX(gtk_builder_get_object(builder, "main_window_outer_vbox"));
    gtk_widget_reparent(GTK_WIDGET(main_window_outer_vbox), GTK_WIDGET(app));

    ui->connect_dialog = GTK_WIDGET(gtk_builder_get_object(builder,"connect_dialog"));
    ui->connect_server_combobox_entry = GTK_ENTRY(gtk_builder_get_object(builder,"connect_server_combobox_entry"));
    ui->connect_username_combobox_entry = GTK_ENTRY(gtk_builder_get_object(builder,"connect_username_combobox_entry"));
    gtk_builder_connect_signals(builder, NULL);
    g_object_unref(G_OBJECT(builder));

    gtk_widget_show(GTK_WIDGET(main_window_outer_vbox));
}
Пример #9
0
/**
 * go_combo_popup_reparent
 * @popup:       Popup
 * @new_parent:  New parent
 * @unrealize:   Unrealize popup if TRUE.
 *
 * Reparent the popup, taking care of the refcounting
 *
 * Compare with gtk_menu_reparent in gtk/gtkmenu.c
 */
static void
go_combo_popup_reparent (GtkWidget *popup,
			 GtkWidget *new_parent,
			 gboolean unrealize)
{
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
	gboolean was_floating = g_object_is_floating (popup);
	g_object_ref_sink (popup);
#else
	gboolean was_floating = GTK_OBJECT_FLOATING (popup);
	g_object_ref (popup);
	gtk_object_sink (GTK_OBJECT (popup));
#endif

	if (unrealize) {
		g_object_ref (popup);
		gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
		gtk_container_add (GTK_CONTAINER (new_parent), popup);
		g_object_unref (popup);
	}
	else
		gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
	gtk_widget_set_size_request (new_parent, -1, -1);

	if (was_floating) {
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
		g_object_force_floating (G_OBJECT (popup));
#else
		GTK_OBJECT_SET_FLAGS (GTK_OBJECT (popup), GTK_FLOATING);
#endif
	} else
		g_object_unref (popup);
}
Пример #10
0
static void
set_xml_string(GelUIGeneric *self, const gchar *xml_string)
{
	g_return_if_fail(GEL_UI_IS_GENERIC(self));
	g_return_if_fail(xml_string != NULL);

	GelUIGenericPrivate *priv = self->priv;
	g_return_if_fail(priv->builder == NULL);

	priv->builder = gtk_builder_new();

	GError *error = NULL;
	if (!gtk_builder_add_from_string(priv->builder, xml_string, -1, &error))
	{
		g_warning(_("Cannot load UI from string: %s"), error->message);
		g_error_free(error);
		return;
	}

	GtkWidget *w = GTK_WIDGET(gtk_builder_get_object(priv->builder, "main-widget"));
	if (w == NULL)
	{
		g_warning(_("Cannot find widget 'main-widget' on UI"));
		return;
	}

	gtk_widget_reparent(w, (GtkWidget *) self);
	gtk_box_set_child_packing ((GtkBox *) self, w, TRUE, TRUE, 0, GTK_PACK_START);

	g_object_notify(G_OBJECT(self), "xml-string");
}
static void
cc_region_panel_init (CcRegionPanel * self)
{
	CcRegionPanelPrivate *priv;
	GtkWidget *prefs_widget;
	const char *desktop;
	GError *error = NULL;

	priv = self->priv = REGION_PANEL_PRIVATE (self);

	desktop = g_getenv ("XDG_CURRENT_DESKTOP");

	priv->builder = gtk_builder_new ();
	gtk_builder_add_from_file (priv->builder,
				   CINNAMONCC_UI_DIR "/cinnamon-region-panel.ui",
				   &error);
	if (error != NULL) {
		g_warning ("Error loading UI file: %s", error->message);
		g_error_free (error);
		return;
	}

    prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "vbox1");

	gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);

	gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));

    setup_xkb_tabs (priv->builder);
        
}
Пример #12
0
// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
    gtk_tool_item_set_homogeneous(m_item, false);
    GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
    GtkArrowType arrowType = GTK_ARROW_DOWN;
    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
    {
        orient = GTK_ORIENTATION_VERTICAL;
        arrowType = GTK_ARROW_RIGHT;
    }
    GtkWidget* box = gtk_box_new(orient, 0);
    GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
    GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
    gtk_widget_reparent(tool_button, box);
    GtkWidget* arrow_button = gtk_toggle_button_new();
    gtk_button_set_relief(GTK_BUTTON(arrow_button),
        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
    gtk_container_add(GTK_CONTAINER(box), arrow_button);
    gtk_widget_show_all(box);
    gtk_container_add(GTK_CONTAINER(m_item), box);

    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
    g_signal_connect(arrow_button, "button_press_event",
        G_CALLBACK(arrow_button_press_event), this);
}
Пример #13
0
GtkWidget *
mca_info_panel_init (MCAInfoPanel *g_ipnl, cmd_callback_t exec_ipnl_event,
		     status_callback_t proc_status)
{
  GtkWidget *panel, *event_box;
  
  ipnl = g_ipnl;
  ipnl->notify_timeout = 15;
  ipnl->wnd_exit = exit_wnd_create(ipnl);
  ipnl->wnd_help = help_wnd_create(ipnl);
  ipnl->event_cb = exec_ipnl_event;
  ipnl->status_cb = proc_status;
	//ipnl->tray_icon = init_status_icon(ipnl);
	ipnl->tray_icon = tray_icon_create(ipnl);
	ipnl->is_wnd_help_up = FALSE;
	ipnl->is_wnd_exit_up = FALSE;
	ipnl->is_wnd_panel_up = FALSE;

  panel = info_panel_internal_create(ipnl);
  /*if (!info_panel_menu_init(panel)){
    g_print("Unable to init menu\n");
		}*/
  event_box = gtk_event_box_new ();
  //gtk_container_add (GTK_CONTAINER (event_box), image);
  /*  g_signal_connect (G_OBJECT (event_box), 
		    "button_press_event",
		    G_CALLBACK (info_panel_on_button_press),
		    panel);
  */
  gtk_widget_reparent(GTK_WIDGET(panel), GTK_WIDGET(event_box));

	ipnl->wnd_ipnl = mca_info_panel_host(event_box);

  return event_box;
}
Пример #14
0
void wxFrame::SetToolBar(wxToolBar *toolbar)
{
    m_frameToolBar = toolbar;
    if (toolbar)
    {
        if (toolbar->IsVertical())
        {
            // Vertical toolbar and m_wxwindow go into an hbox, inside the
            // vbox (m_mainWidget). hbox is created on demand.
            GtkWidget* hbox = gtk_widget_get_parent(m_wxwindow);
            if (!GTK_IS_HBOX(hbox))
            {
                hbox = gtk_hbox_new(false, 0);
                gtk_widget_show(hbox);
                gtk_container_add(GTK_CONTAINER(m_mainWidget), hbox);
                gtk_widget_reparent(m_wxwindow, hbox);
            }
            gtk_widget_reparent(toolbar->m_widget, hbox);
            gtk_box_set_child_packing(GTK_BOX(hbox),
                toolbar->m_widget, false, false, 0, GTK_PACK_START);

            int pos = 0;  // left
            if (toolbar->HasFlag(wxTB_RIGHT))
                pos = 1;  // right
            gtk_box_reorder_child(GTK_BOX(hbox), toolbar->m_widget, pos);
        }
        else
        {
            // Horizontal toolbar goes into vbox (m_mainWidget)
            gtk_widget_reparent(toolbar->m_widget, m_mainWidget);
            gtk_box_set_child_packing(GTK_BOX(m_mainWidget),
                toolbar->m_widget, false, false, 0, GTK_PACK_START);

            int pos = 0;  // top
            if (m_frameMenuBar)
                pos = 1;  // below menubar
            if (toolbar->HasFlag(wxTB_BOTTOM))
                pos += 2;  // below client area (m_wxwindow)
            gtk_box_reorder_child(
                GTK_BOX(m_mainWidget), toolbar->m_widget, pos);
        }
        // reset size request to allow native sizing to work
        gtk_widget_set_size_request(toolbar->m_widget, -1, -1);
    }
    // make sure next size_allocate causes a wxSizeEvent
    m_oldClientWidth = 0;
}
static void
cc_mouse_panel_init (CcMousePanel *self)
{
    CcMousePanelPrivate *priv;
    GtkBuilder *dialog;
    GError *error = NULL;

    priv = self->priv = MOUSE_PANEL_PRIVATE (self);

    priv->builder = gtk_builder_new ();

    gtk_builder_add_from_file (priv->builder,
                               CINNAMONCC_UI_DIR "/cinnamon-mouse-properties.ui",
                               &error);
    if (error != NULL)
    {
        g_warning ("Error loading UI file: %s", error->message);
        return;
    }

    gtk_builder_add_from_file (priv->builder,
                               CINNAMONCC_UI_DIR "/cinnamon-mouse-test.ui",
                               &error);
    if (error != NULL)
    {
        g_warning ("Error loading UI file: %s", error->message);
        return;
    }

    dialog = priv->builder;

    priv->prefs_widget = gnome_mouse_properties_init (priv->builder);
    priv->test_widget = gnome_mouse_test_init (priv->builder);

    priv->widget = gtk_notebook_new ();
    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->widget), FALSE);
    gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->widget), FALSE);

    gtk_widget_reparent (WID ("prefs_widget"), priv->widget);
    gtk_widget_reparent (WID ("test_widget"), priv->widget);

    gtk_container_add (GTK_CONTAINER (self), priv->widget);
    gtk_widget_show (priv->widget);

    g_idle_add (add_shell_test_button_cb, self);
}
Пример #16
0
void EditorActionCreateNoteParagraph::redo (GtkWidget *& to_focus)
{
  // Restore the live widget to the editor.
  gtk_widget_reparent (textview, parent_vbox);
  gtk_box_reorder_child (GTK_BOX(parent_vbox), textview, offset_at_delete);
  // Let the restored textview be earmarked to grab focus.
  to_focus = textview;
}
void
thunar_progress_dialog_add_job (ThunarProgressDialog *dialog,
                                ThunarJob            *job,
                                const gchar          *icon_name,
                                const gchar          *title)
{
  GtkWidget *viewport;
  GtkWidget *view;

  _thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
  _thunar_return_if_fail (THUNAR_IS_JOB (job));
  _thunar_return_if_fail (g_utf8_validate (title, -1, NULL));

  view = thunar_progress_view_new_with_job (job);
  thunar_progress_view_set_icon_name (THUNAR_PROGRESS_VIEW (view), icon_name);
  thunar_progress_view_set_title (THUNAR_PROGRESS_VIEW (view), title);
  gtk_box_pack_start (GTK_BOX (dialog->content_box), view, FALSE, TRUE, 0);
  gtk_widget_show (view);

  /* use the first job's icon-name for the dialog */
  if (dialog->views == NULL)
    gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);

  /* add the view to the list of known views */
  dialog->views = g_list_prepend (dialog->views, view);

  /* check if we need to wrap the views in a scroll window (starting 
   * at SCROLLVIEW_THRESHOLD parallel operations */
  if (g_list_length (dialog->views) == SCROLLVIEW_THRESHOLD)
    {
      /* create a scrolled window and add it to the dialog */
      dialog->scrollwin = gtk_scrolled_window_new (NULL, NULL);
      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->scrollwin), 
                                      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
      gtk_container_add (GTK_CONTAINER (dialog->vbox), dialog->scrollwin);
      gtk_widget_show (dialog->scrollwin);

      /* create a viewport for the content box */
      viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (dialog->scrollwin)),
                                   gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (dialog->scrollwin)));
      gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
      gtk_container_add (GTK_CONTAINER (dialog->scrollwin), viewport);
      gtk_widget_show (viewport);

      /* move the content box into the viewport */
      gtk_widget_reparent (dialog->content_box, viewport);
    }

  g_signal_connect_swapped (view, "need-attention", 
                            G_CALLBACK (thunar_progress_dialog_view_needs_attention), dialog);

  g_signal_connect_swapped (view, "finished",
                            G_CALLBACK (thunar_progress_dialog_job_finished), dialog);

  if (dialog->status_icon != NULL)
    thunar_progress_dialog_update_status_icon (dialog);
}
Пример #18
0
void 
part_browser_reparent (gpointer *br, GtkWidget *new_parent)
{
	Browser *b;
	g_return_if_fail (br != NULL);

	b = (Browser *)br;
	gtk_widget_reparent (GTK_WIDGET (b->viewport), new_parent);
}
Пример #19
0
static void
connect_dialog_init (ConnectDialog *dialog)
{
    gchar *path = locate_data_file ("connect-dialog.glade");
    g_assert(path != NULL);

    GtkBuilder *xml =  gtk_builder_new ();
    g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0);

    g_free (path);

#define GW(name) ((dialog->name) = GTK_WIDGET (gtk_builder_get_object (xml, #name)))
    GW(toplevel);
    GW(server_list);
#undef GW

    g_object_unref (xml);

    dialog->server_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
    gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->server_list), GTK_TREE_MODEL (dialog->server_store));

    GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
    GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes ("name", renderer, "text", 0, NULL);
    gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->server_list), column);

    GtkWidget *button = gtk_button_new_with_mnemonic (_("C_onnect"));
    gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
    gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);

    GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
    gtk_widget_reparent (dialog->toplevel, content_area);

    g_signal_connect (G_OBJECT (dialog->server_list), "row-activated", G_CALLBACK (row_activated), dialog);

    g_signal_connect (
        G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->server_list))),
        "changed",
        G_CALLBACK (selection_changed),
        dialog);

    for (GSList *netlist = network_list; netlist; netlist = g_slist_next (netlist)) {
        GtkTreeIter iter;

        ircnet *net = netlist->data;
        gtk_list_store_append (dialog->server_store, &iter);
        gtk_list_store_set (dialog->server_store, &iter, 0, net->name, 1, net, -1);
    }

    gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 240);
    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
    gtk_window_set_title (GTK_WINDOW (dialog), _("Connect"));
    gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
    g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (dialog_response), NULL);
    g_signal_connect (G_OBJECT (dialog), "key-press-event", G_CALLBACK (dialog_escape_key_handler_destroy), NULL);
}
Пример #20
0
/*!
* Set "toolbars detachable" setting.
*/
void EV_GnomeToolbar::setDetachable(gboolean detachable)
{
	if (detachable && GTK_IS_TOOLBAR(gtk_bin_get_child(GTK_BIN(m_wHandleBox)))) {
		// not detachable -> detachable
		GtkWidget *box = gtk_handle_box_new();
		gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(box), GTK_SHADOW_NONE);
		gtk_widget_reparent(m_wToolbar, box);
		gtk_container_add(GTK_CONTAINER(m_wHandleBox), box);
		if (!isHidden()) {
			gtk_widget_show(box);
		}
	}
	else if (!detachable && GTK_IS_HANDLE_BOX(gtk_bin_get_child(GTK_BIN(m_wHandleBox)))) {
		// detachable -> not detachable
		GtkWidget *box = gtk_bin_get_child(GTK_BIN(m_wHandleBox));
		g_object_ref(G_OBJECT(box));
		gtk_container_remove(GTK_CONTAINER(m_wHandleBox), box);
		gtk_widget_reparent(m_wToolbar, m_wHandleBox);
		g_object_unref(G_OBJECT(box));
	}
}
Пример #21
0
int
clip_GTK_WIDGETREPARENT(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	C_widget *cpar = _fetch_cwidget(cm,_clip_spar(cm,2));
	CHECKCWID(cwid,GTK_IS_WIDGET);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_widget_reparent(cwid->widget, cpar->widget);
	return 0;
err:
	return 1;
}
static void
cc_notifications_panel_init (CcNotificationsPanel *panel)
{
  GtkWidget *w;
  GError *error = NULL;

  g_resources_register (cc_notifications_get_resource ());
  panel->known_applications = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                     NULL, g_free);

  panel->builder = gtk_builder_new ();
  if (gtk_builder_add_from_resource (panel->builder,
                                     "/org/gnome/control-center/notifications/notifications.ui",
                                     &error) == 0)
    {
      g_error ("Error loading UI file: %s", error->message);
      g_error_free (error);
      return;
    }

  panel->master_settings = g_settings_new (MASTER_SCHEMA);

  g_settings_bind (panel->master_settings, "show-banners",
                   gtk_builder_get_object (panel->builder, "ccnotify-switch-banners"),
                   "active", G_SETTINGS_BIND_DEFAULT);
  g_settings_bind (panel->master_settings, "show-in-lock-screen",
                   gtk_builder_get_object (panel->builder, "ccnotify-switch-lock-screen"),
                   "active", G_SETTINGS_BIND_DEFAULT);

  panel->list_box = egg_list_box_new ();
  w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
                                          "ccnotify-app-scrolledwindow"));

  egg_list_box_add_to_scrolled (panel->list_box, GTK_SCROLLED_WINDOW (w));
  egg_list_box_set_selection_mode (panel->list_box, GTK_SELECTION_NONE);
  egg_list_box_set_sort_func (panel->list_box, sort_apps, NULL, NULL);
  egg_list_box_set_separator_funcs (panel->list_box,
                                    update_separator_func,
                                    NULL, NULL);

  g_signal_connect (panel->list_box, "child-activated",
                    G_CALLBACK (select_app), panel);

  gtk_widget_set_visible (GTK_WIDGET (panel->list_box), TRUE);

  build_app_store (panel);

  w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
                                          "ccnotify-main-grid"));
  gtk_widget_reparent (w, GTK_WIDGET (panel));
  gtk_widget_show (w);
}
Пример #23
0
void EditorActionDeleteParagraph::undo (GtkWidget *& to_focus)
{
  // Restore the live widget to the editor.
  GtkWidget * widget_to_restore = paragraph->textview;
  if (paragraph->type == eatCreateNoteParagraph) {
    EditorActionCreateNoteParagraph * note_paragraph = static_cast <EditorActionCreateNoteParagraph *> (paragraph);
    widget_to_restore = note_paragraph->hbox;
  }
  gtk_widget_reparent (widget_to_restore, paragraph->parent_vbox);
  gtk_box_reorder_child (GTK_BOX(paragraph->parent_vbox), widget_to_restore, offset);
  // Let the restored textview be earmarked to grab focus.
  to_focus = paragraph->textview;
}
Пример #24
0
static void gtk_widget_reparent_(GtkWidget* dst, GtkWidget* src)
{
	GtkWidget *child = gtk_widget_get_child_(src);

#if 1
	gtk_widget_reparent(child, dst);
#else
	g_object_ref(child);
	gtk_container_remove(GTK_CONTAINER(src), child);
	gtk_container_add(GTK_CONTAINER(dst), child);
	g_object_unref(child);
#endif
}
void tmp_circumvent_delete_event (GtkWidget *widget, gpointer user_data)
{
	GtkWidget *box 		= g_object_get_data (G_OBJECT (widget), "data_box");
	GtkWidget *parent 	= g_object_get_data (G_OBJECT (widget), "data_parent");
	gboolean *flag 		= g_object_get_data (G_OBJECT (widget), "data_flag");

	GtkWidget *window = gtk_widget_get_parent(box);

	gtk_widget_reparent(box, parent);
	gtk_widget_destroy(window);

	*flag = !(*flag);
}
GtkWidget *gui_detach_box_from_parent (GtkWidget *box, GtkWidget *parent, gboolean *flag, gchar *window_title, gint x, gint y)
{
	/*
	 * This function detaches the box from its parent. If the flag=FALSE, than
	 * it creates a new window and packs the box inside the window, otherwise
	 * it packs the box in its original place inside the main window.
	 */

	GtkWidget *window;
	gchar *glade_pixmap_file = g_build_filename (PHOEBE_GLADE_PIXMAP_DIR, "ico.png", NULL);

	if(*flag){
		window = gtk_widget_get_parent (box);

		gtk_widget_reparent(box, parent);
		gtk_widget_destroy(window);

        gui_status("%s reatached.", window_title);
	}
	else{
		window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
		g_object_set_data (G_OBJECT (window), "data_box", 		(gpointer) box);
		g_object_set_data (G_OBJECT (window), "data_parent", 	(gpointer) parent);
		g_object_set_data (G_OBJECT (window), "data_flag",		(gpointer) flag);

		gtk_window_set_icon (GTK_WINDOW(window), gdk_pixbuf_new_from_file(glade_pixmap_file, NULL));
		gtk_window_set_title (GTK_WINDOW (window), window_title);
		gtk_widget_reparent(box, window);
		gtk_widget_set_size_request (window, x, y);
		gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
		g_signal_connect (GTK_WIDGET(window), "delete-event", G_CALLBACK (tmp_circumvent_delete_event), NULL);
		gtk_widget_show_all (window);

		gui_status("%s detached.", window_title);
	}
	*flag = !(*flag);
	return window;
}
static void
thunar_progress_dialog_job_finished (ThunarProgressDialog *dialog,
                                     ThunarProgressView   *view)
{
  guint n_views;

  _thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
  _thunar_return_if_fail (THUNAR_IS_PROGRESS_VIEW (view));

  /* remove the view from the list */
  dialog->views = g_list_remove (dialog->views, view);

  /* destroy the widget */
  gtk_widget_destroy (GTK_WIDGET (view));

  /* determine the number of views left */
  n_views = g_list_length (dialog->views);

  /* check if we've just removed the 4th view and are now left with
   * SCROLLVIEW_THRESHOLD-1 of them, in which case we drop the scroll window */
  if (n_views == SCROLLVIEW_THRESHOLD-1)
    {
      /* reparent the content box */
      gtk_widget_reparent (dialog->content_box, dialog->vbox);

      /* destroy the scroll win */
      gtk_widget_destroy (dialog->scrollwin);
    }

  /* check if we have less than SCROLLVIEW_THRESHOLD views 
   * and need to shrink the window */
  if (n_views < SCROLLVIEW_THRESHOLD)
    {
      /* try to shrink the window */
      gtk_window_resize (GTK_WINDOW (dialog), 450, 10);
    }

  /* check if we still have at least one view */
  if (dialog->views != NULL)
    {
      /* update the status icon */
      if (dialog->status_icon != NULL)
        thunar_progress_dialog_update_status_icon (dialog);
    }
  else
    {
      /* destroy the dialog as there are no views left */
      gtk_widget_destroy (GTK_WIDGET (dialog));
    }
}
Пример #28
0
void destroy_page_window (GtkWidget *window, gpointer data)
{
    WidgetPageData *pageData = (WidgetPageData *)data;
    window = window;

    /* Put widget back into a page */
    gtk_widget_reparent (pageData->widget, pageData->parent);

    /* Select it */
    gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), pageData->pageNo);

    /* Free return data */
    g_free (data);
}
static void
security_combo_changed (GtkWidget *combo,
                        gpointer user_data)
{
    NMAWirelessDialog *self = NMA_WIRELESS_DIALOG (user_data);
    NMAWirelessDialogPrivate *priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self);
    GtkWidget *vbox;
    GList *elt, *children;
    GtkTreeIter iter;
    GtkTreeModel *model;
    WirelessSecurity *sec = NULL;
    GtkWidget *sec_widget;

    vbox = GTK_WIDGET (gtk_builder_get_object (priv->builder, "security_vbox"));
    g_assert (vbox);

    size_group_clear (priv->group);

    /* Remove any previous wireless security widgets */
    children = gtk_container_get_children (GTK_CONTAINER (vbox));
    for (elt = children; elt; elt = g_list_next (elt))
        gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));

    model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
    if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter)) {
        g_warning ("%s: no active security combo box item.", __func__);
        return;
    }

    gtk_tree_model_get (model, &iter, S_SEC_COLUMN, &sec, -1);
    if (!sec)
        return;

    sec_widget = wireless_security_get_widget (sec);
    g_assert (sec_widget);

    size_group_add_permanent (priv->group, priv->builder);
    wireless_security_add_to_size_group (sec, priv->group);

    if (gtk_widget_get_parent (sec_widget))
        gtk_widget_reparent (sec_widget, vbox);
    else
        gtk_container_add (GTK_CONTAINER (vbox), sec_widget);

    wireless_security_unref (sec);

    /* Re-validate */
    wireless_security_changed_cb (NULL, sec);
}
Пример #30
0
void
GtkAReViWidget::dock(void)
{
  if (isDocked())
    return;

  if (isDockable())
  {
    gtk_widget_reparent(_wndDockSrc, _dockDst->accessWidget(_dockDstWidget));
    hide();
    _docked=true;
  }
  else if (!GTK_IS_WIDGET(_wndDockSrc))
    _wndDockSrc=NULL;
}