Esempio n. 1
0
/* close the currently focused notebook page */
void gtkui_page_close_current(void) {
   GtkWidget *child;
   gint num = 0;

   num = gtk_notebook_get_current_page(GTK_NOTEBOOK (notebook));
   child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), num);

   gtkui_page_close(NULL, child);
}
Esempio n. 2
0
static void
frob_buttons (StfDialogData *pagedata)
{
	StfDialogPage pos =
		gtk_notebook_get_current_page (pagedata->notebook);

	gtk_widget_set_sensitive (pagedata->back_button, pos != DPG_MAIN);
	gtk_widget_set_sensitive (pagedata->next_button, pos != DPG_FORMAT);
}
Esempio n. 3
0
GLADE_CB void
dbgmem_button5_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
	GtkNotebook *nb = GTK_NOTEBOOK(notebook);
	gint page = gtk_notebook_get_current_page(nb);

	refresh_page(page, 0);
}
Esempio n. 4
0
/**
 * gtr_notebook_get_page:
 * @notebook: a #GtrNotebook
 * 
 * Gets the selected page in the #GtrNotebook.
 * 
 * Returns: (transfer none): the selected page in the @notebook
 */
GtrTab *
gtr_notebook_get_page (GtrNotebook * notebook)
{
  gint num;

  num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));

  return GTR_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), num));
}
Esempio n. 5
0
void termit_tab_set_font_by_index(gint tab_index, const gchar* font_name)
{
    TRACE("%s: tab_index=%d font=%s", __FUNCTION__, tab_index, font_name);
    if (tab_index < 0) {
        tab_index = gtk_notebook_get_current_page(GTK_NOTEBOOK(termit.notebook));
    }
    TERMIT_GET_TAB_BY_INDEX(pTab, tab_index);
    termit_tab_set_font(pTab, font_name);
}
Esempio n. 6
0
static void imp_ldif_cancel( GtkWidget *widget, gpointer data ) {
	gint pageNum;

	pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
	if( pageNum != PAGE_FINISH ) {
		impldif_dlg.cancelled = TRUE;
	}
	gtk_main_quit();
}
Esempio n. 7
0
void termit_for_each_row(int lua_callback)
{
    TRACE("%s lua_callback=%d", __FUNCTION__, lua_callback);
    gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(termit.notebook));
    TERMIT_GET_TAB_BY_INDEX(pTab, page);
    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(pTab->scrollbar));
    const glong rows_total = gtk_adjustment_get_upper(adj);
    termit_for_each_row_execute(pTab, 0, rows_total, lua_callback);
}
Esempio n. 8
0
static AtkObject*
get_accessible_for_widget (GtkWidget *widget,
                           gboolean  *transient)
{
  AtkObject *obj = NULL;

  *transient = FALSE;
  if (!widget)
    return NULL;

  if (GTK_IS_ENTRY (widget))
    ;
  else if (GTK_IS_NOTEBOOK (widget)) 
    {
      GtkNotebook *notebook;
      gint page_num = -1;

      notebook = GTK_NOTEBOOK (widget);
      page_num = gtk_notebook_get_current_page (notebook);
      if (page_num != -1)
        {
          obj = gtk_widget_get_accessible (widget);
          obj = atk_object_ref_accessible_child (obj, page_num);
          g_object_unref (obj);
        }
    }
  else if (GTK_IS_TOGGLE_BUTTON (widget))
    {
      GtkWidget *other_widget = gtk_widget_get_parent (widget);
      if (GTK_IS_COMBO_BOX (other_widget))
        {
          gail_set_focus_widget (other_widget, widget);
          widget = other_widget;
        }
    }
  if (obj == NULL)
    {
      AtkObject *focus_object;

      obj = gtk_widget_get_accessible (widget);
      focus_object = g_object_get_qdata (G_OBJECT (obj), quark_focus_object);
      /*
       * We check whether the object for this focus_object has been deleted.
       * This can happen when navigating to an empty directory in nautilus. 
       * See bug #141907.
       */
      if (ATK_IS_GOBJECT_ACCESSIBLE (focus_object))
        {
          if (!atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (focus_object)))
            focus_object = NULL;
        }
      if (focus_object)
        obj = focus_object;
    }

  return obj;
}
Esempio n. 9
0
/******************************************************************************
 * Name
 *  gui_close_passage_tab
 *
 * Synopsis
 *   #include "tabbed_browser.h"
 *
 *   void gui_close_passage_tab(gint pagenum)
 *
 * Description
 *   closes the given passage tab or the current one if pagenum = -1
 *
 * Return value
 *   void
 */
void gui_close_passage_tab(gint pagenum)
{
	if (stop_refresh)
		return;

	if (-1 == pagenum)
		pagenum =
		    gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets.notebook_main));
	if (1 ==
	    gtk_notebook_get_n_pages(GTK_NOTEBOOK(widgets.notebook_main)))
		return;
	PASSAGE_TAB_INFO *pt =
	    (PASSAGE_TAB_INFO *)g_list_nth_data(passage_list,
						(guint)pagenum);
	if (pt->showparallel || (2 <=
				 gtk_notebook_get_n_pages(GTK_NOTEBOOK(widgets.notebook_main)))) {
		// (surely this is always true!?)

		if (pagenum > 0) {
			gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_main), 0);
			cur_passage_tab = (PASSAGE_TAB_INFO *)
			    g_list_nth_data(passage_list, (guint)0);
		}
	}

	stop_refresh = TRUE;
	sync_windows();
	stop_refresh = FALSE;

	passage_list = g_list_remove(passage_list, pt);
	if (pt->text_mod)
		g_free(pt->text_mod);
	if (pt->commentary_mod)
		g_free(pt->commentary_mod);
	if (pt->dictlex_mod)
		g_free(pt->dictlex_mod);
	if (pt->book_mod)
		g_free(pt->book_mod);
	if (pt->text_commentary_key)
		g_free(pt->text_commentary_key);
	if (pt->dictlex_key)
		g_free(pt->dictlex_key);
	if (pt->book_offset)
		g_free(pt->book_offset);
	if (pt->showparallel) {
		gtk_widget_hide(pt->paratab);
		gui_destroy_parallel_tab();
		settings.showparatab = FALSE;
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets.parallel_tab_item),
					       settings.showparatab);
	}
	g_free(pt);
	//cur_passage_tab = NULL;
	removed_page = pagenum;
	gtk_notebook_remove_page(GTK_NOTEBOOK(widgets.notebook_main),
				 pagenum);
}
Esempio n. 10
0
MessageView *
anjuta_msgman_get_current_view (AnjutaMsgman * msgman)
{
	gint page = gtk_notebook_get_current_page (GTK_NOTEBOOK(msgman));
	if (page != -1)
		return MESSAGE_VIEW (gtk_notebook_get_nth_page (GTK_NOTEBOOK(msgman), page));
	else
		return NULL;
}
static void
main_window_response (GtkWidget *widget,
                      gint response_id,
                      AppearanceData *data)
{
  if (response_id == GTK_RESPONSE_CLOSE ||
      response_id == GTK_RESPONSE_DELETE_EVENT)
  {
    gtk_main_quit ();

    themes_shutdown (data);
    style_shutdown (data);
    desktop_shutdown (data);
    font_shutdown (data);
    support_shutdown (data);

    g_object_unref (data->thumb_factory);
    g_object_unref (data->settings);
    g_object_unref (data->wp_settings);
    g_object_unref (data->caja_settings);
    g_object_unref (data->interface_settings);
    g_object_unref (data->marco_settings);
    g_object_unref (data->mouse_settings);
#ifdef HAVE_XFT2
    g_object_unref (data->font_settings);
#endif /* HAVE_XFT2 */
    g_object_unref (data->ui);
  }
  else if (response_id == GTK_RESPONSE_HELP)
  {
      GtkNotebook *nb;
      gint pindex;

      nb = GTK_NOTEBOOK (appearance_capplet_get_widget (data, "main_notebook"));
      pindex = gtk_notebook_get_current_page (nb);

      switch (pindex)
      {
        case 0: /* theme */
          capplet_help (GTK_WINDOW (widget), "goscustdesk-12");
          break;
        case 1: /* background */
          capplet_help (GTK_WINDOW (widget), "goscustdesk-7");
          break;
        case 2: /* fonts */
          capplet_help (GTK_WINDOW (widget), "goscustdesk-38");
          break;
        case 3: /* interface */
          capplet_help (GTK_WINDOW (widget), "goscustuserinter-2");
          break;
        default:
          capplet_help (GTK_WINDOW (widget), "prefs-look-and-feel");
          break;
       }
  }
}
/* Notebook helpers */
static GtkWidget *
notebook_get_selected_page (GtkWidget *notebook)
{
  int curr;

  curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
  if (curr == -1)
    return NULL;
  return gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), curr);
}
Esempio n. 13
0
static void
prev_clicked (GtkButton        *button,
	      CcWacomNavButton *nav)
{
	int current_page;

	current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (nav->priv->notebook));
	current_page--;
	gtk_notebook_set_current_page (GTK_NOTEBOOK (nav->priv->notebook), current_page--);
}
Esempio n. 14
0
void search_in_current_file(const gchar* search_text, SearchTools* self) {
	GtkTextBuffer* buf;
	gint page_num = gtk_notebook_get_current_page(puss_get_doc_panel(self->app));
	if( page_num < 0 )
		return;

	buf = self->app->doc_get_buffer_from_page_num(page_num);
	if( buf )
		search_in_doc(buf, search_text, self);
}
Esempio n. 15
0
GtkWidget *
gnm_notebook_get_current_label (GnmNotebook *nb)
{
	int i;

	g_return_val_if_fail (GNM_IS_NOTEBOOK (nb), NULL);

	i = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb));
	return i == -1 ? NULL : gnm_notebook_get_nth_label (nb, i);
}
Esempio n. 16
0
/**
 * Return the view on the page that is currently raised, or NULL if
 * there are no views.
 */
static message_view_t *toplevel_get_current_view(toplevel_t * top)
{
	gint current = gtk_notebook_get_current_page(top->notebook);
	if (current >= 0) {
		GtkWidget *child = gtk_notebook_get_nth_page(top->notebook, current);
		GtkWidget *tab = gtk_notebook_get_tab_label(top->notebook, child);
		return g_object_get_data(G_OBJECT(tab), "view-object");
	}
	return NULL;
}
Esempio n. 17
0
/* Switch to the next or previous GtkNotebook page. */
static void
switch_page (GtkButton *button,
             GtkNotebook *notebook)
{
    gint page = gtk_notebook_get_current_page (notebook);
    if (page == 0)
        gtk_notebook_set_current_page (notebook, 1);
    else
        gtk_notebook_set_current_page (notebook, 0);
}
Esempio n. 18
0
/* [ gui_get_active_view ]
 * Return the view mode that is currently selected
 */
FortifiedView
gui_get_active_view (void)
{
	FortifiedView v;
	
	v = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
	g_assert (v < NUM_VIEWS);
	
	return v;
}
Esempio n. 19
0
static void
prepare_page (StfDialogData *data)
{
	switch (gtk_notebook_get_current_page (data->notebook)) {
	case DPG_MAIN:   stf_dialog_main_page_prepare (data); break;
	case DPG_CSV:    stf_dialog_csv_page_prepare (data); break;
	case DPG_FIXED:  stf_dialog_fixed_page_prepare (data); break;
	case DPG_FORMAT: stf_dialog_format_page_prepare (data); break;
	}
}
Esempio n. 20
0
static bool current_tab_is(area_context_t *context, const char *str) {
  GtkNotebook *nb = osm2go_platform::notebook_get_gtk_notebook(context->notebook);

  gint page_num = gtk_notebook_get_current_page(nb);

  if(page_num < 0)
    return false;

  return current_tab_is(nb, gtk_notebook_get_nth_page(nb, page_num), str);
}
Esempio n. 21
0
static gint catch_tabwin_key (GtkWidget *w, GdkEventKey *key, 
			      tabwin_t *tabwin)
{
    GtkNotebook *notebook = GTK_NOTEBOOK(tabwin->tabs);
    gint pg = gtk_notebook_get_current_page(notebook);
    GtkWidget *tab = gtk_notebook_get_nth_page(notebook, pg);
    windata_t *vwin = g_object_get_data(G_OBJECT(tab), "vwin");

    return catch_viewer_key(w, key, vwin);
}
Esempio n. 22
0
static void stop_guest()
{
	page_t *page;

	page = get_page(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)));
	if (page && page->guest->get_state(page->guest) == GUEST_RUNNING)
	{
		page->guest->stop(page->guest, idle);
	}
}
Esempio n. 23
0
/* Returns the page number of the current page. */
int
clip_GTK_NOTEBOOKGETCURRENTPAGE(ClipMachine * cm)
{
	C_widget      *cntb = _fetch_cw_arg(cm);
	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	_clip_retni(cm,gtk_notebook_get_current_page(GTK_NOTEBOOK(cntb->widget))+1);
	return 0;
err:
	return 1;
}
Esempio n. 24
0
void termit_set_encoding(const gchar* encoding)
{
    gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(termit.notebook));
    TERMIT_GET_TAB_BY_INDEX(pTab, page);
    TRACE("%s tab=%p page=%d encoding=%s", __FUNCTION__, pTab, page, encoding);
    vte_terminal_set_encoding(VTE_TERMINAL(pTab->vte), encoding);
    g_free(pTab->encoding);
    pTab->encoding = g_strdup(encoding);
    termit_set_statusbar_message(page);
}
Esempio n. 25
0
void termit_for_each_visible_row(int lua_callback)
{
    TRACE("%s lua_callback=%d", __FUNCTION__, lua_callback);
    gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(termit.notebook));
    TERMIT_GET_TAB_BY_INDEX(pTab, page);
    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(pTab->scrollbar));
    const glong row_start = ceil(gtk_adjustment_get_value(adj));
    const glong page_size = vte_terminal_get_row_count(VTE_TERMINAL(pTab->vte));
    termit_for_each_row_execute(pTab, row_start, row_start + page_size, lua_callback);
}
Esempio n. 26
0
static void
debug_logger_copy_clicked(GtkWidget *widget, DebugLogger *logger)
{
    GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
    GList *selected_rows = NULL, *entry;
    GtkTreeView *view;
    GtkTreeModel *model;
    GtkTreeSelection *selection;
    gint current_page;
    GString *copy_data;

    g_return_if_fail(IS_DEBUG_LOGGER(logger));

    if (gtk_notebook_get_n_pages(logger->priv->notebook) == 0)
        return;

    copy_data = g_string_new(NULL);

    current_page = gtk_notebook_get_current_page(logger->priv->notebook);

    view =
        GTK_TREE_VIEW(gtk_bin_get_child(
                GTK_BIN(gtk_notebook_get_nth_page(
                        GTK_NOTEBOOK(logger->priv->notebook),
                        current_page))));

    model = gtk_tree_view_get_model(view);
    selection = gtk_tree_view_get_selection(view);

    selected_rows =
        gtk_tree_selection_get_selected_rows(selection, &model);

    for(entry = selected_rows; entry != NULL; entry = g_list_next(entry))
    {
        GtkTreeIter iter;
        gchar *message;

        gtk_tree_model_get_iter(model, &iter, entry->data);
        gtk_tree_model_get(model, &iter, MSG_COLUMN, &message, -1);

        copy_data = g_string_append(copy_data, message);
        copy_data = g_string_append_c(copy_data, '\n');

        g_free(message);
    }

    /* Don't clobber clipboard if we have nothing to add to it. */
    if(copy_data->len != 0)
        gtk_clipboard_set_text(clipboard, copy_data->str, copy_data->len);

    g_string_free(copy_data, TRUE);

    g_list_foreach(selected_rows, (GFunc)gtk_tree_path_free, NULL);
    g_list_free(selected_rows);
}
/* Response signal handler. This function is needed because GtkDialog's 
 * handler for this signal closes the dialog and we don't want that, we 
 * want to change pages and, dimm certain response buttons. Overriding the 
 * virtual function would not work because that would be called after the 
 * signal handler implemented by GtkDialog.
 * FIXME: There is a much saner way to do that [MDK] */
static void 
response                                        (HildonWizardDialog *wizard_dialog,
                                                 gint response_id,
                                                 gpointer unused)
{
    HildonWizardDialogPrivate *priv = HILDON_WIZARD_DIALOG_GET_PRIVATE (wizard_dialog);
    GtkNotebook *notebook = priv->notebook;
    gint current = 0;
    gint last = gtk_notebook_get_n_pages (notebook) - 1;
    gboolean is_first, is_last;

    g_assert (priv);

    current = gtk_notebook_current_page (notebook);

    switch (response_id) {

        case HILDON_WIZARD_DIALOG_PREVIOUS:
            --current;
            is_last = (current == last);
            is_first = (current == 0);
            make_buttons_sensitive (wizard_dialog,
                                    !is_first, !is_first, !is_last); 
            gtk_notebook_prev_page (notebook); /* go to previous page */
            break;

        case HILDON_WIZARD_DIALOG_NEXT:

          if (!priv->forward_function ||
                (*priv->forward_function) (priv->notebook, current, priv->forward_function_data)) {
              ++current;
              is_last = (current == last);
              is_first = (current == 0);
              make_buttons_sensitive (wizard_dialog,
                                      !is_first, !is_first, !is_last);
              gtk_notebook_next_page (notebook); /* go to next page */
            }
            break;

        case HILDON_WIZARD_DIALOG_FINISH:
            return;

    }

    current = gtk_notebook_get_current_page (notebook);
    is_last = current == last;
    is_first = current == 0;

    /* Don't let the dialog close */
    g_signal_stop_emission_by_name (wizard_dialog, "response");

    /* New page number may appear in the title, update it */
    if (priv->autotitle) 
        create_title (wizard_dialog);
}
Esempio n. 28
0
File: t28.cpp Progetto: ombt/ombt
/* Remove a page from the notebook */
static void remove_book( GtkButton   *button,
                         GtkNotebook *notebook )
{
    gint page;
    
    page = gtk_notebook_get_current_page (notebook);
    gtk_notebook_remove_page (notebook, page);
    /* Need to refresh the widget -- 
     This forces the widget to redraw itself. */
    gtk_widget_queue_draw (GTK_WIDGET (notebook));
}
Esempio n. 29
0
static gint
luaH_notebook_switch(lua_State *L)
{
    widget_t *w = luaH_checkudata(L, 1, &widget_class);
    gint i = luaL_checknumber(L, 2);
    /* correct index */
    if (i != -1) i--;
    gtk_notebook_set_current_page(GTK_NOTEBOOK(w->widget), i);
    lua_pushnumber(L, gtk_notebook_get_current_page(GTK_NOTEBOOK(w->widget)));
    return 1;
}
Esempio n. 30
0
UgSelectorPage*	ug_selector_get_page (UgSelector* selector, gint nth_page)
{
	UgSelectorPage*		page;

	if (nth_page < 0)
		nth_page = gtk_notebook_get_current_page (selector->notebook);
	if (nth_page == -1 || nth_page >= (gint)selector->pages->len)
		return NULL;
	page = &g_array_index (selector->pages, UgSelectorPage, nth_page);
	return page;
}