コード例 #1
0
ファイル: gtklayout.c プロジェクト: Distrotech/gtk
static void
gtk_layout_move_internal (GtkLayout       *layout,
                          GtkWidget       *widget,
                          gboolean         change_x,
                          gint             x,
                          gboolean         change_y,
                          gint             y)
{
  GtkLayoutChild *child;

  child = get_child (layout, widget);

  g_assert (child);

  gtk_widget_freeze_child_notify (widget);
  
  if (change_x)
    {
      child->x = x;
      gtk_widget_child_notify (widget, "x");
    }

  if (change_y)
    {
      child->y = y;
      gtk_widget_child_notify (widget, "y");
    }

  gtk_widget_thaw_child_notify (widget);
  
  if (gtk_widget_get_visible (widget) &&
      gtk_widget_get_visible (GTK_WIDGET (layout)))
    gtk_widget_queue_resize (widget);
}
コード例 #2
0
ファイル: ygtkratiobox.c プロジェクト: anaselli/libyui-gtk
void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio)
{
	YGtkRatioBoxChild* child_info;
	child_info = g_new (YGtkRatioBoxChild, 1);
	child_info->widget = child;
	child_info->ratio = ratio;

	box->children = g_list_append (box->children, child_info);

	gtk_widget_freeze_child_notify (child);
	gtk_widget_set_parent (child, GTK_WIDGET (box));
	gtk_widget_thaw_child_notify (child);
}
コード例 #3
0
ファイル: ygtkratiobox.c プロジェクト: anaselli/libyui-gtk
void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child, gfloat ratio)
{
	YGtkRatioBoxChild *child_info;
	child_info = ygtk_ratio_get_child_info (box, child);
	if (child_info) {
		gtk_widget_freeze_child_notify (child);
		child_info->ratio = ratio;
		if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET(box)))
			gtk_widget_queue_resize (child);

		gtk_widget_thaw_child_notify (child);
	}
}
コード例 #4
0
static void
app_build_children (GladeXML *xml, GtkWidget *parent,
		    GladeWidgetInfo *info)
{
    int i;

    for (i = 0; i < info->n_children; i++) {
	GladeChildInfo *cinfo;
	GtkWidget *child;

	cinfo = &info->children[i];

	if (cinfo->internal_child) {
	    /* not quite proper handling of appbar, but ... */
	    if (!strcmp (cinfo->internal_child, "appbar")) {
		child = glade_xml_build_widget (xml, cinfo->child);
		mate_app_set_statusbar (MATE_APP (parent), child);
	    } else {
		glade_xml_handle_internal_child (xml, parent, cinfo);
	    }
	} else {
	    child = glade_xml_build_widget (xml, cinfo->child);

#if 0
	    g_object_ref (G_OBJECT (child));
	    gtk_widget_freeze_child_notify (child);
	    for (j = 0; j < info->children[i].n_properties; j++)
		glade_xml_set_packing_property (
			xml, MATE_APP (parent)->vbox, child,
			cinfo->properties[j].name,
			cinfo->properties[j].value);
	    gtk_widget_thaw_child_notify(child);
	    g_object_unref(G_OBJECT(child));
#endif
	}
    }
}
コード例 #5
0
ファイル: rbgtkwidget.c プロジェクト: adamhooper/ruby-gnome2
static VALUE
rg_freeze_child_notify(VALUE self)
{
    gtk_widget_freeze_child_notify(_SELF(self));
    return self;
}
コード例 #6
0
ファイル: usbtree.c プロジェクト: eerpini/usbview
static void PopulateListBox (int deviceId)
{
	Device  *device;
	char    *string;
	char    *tempString;
	int     configNum;
	int     interfaceNum;
	int     endpointNum;
	int     deviceNumber = (deviceId >> 8);
	int     busNumber = (deviceId & 0x00ff);
	GtkTextIter begin;
	GtkTextIter end;

	device = usb_find_device (deviceNumber, busNumber);
	if (device == NULL) {
		printf ("Can't seem to find device info to display\n");
		return;
	}

	/* clear the textbox */
	gtk_text_buffer_get_start_iter(textDescriptionBuffer,&begin);
	gtk_text_buffer_get_end_iter(textDescriptionBuffer,&end);
	gtk_text_buffer_delete (textDescriptionBuffer, &begin, &end);

	/* freeze the display */
	/* this keeps the annoying scroll from happening */
	gtk_widget_freeze_child_notify(textDescriptionView);

	string = (char *)g_malloc (1000);

	/* add the name to the textbox if we have one*/
	if (device->name != NULL) {
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, device->name,strlen(device->name));
	}

	/* add the manufacturer if we have one */
	if (device->manufacturer != NULL) {
		sprintf (string, "\nManufacturer: %s", device->manufacturer);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
	}

	/* add the serial number if we have one */
	if (device->serialNumber != NULL) {
		sprintf (string, "\nSerial Number: %s", device->serialNumber);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
	}

	/* add speed */
	switch (device->speed) {
		case 1 :        tempString = "1.5Mb/s (low)";   break;
		case 12 :       tempString = "12Mb/s (full)";   break;
		case 480 :      tempString = "480Mb/s (high)";  break;		/* planning ahead... */
		default :       tempString = "unknown";         break;
	}
	sprintf (string, "\nSpeed: %s", tempString);
	gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));

	/* add ports if available */
	if (device->maxChildren) {
		sprintf (string, "\nNumber of Ports: %i", device->maxChildren);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
	}

	/* add the bandwidth info if available */
	if (device->bandwidth != NULL) {
		sprintf (string, "\nBandwidth allocated: %i / %i (%i%%)", device->bandwidth->allocated, device->bandwidth->total, device->bandwidth->percent);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));

		sprintf (string, "\nTotal number of interrupt requests: %i", device->bandwidth->numInterruptRequests);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));

		sprintf (string, "\nTotal number of isochronous requests: %i", device->bandwidth->numIsocRequests);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
	}

	/* add the USB version, device class, subclass, protocol, max packet size, and the number of configurations (if it is there) */
	if (device->version) {
		sprintf (string, "\nUSB Version: %s\nDevice Class: %s\nDevice Subclass: %s\nDevice Protocol: %s\n"
			 "Maximum Default Endpoint Size: %i\nNumber of Configurations: %i",
			 device->version, device->class, device->subClass, device->protocol,
			 device->maxPacketSize, device->numConfigs);
		gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
	}
コード例 #7
0
ファイル: list.c プロジェクト: hilbix/yad
static void
fill_data (gint n_columns)
{
  GtkTreeIter iter;
  GtkListStore *model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list_view)));
  GIOChannel *channel;

  if (options.extra_data && *options.extra_data)
    {
      gchar **args = options.extra_data;
      gint i = 0;

      gtk_widget_freeze_child_notify (list_view);

      while (args[i] != NULL)
        {
          gint j;

          gtk_list_store_append (model, &iter);
          for (j = 0; j < n_columns; j++, i++)
            {
              YadColumn *col = (YadColumn *) g_slist_nth_data (options.list_data.columns, j);
              GdkPixbuf *pb;

              if (args[i] == NULL)
                break;

              switch (col->type)
                {
                case YAD_COLUMN_CHECK:
                case YAD_COLUMN_RADIO:
                  if (strcasecmp ((gchar *) args[i], "true") == 0)
                    gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, TRUE, -1);
                  else
                    gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, FALSE, -1);
                  break;
                case YAD_COLUMN_NUM:
                  gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, g_ascii_strtoll (args[i], NULL, 10), -1);
                  break;
                case YAD_COLUMN_FLOAT:
                  gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, g_ascii_strtod (args[i], NULL), -1);
                  break;
                case YAD_COLUMN_IMAGE:
                  pb = get_pixbuf (args[i], YAD_SMALL_ICON);
                  if (pb)
                    {
                      gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, pb, -1);
                      g_object_unref (pb);
                    }
                  break;
                default:
                  gtk_list_store_set (GTK_LIST_STORE (model), &iter, j, args[i], -1);
                  break;
                }
            }
        }

      gtk_widget_thaw_child_notify (list_view);

      if (settings.always_selected)
        {
          GtkTreeIter it;
          GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list_view));
          GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (list_view));

          gtk_tree_model_get_iter_first (model, &it);
          gtk_tree_selection_select_iter (sel, &it);
        }
    }

  if (options.common_data.listen || !(options.extra_data && *options.extra_data))
    {
      channel = g_io_channel_unix_new (0);
      g_io_channel_set_encoding (channel, NULL, NULL);
      g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
      g_io_add_watch (channel, G_IO_IN | G_IO_HUP, handle_stdin, GINT_TO_POINTER (n_columns));
    }
}