static CcWacomPage *
set_device_page (CcWacomPanel *self, const gchar *device_name)
{
	CcWacomPanelPrivate *priv;
	CcWacomPage *page;
	gint current;

	priv = self->priv;

	if (device_name == NULL)
		return NULL;

	/* Choose correct device */
	page = g_hash_table_lookup (priv->pages, device_name);

	if (page == NULL) {
		g_warning ("Failed to find device '%s', supplied in the command line.", device_name);
		return page;
	}

	current = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), GTK_WIDGET (page));
	gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), current);

	return page;
}
Пример #2
0
void
caja_side_pane_remove_panel (CajaSidePane *side_pane,
                             GtkWidget *widget)
{
    SidePanel *panel;
    int page_num;

    g_return_if_fail (side_pane != NULL);
    g_return_if_fail (CAJA_IS_SIDE_PANE (side_pane));
    g_return_if_fail (widget != NULL);
    g_return_if_fail (GTK_IS_WIDGET (widget));

    panel = panel_for_widget (side_pane, widget);

    g_return_if_fail (panel != NULL);

    if (panel)
    {
        page_num = gtk_notebook_page_num (GTK_NOTEBOOK (side_pane->details->notebook),
                                          widget);
        gtk_notebook_remove_page (GTK_NOTEBOOK (side_pane->details->notebook),
                                  page_num);
        gtk_container_remove (GTK_CONTAINER (side_pane->details->menu),
                              panel->menu_item);

        side_pane->details->panels =
            g_list_remove (side_pane->details->panels,
                           panel);

        side_panel_free (panel);
    }
}
Пример #3
0
/* name should be in UTF-8, and can have a path. */
static void
show_output(const gchar * std_output, const gchar * name, const gchar * force_encoding,
	    gint filetype_new_file)
{
	gint page;
	GtkNotebook *book;
	GeanyDocument *doc, *cur_doc;

	if (std_output)
	{
		cur_doc = document_get_current();
		doc = document_find_by_filename(name);
		if (doc == NULL)
		{
			doc = document_new_file(name,
						   filetypes[filetype_new_file],
						   std_output);
		}
		else
		{
			sci_set_text(doc->editor->sci, std_output);
			book = GTK_NOTEBOOK(geany->main_widgets->notebook);
			page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->sci));
			gtk_notebook_set_current_page(book, page);
		}
		document_set_text_changed(doc, FALSE);
		document_set_encoding(doc, (force_encoding ? force_encoding : "UTF-8"));
		navqueue_goto_line(cur_doc, document_get_current(), 1);
	}
	else
	{
		ui_set_statusbar(FALSE, _("Could not parse the output of command"));
	}
}
Пример #4
0
/**
\brief
    Description yet to be added.
**/
static int addPage ( GtkNotebook *notebook, Tcl_Interp *interp,
					 Tcl_Obj *child, Tcl_Obj *label, Tcl_Obj *menu, int begin )
{
	GtkWidget *menuWidget;
	GtkWidget *labelWidget;
	GtkWidget *childWidget = gnoclChildNotPacked ( Tcl_GetString ( child ),
							 interp );

	if ( childWidget == NULL )
		return -1;

	labelWidget = getLabel ( interp, label );

	if ( labelWidget == NULL )
		return -1;

	menuWidget = getLabel ( interp, menu ? menu : label );

	if ( menuWidget == NULL )
		return -1;

	if ( begin )
		gtk_notebook_append_page_menu ( notebook, childWidget,
										labelWidget, menuWidget );
	else
		gtk_notebook_prepend_page_menu ( notebook, childWidget,
										 labelWidget, menuWidget );

	return gtk_notebook_page_num ( notebook, childWidget );
}
Пример #5
0
/**************************************************************************
  Alert the user to an important event.
**************************************************************************/
void gui_dialog_alert(struct gui_dialog *dlg)
{
  fc_assert_ret(NULL != dlg);

  switch (dlg->type) {
  case GUI_DIALOG_WINDOW:
    break;
  case GUI_DIALOG_TAB:
    {
      GtkNotebook *notebook = GTK_NOTEBOOK(dlg->v.tab.notebook);
      gint current, n;

      current = gtk_notebook_get_current_page(notebook);
      n = gtk_notebook_page_num(notebook, dlg->vbox);

      if (current != n) {
        GtkWidget *label = dlg->v.tab.label;
        GdkColormap *cmap = gtk_widget_get_default_colormap();
        GdkColor color = {.red = 0, .green = 0, .blue = 255 << 8};

        gdk_rgb_find_color(cmap, &color);
        gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &color);
      }
    }
    break;
  }
}
Пример #6
0
void linphone_gtk_create_in_call_view(LinphoneCall *call){
	GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame");
	GtkWidget *main_window=linphone_gtk_get_main_window ();
	GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
	static int call_index=1;
	int idx;

	if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){
		/*this is the only call at this time */
		call_index=1;
	}
	g_object_set_data(G_OBJECT(call_view),"call",call);
	g_object_set_data(G_OBJECT(call_view),"call_index",GINT_TO_POINTER(call_index));

	linphone_call_set_user_pointer (call,call_view);
	linphone_call_ref(call);
	gtk_notebook_append_page (notebook,call_view,make_tab_header(call_index));
	gtk_widget_show(call_view);
	idx = gtk_notebook_page_num(notebook, call_view);
	gtk_notebook_set_current_page(notebook, idx);
	call_index++;
	linphone_gtk_enable_hold_button (call,FALSE,TRUE);
	linphone_gtk_enable_mute_button(
					GTK_BUTTON(linphone_gtk_get_widget(call_view,"incall_mute")),FALSE);
}
Пример #7
0
void
wins_set_title (GtkWidget *widget, char *new_title)
{
	xchatwin *xw;
	int fpage;

	xw = (xchatwin *) gtk_object_get_user_data (GTK_OBJECT (widget));

	free (xw->title);
	xw->title = strdup (new_title);

	if (xw->is_toplevel)
	{
		gtk_window_set_title (GTK_WINDOW (xw->child), new_title);
	} else
	{
		if (main_window)
		{
			/* set WINDOW title only if tab is the front one */
			fpage = gtk_notebook_get_current_page (GTK_NOTEBOOK (main_book));
			if (fpage == gtk_notebook_page_num (GTK_NOTEBOOK (main_book), widget))
			{
				gtk_window_set_title (GTK_WINDOW (main_window), new_title);
			}
		}
	}
}
Пример #8
0
void
anjuta_docman_present_notebook_page (AnjutaDocman *docman, IAnjutaDocument *doc)
{
	GList *node;

	if (!doc)
		return;

	node = docman->priv->pages;

	while (node)
	{
		AnjutaDocmanPage* page;
		page = (AnjutaDocmanPage *)node->data;
		if (page && page->doc == doc)
		{
			gint curindx;
			curindx = gtk_notebook_page_num (GTK_NOTEBOOK (docman), page->widget);
			if (curindx != -1)
			{
				if (curindx != gtk_notebook_get_current_page (GTK_NOTEBOOK (docman)))
					gtk_notebook_set_current_page (GTK_NOTEBOOK (docman), curindx);
				else
					/* Make sure current page is visible */
					anjuta_docman_grab_text_focus (docman);
			}
			break;
		}
		node = g_list_next (node);
	}
}
Пример #9
0
gint keyrelease (GtkWidget *widget, GdkEventKey *key)
{
    int game_area;

    if (widget == app)
    {
      int cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
      int pfields_page = gtk_notebook_page_num(GTK_NOTEBOOK(notebook),
                                               pfields);
      /* Main window - check the notebook */
      game_area = (cur_page == pfields_page);
    }
    else
    {
        /* Sub-window - find out which */
        char *title = NULL;

        title = g_object_get_data(G_OBJECT(widget), "title");
        game_area =  title && !strcmp( title, _("Playing Fields"));
    }

    if (game_area)
    {
        k = *key;
        keytimeoutid = g_timeout_add (10, keytimeout, 0);
        g_signal_stop_emission_by_name (G_OBJECT(widget), "key-release-event");
        return TRUE;
    }
    return FALSE;
}
Пример #10
0
GeditNotebook *
gedit_multi_notebook_get_notebook_for_tab (GeditMultiNotebook *mnb,
                                           GeditTab           *tab)
{
	GList *l;
	gint page_num;

	g_return_val_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb), NULL);
	g_return_val_if_fail (GEDIT_IS_TAB (tab), NULL);

	l = mnb->priv->notebooks;

	do
	{
		page_num = gtk_notebook_page_num (GTK_NOTEBOOK (l->data),
		                                  GTK_WIDGET (tab));
		if (page_num != -1)
			break;

		l = g_list_next (l);
	} while (l != NULL && page_num == -1);

	g_return_val_if_fail (page_num != -1, NULL);

	return GEDIT_NOTEBOOK (l->data);
}
Пример #11
0
void C4DevmodeDlg::SwitchPage(GtkWidget* widget)
{
	bool is_visible = gtk_widget_get_visible(GTK_WIDGET(window));

	// Remember window position
	if (window != NULL && is_visible)
		gtk_window_get_position(GTK_WINDOW(window), &x, &y);

	if (widget != NULL)
	{
		assert(window != NULL);

		// Show required page
		int page_num = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), widget);
		assert(page_num != -1); // Make sure it is contained

		gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), page_num);
		gtk_window_set_title(GTK_WINDOW(window), gtk_notebook_get_tab_label_text(GTK_NOTEBOOK(notebook), widget));

		// Show window if not visible
		if (!is_visible)
		{
			gtk_widget_show(window);
			if (x != -1 || y != -1)
				gtk_window_move(GTK_WINDOW(window), x, y);
		}
	}
	else
	{
		if (window != NULL && is_visible)
			gtk_widget_hide(window);
	}
}
Пример #12
0
GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){
	GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame");
	GtkWidget *main_window=linphone_gtk_get_main_window();
	GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
	GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview");
	GdkColor color;
	GdkColor colorb;
	int idx;
	GtkWidget *button;
	GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
	MSList *messages;
	GHashTable *table;
	char *with_str;

	color.red = 32512;
  	color.green = 32512;
  	color.blue = 32512;
	colorb.red = 56832;
  	colorb.green = 60928;
  	colorb.blue = 61952;

	with_str=linphone_address_as_string_uri_only(with);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR);
	gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE);
	gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text),FALSE);
	gtk_notebook_append_page(notebook,chat_view,create_tab_chat_header(cr,with));
	idx = gtk_notebook_page_num(notebook, chat_view);
	gtk_notebook_set_current_page(notebook, idx);
	gtk_widget_show(chat_view);
	table=g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL);
	g_object_set_data(G_OBJECT(chat_view),"cr",cr);
	g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
	g_object_set_data(G_OBJECT(chat_view),"table",table);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                        "right","justification", GTK_JUSTIFY_RIGHT,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                        "left","justification", GTK_JUSTIFY_LEFT,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                       	    "bold","weight", PANGO_WEIGHT_BOLD,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
								"italic","style", PANGO_STYLE_ITALIC,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                           	"small","size",9*PANGO_SCALE,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                           	"font_grey","foreground-gdk",&color,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                           	"margin","indent",10,NULL);
	gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
	                           	"bg","paragraph-background-gdk",&colorb,NULL);
	messages = linphone_chat_room_get_history(cr,NB_MSG_HIST);
	display_history_message(chat_view,messages,with);
	button = linphone_gtk_get_widget(chat_view,"send");
	g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,NULL);
	
	g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,NULL);
	g_signal_connect_swapped(G_OBJECT(entry),"changed",(GCallback)linphone_gtk_compose_text,NULL);
	g_signal_connect(G_OBJECT(notebook),"switch_page",(GCallback)linphone_gtk_notebook_tab_select,NULL);
	ms_free(with_str);
	return chat_view;
}
Пример #13
0
static void
real_active (NautilusWindowSlot *slot)
{
    NautilusWindow *window;
    NautilusWindowPane *pane;
    int page_num;

    window = slot->pane->window;

    pane = slot->pane;
    page_num = gtk_notebook_page_num (GTK_NOTEBOOK (pane->notebook),
                                      slot->content_box);
    g_assert (page_num >= 0);

    gtk_notebook_set_current_page (GTK_NOTEBOOK (pane->notebook), page_num);

    /* sync window to new slot */
    nautilus_window_sync_status (window);
    nautilus_window_sync_allow_stop (window, slot);
    nautilus_window_sync_title (window, slot);
    nautilus_window_sync_zoom_widgets (window);
    nautilus_window_pane_sync_location_widgets (slot->pane);
    nautilus_window_pane_sync_search_widgets (slot->pane);

    if (slot->viewed_file != NULL) {
        nautilus_window_load_view_as_menus (window);
        nautilus_window_load_extension_menus (window);
    }
}
Пример #14
0
void
nemo_window_pane_close_slot (NemoWindowPane *pane,
				 NemoWindowSlot *slot)
{
	int page_num;
	GtkNotebook *notebook;

	g_assert (NEMO_IS_WINDOW_SLOT (slot));
	g_assert (NEMO_IS_WINDOW_PANE (slot->pane));

	DEBUG ("Closing slot %p", slot);

	/* save pane because slot is not valid anymore after this call */
	pane = slot->pane;
	notebook = GTK_NOTEBOOK (pane->notebook);

	nemo_window_manage_views_close_slot (slot);

	page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (slot));
	g_assert (page_num >= 0);

	g_signal_handlers_block_by_func (notebook,
					 G_CALLBACK (notebook_switch_page_cb),
					 pane);
	/* this will call gtk_widget_destroy on the slot */
	gtk_notebook_remove_page (notebook, page_num);
	g_signal_handlers_unblock_by_func (notebook,
					   G_CALLBACK (notebook_switch_page_cb),
					   pane);

	gtk_notebook_set_show_tabs (notebook,
				    gtk_notebook_get_n_pages (notebook) > 1);
	pane->slots = g_list_remove (pane->slots, slot);
}
Пример #15
0
static void
goto_file_line_cb(const gchar * filename, const gchar * line, const gchar * reason)
{
	gint pos;
	gint page;
	GeanyDocument *doc;

	gint line_num = gdbio_atoi((gchar *) line) - 1;
	if (reason)
	{
		msgwin_compiler_add(COLOR_BLUE, "%s", reason);
	}
	doc = document_open_file(filename, FALSE, NULL, NULL);
	if (!(doc && doc->is_valid))
	{
		return;
	}
	page = gtk_notebook_page_num(NOTEBOOK, GTK_WIDGET(doc->editor->sci));
	gtk_notebook_set_current_page(NOTEBOOK, page);
	pos = sci_get_position_from_line(doc->editor->sci, line_num);
	sci_ensure_line_is_visible(doc->editor->sci, line_num);
	while (gtk_events_pending())
	{
		gtk_main_iteration();
	}
	sci_set_current_position(doc->editor->sci, pos, TRUE);
	gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
	gtk_window_present(GTK_WINDOW(geany->main_widgets->window));
}
Пример #16
0
static void
ephy_notebook_remove (GtkContainer *container,
                      GtkWidget    *tab_widget)
{
  GtkNotebook *gnotebook = GTK_NOTEBOOK (container);
  EphyNotebook *notebook = EPHY_NOTEBOOK (container);
  int position, curr;

  if (!EPHY_IS_EMBED (tab_widget))
    return;

  /* Remove the page from the focused pages list */
  notebook->focused_pages = g_list_remove (notebook->focused_pages, tab_widget);

  position = gtk_notebook_page_num (gnotebook, tab_widget);
  curr = gtk_notebook_get_current_page (gnotebook);

  if (position == curr) {
    smart_tab_switching_on_closure (notebook, tab_widget);
  }

  GTK_CONTAINER_CLASS (ephy_notebook_parent_class)->remove (container, tab_widget);

  update_tabs_visibility (notebook, FALSE);
}
Пример #17
0
gint
gedit_multi_notebook_get_page_num (GeditMultiNotebook *mnb,
				   GeditTab           *tab)
{
	GList *l;
	gint real_page_num = 0;

	for (l = mnb->priv->notebooks; l != NULL; l = g_list_next (l))
	{
		gint page_num;

		page_num = gtk_notebook_page_num (GTK_NOTEBOOK (l->data),
						  GTK_WIDGET (tab));

		if (page_num != -1)
		{
			real_page_num += page_num;
			break;
		}

		real_page_num += gtk_notebook_get_n_pages (GTK_NOTEBOOK (l->data));
	}

	return real_page_num;
}
Пример #18
0
void
gedit_multi_notebook_set_active_tab (GeditMultiNotebook *mnb,
				     GeditTab           *tab)
{
	GList *l;
	gint page_num;

	g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb));
	g_return_if_fail (GEDIT_IS_TAB (tab));

	if (tab == GEDIT_TAB (mnb->priv->active_tab))
		return;

	l = mnb->priv->notebooks;

	do
	{
		page_num = gtk_notebook_page_num (GTK_NOTEBOOK (l->data),
						  GTK_WIDGET (tab));
		if (page_num != -1)
			break;

		l = g_list_next (l);
	} while (l != NULL && page_num == -1);

	g_return_if_fail (page_num != -1);

	gtk_notebook_set_current_page (GTK_NOTEBOOK (l->data),
				       page_num);

	if (GTK_WIDGET (l->data) != mnb->priv->active_notebook)
	{
		gtk_widget_grab_focus (GTK_WIDGET (l->data));
	}
}
Пример #19
0
void
gedit_multi_notebook_close_tabs (GeditMultiNotebook *mnb,
				 const GList        *tabs)
{
	GList *l;

	g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb));

	for (l = (GList *)tabs; l != NULL; l = g_list_next (l))
	{
		GList *nbs;

		for (nbs = mnb->priv->notebooks; nbs != NULL; nbs = g_list_next (nbs))
		{
			gint n;

			n = gtk_notebook_page_num (GTK_NOTEBOOK (nbs->data),
			                           GTK_WIDGET (l->data));

			if (n != -1)
			{
				gtk_container_remove (GTK_CONTAINER (nbs->data),
				                      GTK_WIDGET (l->data));
				break;
			}
		}
	}
}
Пример #20
0
static void
smart_tab_switching_on_closure (CeditNotebook *nb,
				CeditTab      *tab)
{
	gboolean jump_to;

	jump_to = GPOINTER_TO_INT (g_object_get_data
				   (G_OBJECT (tab), "jump_to"));

	if (!jump_to || !nb->priv->focused_pages)
	{
		gtk_notebook_next_page (GTK_NOTEBOOK (nb));
	}
	else
	{
		GList *l;
		GtkWidget *child;
		int page_num;

		/* activate the last focused tab */
		l = g_list_last (nb->priv->focused_pages);
		child = GTK_WIDGET (l->data);
		page_num = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
						  child);
		gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 
					       page_num);
	}
}
Пример #21
0
void EditFiles::removeNotebookPage(GtkWidget *pageWidget)
    {
    mLastFocusGtkTextView = nullptr;
    GtkNotebook *book = mHeaderBook;
    int page = gtk_notebook_page_num(book, pageWidget);
    if(page == -1)
        {
        book = mSourceBook;
        page = gtk_notebook_page_num(book, pageWidget);
        }
    auto const &iter = std::find_if(mFileViews.begin(), mFileViews.end(),
            [pageWidget](std::unique_ptr<ScrolledFileView> const &fv) -> bool
                { return fv->getViewTopParent() == pageWidget; });
    mFileViews.erase(iter);
    gtk_notebook_remove_page(book, page);
    }
Пример #22
0
/**
 * cedit_notebook_reorder_tab:
 * @src: a #CeditNotebook
 * @tab: a #CeditTab
 * @dest_position: the position for @tab
 *
 * Reorders the page containing @tab, so that it appears in @dest_position position.
 * If dest_position is greater than or equal to the number of tabs 
 * of the destination notebook or negative, tab will be moved to the 
 * end of the tabs.
 */
void
cedit_notebook_reorder_tab (CeditNotebook *src,
			    CeditTab      *tab,
			    gint           dest_position)
{
	gint old_position;
	
	g_return_if_fail (CEDIT_IS_NOTEBOOK (src));	
	g_return_if_fail (CEDIT_IS_TAB (tab));

	old_position = gtk_notebook_page_num (GTK_NOTEBOOK (src), 
				    	      GTK_WIDGET (tab));
				    	      
	if (old_position == dest_position)
		return;

	gtk_notebook_reorder_child (GTK_NOTEBOOK (src), 
				    GTK_WIDGET (tab),
				    dest_position);
		
	if (!src->priv->drag_in_progress)
	{
		g_signal_emit (G_OBJECT (src), 
			       signals[TABS_REORDERED], 
			       0);
	}
}
Пример #23
0
void close_page(Document *document)
{
    gphpedit_debug(DEBUG_MAIN_WINDOW);
    gint page_num;
    gint page_num_closing;
    gint current_active_tab;

    page_num_closing = gtk_notebook_page_num(GTK_NOTEBOOK(main_window.notebook_editor), document_get_editor_widget(document));
    current_active_tab = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_window.notebook_editor));

    if (page_num_closing != current_active_tab) {
        page_num = current_active_tab;
    }
    else {
        // If there is a tab before the current one then set it as the active tab.
        page_num = page_num_closing - 1;
        // If the current tab is the 0th tab then set the current tab as 0 itself.
        // If there are are subsequent tabs, then this will set the next tab as active.
        if (page_num < 0) {
            page_num = 0;
        }
    }
    set_active_tab(page_num);
    gtk_notebook_remove_page(GTK_NOTEBOOK(main_window.notebook_editor), page_num_closing);
}
Пример #24
0
void document_manager_switch_to_file_or_open(DocumentManager *docmg, gchar *filename, gint line_number)
{
  gphpedit_debug(DEBUG_DOC_MANAGER);
  if (!docmg) return ;
  DocumentManagerDetails *docmgdet = DOCUMENT_MANAGER_GET_PRIVATE(docmg);
  Document *document;
  GSList *walk;
  /* need to check if filename is local before adding to the list */
  filename = g_strdup(filename);
  for (walk = docmgdet->editors; walk!=NULL; walk = g_slist_next(walk)) {
    document = walk->data;
    gchar *docfilename;
    GFile *file;
    g_object_get(document, "GFile", &file, NULL);
    docfilename = g_file_get_uri(file);
    gchar *filename_uri = filename_get_uri(filename);
    if (g_strcmp0(docfilename, filename_uri)==0) {
      GtkWidget *document_widget;
      g_object_get(document, "editor_widget", &document_widget, NULL);
      gtk_notebook_set_current_page( GTK_NOTEBOOK(main_window.notebook_editor), gtk_notebook_page_num(GTK_NOTEBOOK(main_window.notebook_editor), document_widget));
      documentable_goto_line(DOCUMENTABLE(docmgdet->current_document), line_number);
      g_free(docfilename);
      return ;
    }
    g_free(filename_uri);
    g_free(docfilename);
  }
  document_manager_add_new_document(docmg, TAB_FILE, filename, line_number);
  register_file_opened(filename);
  g_free(filename);
  return ;
}
Пример #25
0
void open_file(gchar *utf8_name)
{
	gchar *name;
	GeanyDocument *doc;

	name = utils_get_locale_from_utf8(utf8_name);
	doc = document_find_by_filename(utf8_name);

	if (!doc)
	{
		document_open_file(name, FALSE, NULL, NULL);
	}
	else
	{
		GtkNotebook *notebook;
		gint page_num;

		notebook = GTK_NOTEBOOK(geany->main_widgets->notebook);
		page_num = gtk_notebook_page_num(notebook, GTK_WIDGET(doc->editor->sci));

		gtk_notebook_set_current_page(notebook, page_num);
	}

	g_free(name);
}
Пример #26
0
static void close_page(MainWindow *main_window, Document *document)
{
  gphpedit_debug(DEBUG_MAIN_WINDOW);
  gint page_num;
  gint page_num_closing;
  gint current_active_tab;
  GtkWidget *document_widget;

  g_object_get(document, "editor_widget", &document_widget, NULL);
  page_num_closing = gtk_notebook_page_num(GTK_NOTEBOOK(main_window->notebook_editor), document_widget);
  current_active_tab = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_window->notebook_editor));
  
  if (page_num_closing != current_active_tab) {
    page_num = current_active_tab;
  } else {
    // If there is a tab before the current one then set it as the active tab.
    page_num = page_num_closing - 1;
    // If the current tab is the 0th tab then set the current tab as 0 itself.
    // If there are are subsequent tabs, then this will set the next tab as active.
    if (page_num < 0) {
      page_num = 0;
    }  
  }

  if(document_manager_set_current_document_from_position(main_window->docmg, page_num)) {
    gtk_notebook_set_current_page(GTK_NOTEBOOK(main_window->notebook_editor), page_num);
  }
  gtk_notebook_remove_page(GTK_NOTEBOOK(main_window->notebook_editor), page_num_closing);
}
Пример #27
0
void notebook_set_page(GtkWidget* notebook, GtkWidget* page)
{
  int pagenum = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), page);
  if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != pagenum)
  {
    gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), pagenum);
  }
}
Пример #28
0
void wxMDIChildFrame::Activate()
{
    GtkNotebook * const notebook = GTKGetNotebook();
    wxCHECK_RET( notebook, "no parent notebook?" );

    gint pageno = gtk_notebook_page_num( notebook, m_widget );
    gtk_notebook_set_current_page( notebook, pageno );
}
Пример #29
0
static void entry_focus(G_GNUC_UNUSED guint key_id)
{
	gtk_notebook_set_current_page(
		GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook),
		gtk_notebook_page_num(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), panel)
	);
	gtk_widget_grab_focus(entry);
}
Пример #30
0
void cgraphics_workspace_set_active( widget_t *widget, object_t *child )
{
	int pid = -1;
	
	pid = gtk_notebook_page_num( widget->native, WIDGET(child)->native );
	
	gtk_notebook_set_current_page( widget->native, pid );
}