Beispiel #1
0
void tabwin_tab_set_status (windata_t *vwin)
{
    gboolean unsaved = (vwin->flags & VWIN_CONTENT_CHANGED);
    tabwin_t *tabwin = vwin_get_tabwin(vwin);
    GtkWidget *tab, *label;
    const gchar *text, *p;
    gchar *modtext = NULL;

    tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(tabwin->tabs), 
				     vwin->main);
    label = g_object_get_data(G_OBJECT(tab), "label");

    if (label != NULL) {
	text = gtk_label_get_text(GTK_LABEL(label));
	p = strstr(text, " *");
	if (unsaved && p == NULL) {
	    modtext = g_strdup_printf("%s *", text);
	} else if (!unsaved && p != NULL) {
	    modtext = g_strndup(text, strlen(text) - 2);
	}
    }

    if (modtext != NULL) {
	gtk_label_set_text(GTK_LABEL(label), modtext);
	label = g_object_get_data(G_OBJECT(tab), "mlabel");
	if (label != NULL) {
	    gtk_label_set_text(GTK_LABEL(label), modtext);
	}
	g_free(modtext);
    }
}
Beispiel #2
0
/***************************************************************
* OnCloseReferenceImage関数                                    *
* 参考用画像のタブが閉じられる時に呼び出されるコールバック関数 *
* 引数                                                         *
* data	: 参考用画像のデータ                                   *
* page	: 閉じるタブのID                                       *
* 返り値                                                       *
*	常にFALSE                                                  *
***************************************************************/
static gboolean OnCloseReferenceImage(void* data, gint page)
{
	REFERENCE_WINDOW *reference = (REFERENCE_WINDOW*)data;
	int i;

	for(i=page+1; i<reference->data->num_image; i++)
	{
		// タブに設定されているページ番号を再設定
		g_object_set_data(G_OBJECT(g_object_get_data(G_OBJECT(
			gtk_notebook_get_tab_label(GTK_NOTEBOOK(reference->data->note_book),
				reference->data->images[i]->scroll)), "button_widget")), "page", GINT_TO_POINTER(i-1));
	}

	(void)memmove(&reference->data->images[page], &reference->data->images[page+1],
		sizeof(reference->data->images[0]) * (reference->data->num_image - page));

	if(reference->data->active_image >= page)
	{
		reference->data->active_image--;
	}

	if(reference->data->active_image < 0)
	{
		reference->data->active_image = 0;
	}

	reference->data->num_image--;
	if(reference->data->num_image <= 0)
	{
		gtk_widget_set_sensitive(reference->data->scale, FALSE);
	}

	return FALSE;
}
Beispiel #3
0
static void
update_unread (ChatWindow* self)
{
  guint unread_count = 0;
  GtkWidget* page = NULL;
  GtkWidget* hbox = NULL;
  GtkWidget* label = NULL;
  gchar *info = NULL;

  for (gint ii = 0;
       ii < gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->priv->notebook)) ;
       ii++) {

    page
      = gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook), ii);
    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
				       page);
    label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
    unread_count
      = unread_count
      + GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (label), "unread-count"));

  }

  g_signal_emit (self, signals[UNREAD_COUNT], 0, unread_count);

  if (unread_count > 0) {
    info = g_strdup_printf (ngettext ("You have %d unread text message",
                                      "You have %d unread text messages",
                                      unread_count), unread_count);
    boost::shared_ptr<Ekiga::Notification> notif (new Ekiga::Notification (Ekiga::Notification::Warning, info, "", _("Read"), boost::bind (show_chat_window_cb, self)));
    self->priv->notification_core->push_notification (notif);
    g_free (info);
  }
}
Beispiel #4
0
static GtkWidget*
get_label_from_notebook_page (GailNotebookPage *page)
{
  GtkWidget *child;
  GtkNotebook *notebook;

  notebook = page->notebook;
  if (!notebook)
    return NULL;

  if (!gtk_notebook_get_show_tabs (notebook))
    return NULL;

  child = gtk_notebook_get_nth_page (notebook, page->index);
  if (child == NULL) return NULL;
  g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);

  child = gtk_notebook_get_tab_label (notebook, child);

  if (GTK_IS_LABEL (child))
    return child;

  if (GTK_IS_CONTAINER (child))
    child = find_label_child (GTK_CONTAINER (child));

  return child;
}
void
nautilus_notebook_sync_loading (NautilusNotebook *notebook,
				NautilusWindowSlot *slot)
{
	GtkWidget *tab_label, *spinner, *icon;

	g_return_if_fail (NAUTILUS_IS_NOTEBOOK (notebook));
	g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));

	tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), slot->content_box);
	g_return_if_fail (GTK_IS_WIDGET (tab_label));

	spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "spinner"));
	icon = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "icon"));
	g_return_if_fail (spinner != NULL && icon != NULL);

	if (ephy_spinner_get_spinning (EPHY_SPINNER (spinner)) == slot->allow_stop) {
		return;
	}

	if (slot->allow_stop)
	{
		gtk_widget_hide (icon);
		gtk_widget_show (spinner);
		ephy_spinner_start (EPHY_SPINNER (spinner));
	}
	else
	{
		ephy_spinner_stop (EPHY_SPINNER (spinner));
		gtk_widget_hide (spinner);
		gtk_widget_show (icon);
	}
}
static gint
find_tab_num_at_pos (NautilusNotebook *notebook, gint abs_x, gint abs_y)
{
	GtkPositionType tab_pos;
	int page_num = 0;
	GtkNotebook *nb = GTK_NOTEBOOK (notebook);
	GtkWidget *page;

	tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));

	if (GTK_NOTEBOOK (notebook)->first_tab == NULL)
	{
		return AFTER_ALL_TABS;
	}

	/* For some reason unfullscreen + quick click can
	   cause a wrong click event to be reported to the tab */
	if (!is_in_notebook_window(notebook, abs_x, abs_y))
	{
		return NOT_IN_APP_WINDOWS;
	}

	while ((page = gtk_notebook_get_nth_page (nb, page_num)))
	{
		GtkWidget *tab;
		gint max_x, max_y;
		gint x_root, y_root;

		tab = gtk_notebook_get_tab_label (nb, page);
		g_return_val_if_fail (tab != NULL, -1);

		if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
		{
			page_num++;
			continue;
		}

		gdk_window_get_origin (GDK_WINDOW (tab->window),
				       &x_root, &y_root);

		max_x = x_root + tab->allocation.x + tab->allocation.width;
		max_y = y_root + tab->allocation.y + tab->allocation.height;

		if (((tab_pos == GTK_POS_TOP)
		     || (tab_pos == GTK_POS_BOTTOM))
		    &&(abs_x<=max_x))
		{
			return page_num;
		}
		else if (((tab_pos == GTK_POS_LEFT)
			  || (tab_pos == GTK_POS_RIGHT))
			 && (abs_y<=max_y))
		{
			return page_num;
		}

		page_num++;
	}
	return AFTER_ALL_TABS;
}
Beispiel #7
0
void
nautilus_notebook_sync_loading (NautilusNotebook *notebook,
				NautilusWindowSlot *slot)
{
	GtkWidget *tab_label, *spinner, *icon;
	gboolean active;

	g_return_if_fail (NAUTILUS_IS_NOTEBOOK (notebook));
	g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));

	tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), 
						GTK_WIDGET (slot));
	g_return_if_fail (GTK_IS_WIDGET (tab_label));

	spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "spinner"));
	icon = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "icon"));
	g_return_if_fail (spinner != NULL && icon != NULL);

	active = FALSE;
	g_object_get (spinner, "active", &active, NULL);
	if (active == slot->allow_stop)	{
		return;
	}

	if (slot->allow_stop) {
		gtk_widget_hide (icon);
		gtk_widget_show (spinner);
		gtk_spinner_start (GTK_SPINNER (spinner));
	} else {
		gtk_spinner_stop (GTK_SPINNER (spinner));
		gtk_widget_hide (spinner);
		gtk_widget_show (icon);
	}
}
Beispiel #8
0
static gboolean
on_focus_in_event (G_GNUC_UNUSED GtkWidget* widget,
		   G_GNUC_UNUSED GdkEventFocus* event,
		   gpointer data)
{
  ChatWindow* self = (ChatWindow*)data;
  gint num;
  GtkWidget* page = NULL;
  GtkWidget* hbox = NULL;
  GtkWidget* label = NULL;

  num = gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook));
  if (num != -1) { /* the notebook may be empty */

    page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook), num);
    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
				       page);
    label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
    gtk_label_set_text (GTK_LABEL (label),
			(const gchar*)g_object_get_data (G_OBJECT (label),
						       "base-title"));
    g_object_set_data (G_OBJECT (label), "unread-count",
		       GUINT_TO_POINTER (0));

    update_unread (self);
  }

  return FALSE;
}
Beispiel #9
0
static void
on_switch_page (G_GNUC_UNUSED GtkNotebook* notebook,
		G_GNUC_UNUSED gpointer page_,
		guint num,
		gpointer data)
{
  ChatWindow* self = (ChatWindow*)data;
  GtkWidget* page = NULL;
  GtkWidget* hbox = NULL;
  GtkWidget* label = NULL;

  page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook), num);
  hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
				     page);
  label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
  gtk_label_set_text (GTK_LABEL (label),
		      (const gchar*)g_object_get_data (G_OBJECT (label),
						       "base-title"));
  g_object_set_data (G_OBJECT (label), "unread-count",
		     GUINT_TO_POINTER (0));

  update_unread (self);

  gtk_widget_grab_focus (page);
}
Beispiel #10
0
void
nautilus_notebook_sync_tab_label (NautilusNotebook *notebook,
				  NautilusWindowSlot *slot)
{
	GtkWidget *hbox, *label;
	char *location_name;

	g_return_if_fail (NAUTILUS_IS_NOTEBOOK (notebook));
	g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));

	hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), GTK_WIDGET (slot));
	g_return_if_fail (GTK_IS_WIDGET (hbox));

	label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
	g_return_if_fail (GTK_IS_WIDGET (label));

	gtk_label_set_text (GTK_LABEL (label), slot->title);

	if (slot->location != NULL) {
		/* Set the tooltip on the label's parent (the tab label hbox),
		 * so it covers all of the tab label.
		 */
		location_name = g_file_get_parse_name (slot->location);
		gtk_widget_set_tooltip_text (gtk_widget_get_parent (label), location_name);
		g_free (location_name);
	} else {
		gtk_widget_set_tooltip_text (gtk_widget_get_parent (label), NULL);
	}
}
Beispiel #11
0
gboolean
ephy_notebook_tab_is_pinned (EphyNotebook *notebook,
                             EphyEmbed    *embed)
{
  GtkWidget *tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), GTK_WIDGET (embed));

  return ephy_tab_label_is_pinned (tab_label);
}
Beispiel #12
0
void cterm_ontitlechange(VteTerminal* vte, gpointer data) {
    CTerm* term = (CTerm*) data;
    GtkWidget* child = gtk_widget_get_parent((GtkWidget*)vte);
    GtkWidget* container = gtk_notebook_get_tab_label(term->notebook, child);
    GtkWidget* label = gtk_bin_get_child((GtkBin*)container);

    gtk_label_set_label((GtkLabel*)label, vte_terminal_get_window_title(vte));
}
Beispiel #13
0
void cgraphics_workspace_window_update_icon( widget_t *widget )
{
    workspace_window_widget_t * window = (workspace_window_widget_t *)widget;
    GtkNotebook * notebook = GTK_NOTEBOOK(WIDGET(OBJECT(window)->parent)->native);
	GtkWidget * tab_label = gtk_notebook_get_tab_label(notebook, GTK_WIDGET(widget->native));	
	GtkImage * icon = GTK_IMAGE(g_object_get_data(G_OBJECT(tab_label), "icon"));
	if(window->icon)
	    gtk_image_set_from_pixbuf(icon, GDK_PIXBUF(window->icon->native));
}
Beispiel #14
0
static void
on_htmlview_title_changed (gpointer object, gchar *title, gpointer user_data)
{
	tabInfo		*tab = (tabInfo *)user_data;
	GtkWidget	*label;

	label = gtk_notebook_get_tab_label (tabs->priv->notebook, tab->widget);
	gtk_label_set_text (GTK_LABEL(label), create_label_text (title));
}
Beispiel #15
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;
}
Beispiel #16
0
/* Add a page in the project notebook */
static void
cb_druid_insert_project_page (gpointer value, gpointer user_data)
{
	NPWDruid* druid = (NPWDruid*)user_data;
	GtkBuilder *builder;
	GtkWidget* label;
	GtkWidget* child;
	GtkWidget* assistant;
	GtkIconView* view;
	GtkNotebook *book;
	GtkListStore *store;
	GList *template_list = (GList *)value;
	const gchar* category;

	category = npw_header_get_category ((NPWHeader *)template_list->data);

	/* Build another complete wizard dialog from the gtk builder file
	 * but keep only the project selection notebook page */
	builder = gtk_builder_new ();
	if (!gtk_builder_add_from_file (builder, GTK_BUILDER_UI_FILE, NULL))
	{
		g_warn_if_reached ();
		g_object_unref (builder);
		return;
	}

	/* Fill icon view */
	view = GTK_ICON_VIEW (gtk_builder_get_object (builder, PROJECT_LIST));
	gtk_icon_view_set_pixbuf_column (view, PIXBUF_COLUMN);
	gtk_icon_view_set_markup_column (view, TEXT_COLUMN);
	store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
	g_list_foreach (template_list, cb_druid_insert_project_icon, store);
	gtk_icon_view_set_model (view, GTK_TREE_MODEL (store));

	/* Connect signal to update dialog */
	g_signal_connect (G_OBJECT (view), "selection-changed", G_CALLBACK (on_druid_project_update_selected), druid);
	g_signal_connect (G_OBJECT (view), "map", G_CALLBACK (on_druid_project_update_selected), druid);
	g_signal_connect_swapped (G_OBJECT (view), "item-activated", G_CALLBACK (gtk_assistant_next_page), druid->window);

	/* Set new page label */
	assistant = GTK_WIDGET (gtk_builder_get_object (builder, NEW_PROJECT_DIALOG));
	book = GTK_NOTEBOOK (gtk_builder_get_object (builder, PROJECT_BOOK));
	child = gtk_notebook_get_nth_page (book, 0);
	label = gtk_notebook_get_tab_label (book, child);
	gtk_label_set_text (GTK_LABEL(label), (const gchar *)category);

	/* Pick up the filled project selection page from the newly created dialog
	 * add it to the wizard project notebook and destroy the dialog
	 */
	gtk_notebook_remove_page (book, 0);
	gtk_notebook_append_page (druid->project_book, child, label);
	gtk_widget_destroy (assistant);

	g_object_unref (builder);
}
Beispiel #17
0
GtkWidget *
get_tab_label(GtkWidget *page, GtkWidget * widget)
{
  GtkWidget * real_widget = widget;
  g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);

  widget = gtk_notebook_get_menu_label(GTK_NOTEBOOK(page->parent), page);
  if (!(widget)) 
     widget = gtk_notebook_get_tab_label(GTK_NOTEBOOK(page->parent), page);
     
  return widget;
}
Beispiel #18
0
static gboolean
remove_in_idle (gpointer data)
{
  GtkWidget *child = data;
  GtkWidget *parent = gtk_widget_get_parent (child);
  GtkWidget *tab_label;

  tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (parent), child);
  g_print ("Removing tab: %s\n", gtk_label_get_text (GTK_LABEL (tab_label)));
  gtk_container_remove (GTK_CONTAINER (parent), child);

  return G_SOURCE_REMOVE;
}
Beispiel #19
0
GtkWidget *
gnm_notebook_get_nth_label (GnmNotebook *nb, int n)
{
	GtkWidget *page;

	g_return_val_if_fail (GNM_IS_NOTEBOOK (nb), NULL);

	page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (nb), n);
	if (!page)
		return NULL;

	return gtk_notebook_get_tab_label (GTK_NOTEBOOK (nb), page);
}
Beispiel #20
0
void cgraphics_workspace_window_update_title( widget_t *widget )
{
	workspace_window_widget_t * window = (workspace_window_widget_t *)widget;
	GtkNotebook * notebook = GTK_NOTEBOOK(WIDGET(OBJECT(window)->parent)->native);
	GtkWidget * tab_label = gtk_notebook_get_tab_label(notebook, GTK_WIDGET(widget->native));
	
	//should create a custom widget here that contains a label + image
	/*     gtk_notebook_set_tab_label_text(
	        GTK_NOTEBOOK(WIDGET(OBJECT(window)->parent)->native), 
	        GTK_WIDGET(widget->native), window->title);    
	*/
	if(window->title) 
	    gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(tab_label), "label")), window->title);    
}
Beispiel #21
0
/**
 * Given a view, return its index within the toplevel notebook pages.
 *
 * @param top Toplevel containing the notebook.
 * @param view View to look up.
 *
 * @return Index of the view (zero-indexed), or -1 if not found.
 */
static gint toplevel_notebook_find_view(toplevel_t * top, message_view_t * view)
{
	gint num_pages = gtk_notebook_get_n_pages(top->notebook);
	while (num_pages >= 1) {
		GtkWidget *child = gtk_notebook_get_nth_page(top->notebook, num_pages - 1);
		GtkWidget *tab = gtk_notebook_get_tab_label(top->notebook, child);
		message_view_t *v = g_object_get_data(G_OBJECT(tab), "view-object");
		if (v == view) {
			return num_pages - 1;
		}
		num_pages--;
	}
	return -1;
}
Beispiel #22
0
static gint
find_tab_num_at_pos (NautilusNotebook *notebook, gint abs_x, gint abs_y)
{
	GtkPositionType tab_pos;
	int page_num = 0;
	GtkNotebook *nb = GTK_NOTEBOOK (notebook);
	GtkWidget *page;
	GtkAllocation allocation;

	tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));

	while ((page = gtk_notebook_get_nth_page (nb, page_num)))
	{
		GtkWidget *tab;
		gint max_x, max_y;
		gint x_root, y_root;

		tab = gtk_notebook_get_tab_label (nb, page);
		g_return_val_if_fail (tab != NULL, -1);

		if (!gtk_widget_get_mapped (GTK_WIDGET (tab)))
		{
			page_num++;
			continue;
		}

		gdk_window_get_origin (gtk_widget_get_window (tab),
				       &x_root, &y_root);
		gtk_widget_get_allocation (tab, &allocation);

		max_x = x_root + allocation.x + allocation.width;
		max_y = y_root + allocation.y + allocation.height;

		if (((tab_pos == GTK_POS_TOP)
		     || (tab_pos == GTK_POS_BOTTOM))
		    &&(abs_x<=max_x))
		{
			return page_num;
		}
		else if (((tab_pos == GTK_POS_LEFT)
			  || (tab_pos == GTK_POS_RIGHT))
			 && (abs_y<=max_y))
		{
			return page_num;
		}

		page_num++;
	}
	return AFTER_ALL_TABS;
}
Beispiel #23
0
static void
on_message_notice_event (GtkWidget* page,
			 gpointer data)
{
  ChatWindow* self = (ChatWindow*)data;
  gint num = -1;

  for (gint ii = 0;
       ii < gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->priv->notebook)) ;
       ii++) {

    if (page == gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook),
					   ii)) {

      num = ii;
      break;
    }
  }

  if (num
      != gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook))
      || !gtk_window_is_active (GTK_WINDOW (self))) {

    GtkWidget* hbox = NULL;
    GtkWidget* label = NULL;
    guint unread_count = 0;
    const gchar* base_title = NULL;
    gchar* txt = NULL;

    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
				       page);
    label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
    base_title = (const gchar*)g_object_get_data (G_OBJECT (label),
						  "base-title");
    unread_count = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (label),
							"unread-count"));
    unread_count = unread_count + 1;
    g_object_set_data (G_OBJECT (label), "unread-count",
		       GUINT_TO_POINTER (unread_count));

    txt = g_strdup_printf ("[%d] %s", unread_count, base_title);
    gtk_label_set_text (GTK_LABEL (label), txt);
    g_free (txt);

    g_signal_emit (self, signals[UNREAD_ALERT], 0, NULL);
  }

  update_unread (self);
}
Beispiel #24
0
/*!
  \brief hides a tab
  \param widget is the widget clicked to get this to come up
  \param data is the index to the tab to hide
  \return TRUE on success
  */
G_MODULE_EXPORT gboolean hide_tab(GtkWidget *widget, gpointer data)
{
	GtkWidget *child;
	GtkWidget *label;
	GtkWidget *notebook;
	GtkWidget *item = NULL;
	GladeXML *main_xml = NULL;
	extern GdkColor red;
	extern GdkColor black;
	gint index = (GINT)data;
	gint total = (GINT)DATA_GET(global_data,"notebook_rows");
	gint i = 0;
	gboolean hidden = FALSE;
	gint *hidden_list;

	ENTER();
	main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
	hidden_list = (gboolean *)DATA_GET(global_data,"hidden_list");
	notebook = glade_xml_get_widget(main_xml,"toplevel_notebook");

	child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),index);
	label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook),child);

	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
	{
		gtk_widget_hide(child);
		gtk_widget_hide(label);
		hidden_list[index] = TRUE;
	}
	else
	{
		gtk_widget_show(child);
		gtk_widget_show(label);
		hidden_list[index] = FALSE;
	}

	for (i=0;i<total;i++)
	{
		if (hidden_list[i])
			hidden = TRUE;
	}
	item = lookup_widget("show_tab_visibility_menuitem");
	if (hidden)
		 gtk_widget_modify_text(gtk_bin_get_child(GTK_BIN(item)),GTK_STATE_NORMAL,&red);
	else
		 gtk_widget_modify_text(gtk_bin_get_child(GTK_BIN(item)),GTK_STATE_NORMAL,&black);
	EXIT();
	return TRUE;
}
Beispiel #25
0
static void viewer_tab_show_closer (GtkNotebook *notebook,
				    GtkWidget *tab, 
				    gboolean show)
{
    GtkWidget *lbl = gtk_notebook_get_tab_label(notebook, tab);    
    GtkWidget *button = g_object_get_data(G_OBJECT(lbl), "closer");

    if (button != NULL) {
	if (show) {
	    gtk_widget_show(button);
	} else {
	    gtk_widget_hide(button);
	}
    }
}
Beispiel #26
0
static void
debug_logger_switch_page(GtkNotebook *notebook, gpointer page,
                         guint page_num, DebugLogger *logger)
{
    GtkWidget *current_page =
        gtk_notebook_get_nth_page(logger->priv->notebook, page_num);
    GtkWidget *box = gtk_notebook_get_tab_label(logger->priv->notebook,
            current_page);
    GList *list = gtk_container_get_children(GTK_CONTAINER(box));
    GtkImage *image = GTK_IMAGE(list->data);

    g_list_free(list);

    gtk_image_set_from_stock(image, GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
}
Beispiel #27
0
gboolean 
widget_is_tab_label(GtkWidget *page, GtkWidget * widget)
{
  GtkWidget * real_widget = widget;
  g_return_val_if_fail(GTK_IS_WIDGET(widget), FALSE);

  widget = gtk_notebook_get_menu_label(GTK_NOTEBOOK(page->parent), page);
  if (!(widget)) 
     widget = gtk_notebook_get_tab_label(GTK_NOTEBOOK(page->parent), page);
     
  if ((real_widget) && (widget) && (real_widget != widget) && (!(gtk_widget_is_ancestor(real_widget, widget))))
    return FALSE;

  return TRUE;
}
Beispiel #28
0
static void window_title_changed_cb (GtkWidget *widget, gpointer data)
{
    DEBUG_FUNCTION ("window_title_changed_cb");
    DEBUG_ASSERT (widget != NULL);
    DEBUG_ASSERT (data != NULL);

    tilda_term *tt = TILDA_TERM(data);
    gchar *title = get_window_title (widget);
    GtkWidget *label;

    label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (tt->tw->notebook), tt->hbox);
    gtk_label_set_text (GTK_LABEL(label), title);

    g_free (title);
}
Beispiel #29
0
static gint
find_tab_num_at_pos (GtkNotebook *notebook,
                     gint         screen_x,
                     gint         screen_y)
{
	GtkNotebook *nb = GTK_NOTEBOOK (notebook);
	GtkPositionType tab_pos;
	GtkWidget *page;
	GtkAllocation tab_allocation;
	gint page_num = 0;

	tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));

	while ((page = gtk_notebook_get_nth_page (nb, page_num)))
	{
		GtkWidget *tab;
		gint max_x, max_y, x_root, y_root;

		tab = gtk_notebook_get_tab_label (nb, page);
		g_return_val_if_fail (tab != NULL, -1);

		if (!gtk_widget_get_mapped (GTK_WIDGET (tab)))
		{
			page_num++;
			continue;
		}

		gdk_window_get_origin (gtk_widget_get_window (tab), &x_root, &y_root);

		gtk_widget_get_allocation (tab, &tab_allocation);
		max_x = x_root + tab_allocation.x + tab_allocation.width;
		max_y = y_root + tab_allocation.y + tab_allocation.height;

		if ((tab_pos == GTK_POS_TOP || tab_pos == GTK_POS_BOTTOM) && screen_x <= max_x)
		{
			return page_num;
		}

		if ((tab_pos == GTK_POS_LEFT || tab_pos == GTK_POS_RIGHT) && screen_y <= max_y)
		{
			return page_num;
		}

		page_num++;
	}

	return -1;
}
Beispiel #30
0
void CNotebook::SetPageTitle(CWidget* page, string title)
{
	GtkWidget* label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(m_Widget), page->m_Widget);

	/* have been disconnected. */
	if (!label)
		return;

	if( !GTK_IS_LABEL(label) )
	{
		GList *list = gtk_container_get_children(GTK_CONTAINER(label));
		label = GTK_WIDGET(g_list_last(list)->data);
		g_list_free(list);
	}
	gtk_label_set_markup( GTK_LABEL(label), title.c_str() );
}