Example #1
0
static WIDGET *
multicol_beginprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
{
  GtkWidget *multicol = gtk_hbox_new(FALSE,1);

  gtk_container_set_border_width (GTK_CONTAINER(multicol), 2);
  gtk_widget_show(multicol);

  prop_dialog_add_raw(dialog,multicol);

  prop_dialog_container_push(dialog,multicol);
  prop_dialog_container_push(dialog,NULL); /* there must be a _COLUMN soon */

  return NULL; /* there is no single widget to add with a label next to it. */
}
Example #2
0
static WIDGET *
notebook_beginprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
{
  GtkWidget *notebook = gtk_notebook_new();

  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_TOP);
  gtk_container_set_border_width (GTK_CONTAINER(notebook), 1);
  gtk_widget_show(notebook);

  prop_dialog_add_raw(dialog,notebook);

  prop_dialog_container_push(dialog,notebook);
  prop_dialog_container_push(dialog,NULL); /* there must be a _PAGE soon */

  return NULL; /* there is no single widget to add with a label next to it. */
}
Example #3
0
static void 
prop_dialog_add_properties(PropDialog *dialog, GPtrArray *props)
{
  guint i;
  gboolean scrollable = (props->len > 16);

  if (scrollable) {
    GtkWidget *swin = gtk_scrolled_window_new (NULL, NULL); 
    GtkWidget *vbox = gtk_vbox_new(FALSE,2);
    gtk_box_pack_start(GTK_BOX (dialog->widget), swin, TRUE, TRUE, 0);
    gtk_widget_show (swin);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swin), vbox);
    gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(swin))), GTK_SHADOW_NONE);
    gtk_widget_show (vbox);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    prop_dialog_container_push (dialog, swin);
    prop_dialog_container_push (dialog, vbox);
  }


  for (i = 0; i < props->len; i++) {
    Property *prop = (Property*)g_ptr_array_index(props,i);
    prop_dialog_add_property(dialog, prop);
  }

  if (scrollable) {
    GtkRequisition requisition;
    GtkWidget *vbox = prop_dialog_container_pop(dialog);
    GtkWidget *swin = prop_dialog_container_pop(dialog);
    GdkScreen *screen = gtk_widget_get_screen(swin);
    gint sheight = screen ? (2 * gdk_screen_get_height(screen)) / 3 : 400;

    gtk_widget_size_request (vbox, &requisition);
    /* I'd say default size calculation for scrollable is quite broken */
    gtk_widget_set_size_request (swin, -1, requisition.height > sheight ? sheight : requisition.height);    
  }
}
Example #4
0
static WIDGET *
multicol_columnprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
{
  GtkWidget *col = gtk_vbox_new(FALSE,1);

  gtk_container_set_border_width (GTK_CONTAINER(col), 2);
  gtk_widget_show(col);

  prop_dialog_container_pop(dialog); /* NULL or the previous column */

  gtk_box_pack_start(GTK_BOX(dialog->lastcont),col,TRUE,TRUE,0);

  prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
  prop_dialog_container_push(dialog,col);

  return NULL;
}
Example #5
0
static WIDGET *
notebook_pageprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
{
  GtkWidget *page = gtk_vbox_new(FALSE,1);
  GtkWidget *label = gtk_label_new(_(prop->common.descr->description));

  gtk_container_set_border_width (GTK_CONTAINER(page), 2);
  gtk_widget_show(page);
  gtk_widget_show(label);

  prop_dialog_container_pop(dialog); /* NULL or the previous page */

  gtk_notebook_append_page(GTK_NOTEBOOK(dialog->lastcont),page,label);

  prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
  prop_dialog_container_push(dialog,page);

  return NULL;
}
Example #6
0
PropDialog *
prop_dialog_new(GList *objects, gboolean is_default) 
{
  PropDialog *dialog = g_new0(PropDialog,1);
  dialog->props = NULL;
  dialog->widget = gtk_vbox_new(FALSE,1);
  dialog->prop_widgets = g_array_new(FALSE,TRUE,sizeof(PropWidgetAssoc));
  dialog->copies = NULL;
  dialog->curtable = NULL;
  dialog->containers = g_ptr_array_new();

  prop_dialog_container_push(dialog,dialog->widget);

  g_object_set_data (G_OBJECT (dialog->widget), prop_dialogdata_key, dialog);
  g_signal_connect (G_OBJECT (dialog->widget), "destroy",
                    G_CALLBACK (prop_dialog_signal_destroy), NULL);

  prop_dialog_fill(dialog,objects,is_default);

  return dialog;
}
Example #7
0
static WIDGET *
frame_beginprop_get_widget(FrameProperty *prop, PropDialog *dialog)
{
  gchar *foldstring = g_strdup_printf("%s <<<", _(prop->common.descr->description));
  gchar *unfoldstring = g_strdup_printf("%s >>>", _(prop->common.descr->description));
  GtkWidget *frame = gtk_frame_new(NULL);
  GtkWidget *vbox = gtk_vbox_new(FALSE,2);
  GtkWidget *foldbutton = gtk_button_new_with_label(foldstring);
  GtkWidget *unfoldbutton = gtk_button_new_with_label(unfoldstring);

  struct FoldButtonInfo *info = g_new(struct FoldButtonInfo, 1);

  g_free(foldstring);
  g_free(unfoldstring);

  info->frame = frame;
  info->unfoldbutton = unfoldbutton;

  gtk_frame_set_label_widget(GTK_FRAME(frame), foldbutton);

  gtk_container_set_border_width (GTK_CONTAINER(frame), 2);
  gtk_container_add(GTK_CONTAINER(frame),vbox);
  gtk_widget_set_sensitive (unfoldbutton, FALSE);
  gtk_widget_show(foldbutton);
  gtk_widget_show(frame);
  gtk_widget_show(vbox);

  prop_dialog_add_raw(dialog, frame);

  prop_dialog_add_raw_with_flags(dialog, unfoldbutton, FALSE, FALSE);

  g_signal_connect(G_OBJECT (foldbutton), "clicked",
		   G_CALLBACK (frame_fold_unfold), info);
  g_signal_connect(G_OBJECT (unfoldbutton), "clicked",
		   G_CALLBACK (frame_fold_unfold), info);

  prop_dialog_container_push(dialog,vbox);

  return NULL; /* there is no single widget to add with a label next to it. */
}