bool wxNotebook::InsertPage( size_t position,
                             wxNotebookPage* win,
                             const wxString& text,
                             bool select,
                             int imageId )
{
    wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );

    wxCHECK_MSG( win->GetParent() == this, FALSE,
               wxT("Can't add a page whose parent is not the notebook!") );

    wxCHECK_MSG( position <= GetPageCount(), FALSE,
                 wxT("invalid page index in wxNotebookPage::InsertPage()") );

    // Hack Alert! (Part II): See above in wxInsertChildInNotebook callback
    // why this has to be done.  NOTE: using gtk_widget_unparent here does not
    // work as it seems to undo too much and will cause errors in the
    // gtk_notebook_insert_page below, so instead just clear the parent by
    // hand here.
    win->m_widget->parent = NULL;

    // don't receive switch page during addition
    gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
      GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );

    if (m_themeEnabled)
        win->SetThemeEnabled(true);

    GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);

    wxGtkNotebookPage *nb_page = new wxGtkNotebookPage();

    if ( position == GetPageCount() )
        m_pagesData.Append( nb_page );
    else
        m_pagesData.Insert( position, nb_page );

    m_pages.Insert(win, position);

    nb_page->m_box = gtk_hbox_new( FALSE, 1 );
    gtk_container_border_width( GTK_CONTAINER(nb_page->m_box), 2 );

    gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
      GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );

    gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );

    nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;

    /* set the label image */
    nb_page->m_image = imageId;

    if (imageId != -1)
    {
        wxASSERT( HasImageList() );

        const wxBitmap *bmp = GetImageList()->GetBitmapPtr(imageId);
        GdkPixmap *pixmap = bmp->GetPixmap();
        GdkBitmap *mask = NULL;
        if ( bmp->GetMask() )
        {
            mask = bmp->GetMask()->GetBitmap();
        }

        GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );

        gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);

        gtk_widget_show(pixmapwid);
    }

    /* set the label text */

    nb_page->m_text = text;
    if (nb_page->m_text.empty()) nb_page->m_text = wxEmptyString;

    nb_page->m_label = GTK_LABEL( gtk_label_new(wxGTK_CONV(nb_page->m_text)) );
    gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );

    /* apply current style */
    GtkRcStyle *style = CreateWidgetStyle();
    if ( style )
    {
        gtk_widget_modify_style(GTK_WIDGET(nb_page->m_label), style);
        gtk_rc_style_unref(style);
    }

    /* show the label */
    gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
    if (select && (m_pagesData.GetCount() > 1))
    {
      SetSelection( position );
    }

    gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
      GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this );

    InvalidateBestSize();
    return true;
}
static void
thunar_sbr_number_renamer_init (ThunarSbrNumberRenamer *number_renamer)
{
  AtkRelationSet *relations;
  AtkRelation    *relation;
  GEnumClass     *klass;
  AtkObject      *object;
  GtkWidget      *combo;
  GtkWidget      *entry;
  GtkWidget      *label;
  GtkWidget      *hbox;
  guint           n;

  hbox = gtk_hbox_new (FALSE, 12);
  gtk_box_pack_start (GTK_BOX (number_renamer), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  label = gtk_label_new_with_mnemonic (_("_Number Format:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  combo = gtk_combo_box_new_text ();
  klass = g_type_class_ref (THUNAR_SBR_TYPE_NUMBER_MODE);
  for (n = 0; n < klass->n_values; ++n)
    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(klass->values[n].value_nick));
  exo_mutual_binding_new (G_OBJECT (number_renamer), "mode", G_OBJECT (combo), "active");
  gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
  g_type_class_unref (klass);
  gtk_widget_show (combo);

  /* set Atk label relation for the combo */
  object = gtk_widget_get_accessible (combo);
  relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label));
  relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR);
  atk_relation_set_add (relations, relation);
  g_object_unref (G_OBJECT (relation));

  number_renamer->start_entry = gtk_entry_new ();
  gtk_entry_set_max_length (GTK_ENTRY (number_renamer->start_entry), 4);
  gtk_entry_set_width_chars (GTK_ENTRY (number_renamer->start_entry), 3);
  gtk_entry_set_alignment (GTK_ENTRY (number_renamer->start_entry), 1.0f);
  gtk_entry_set_activates_default (GTK_ENTRY (number_renamer->start_entry), TRUE);
  exo_mutual_binding_new (G_OBJECT (number_renamer->start_entry), "text", G_OBJECT (number_renamer), "start");
  gtk_box_pack_end (GTK_BOX (hbox), number_renamer->start_entry, TRUE, TRUE, 0);
  gtk_widget_show (number_renamer->start_entry);

  label = gtk_label_new_with_mnemonic (_("_Start With:"));
  gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), number_renamer->start_entry);
  gtk_widget_show (label);

  /* set Atk label relation for the entry */
  object = gtk_widget_get_accessible (number_renamer->start_entry);
  relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label));
  relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR);
  atk_relation_set_add (relations, relation);
  g_object_unref (G_OBJECT (relation));

  hbox = gtk_hbox_new (FALSE, 12);
  gtk_box_pack_end (GTK_BOX (number_renamer), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  label = gtk_label_new_with_mnemonic (_("Text _Format:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  combo = gtk_combo_box_new_text ();
  klass = g_type_class_ref (THUNAR_SBR_TYPE_TEXT_MODE);
  for (n = 0; n < klass->n_values; ++n)
    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(klass->values[n].value_nick));
  exo_mutual_binding_new (G_OBJECT (number_renamer), "text-mode", G_OBJECT (combo), "active");
  gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
  g_type_class_unref (klass);
  gtk_widget_show (combo);

  /* set Atk label relation for the combo */
  object = gtk_widget_get_accessible (combo);
  relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label));
  relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR);
  atk_relation_set_add (relations, relation);
  g_object_unref (G_OBJECT (relation));

  entry = gtk_entry_new ();
  gtk_entry_set_width_chars (GTK_ENTRY (entry), 4);
  gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
  exo_mutual_binding_new (G_OBJECT (entry), "text", G_OBJECT (number_renamer), "text");
  gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
  gtk_widget_show (entry);

  label = gtk_label_new_with_mnemonic (_("_Text:"));
  gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
  gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
  gtk_widget_show (label);

  /* set Atk label relation for the entry */
  object = gtk_widget_get_accessible (entry);
  relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label));
  relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR);
  atk_relation_set_add (relations, relation);
  g_object_unref (G_OBJECT (relation));
}
Beispiel #3
0
void fenetre_principale( ELEMENT *Element )
{
// Variables
   gint i = 0;

// Widget
   // Widgets des boites
      GtkWidget *p_Hboite[1] = {NULL};
   // Widgets des cadres 
      GtkWidget *p_Cadre[3] = {NULL};
   // Widgets des tableaux pour cadre
      GtkWidget *p_Tableau[3] = {NULL};
   // Widgets des boites à bouton
      GtkWidget *p_Bouton_boite[1] = {NULL};

// création 
   // Création des boites
   	Element -> p_Vboite[0] = gtk_vbox_new ( FALSE,5);
		Element -> p_Vboite[1] = gtk_vbox_new ( FALSE,5);
		Element -> p_Vboite[2] = gtk_vbox_new ( FALSE,5);
		p_Hboite[0] = gtk_hbox_new ( TRUE,5);
   // création des cadres
      p_Cadre[0] = gtk_frame_new ("Vos revenus");
      p_Cadre[1] = gtk_frame_new ("Votre prêt");
      p_Cadre[2] = gtk_frame_new ("Résultats");
   // création des tableaux
      p_Tableau[0] = gtk_table_new ( 3,2,FALSE );
      p_Tableau[1] = gtk_table_new ( 3,3,FALSE );
      p_Tableau[2] = gtk_table_new ( 3,6,FALSE );
   // création des sélecteurs numériques
      Element -> p_Selecteur[0] = gtk_spin_button_new_with_range (10,99999,10);
      gtk_spin_button_set_value
         (GTK_SPIN_BUTTON(Element -> p_Selecteur[0]),1000);
      Element -> p_Selecteur[1] = gtk_spin_button_new_with_range (10,99999,10);
      gtk_spin_button_set_value
         (GTK_SPIN_BUTTON(Element -> p_Selecteur[1]),1000);
      Element -> p_Selecteur[2] = gtk_spin_button_new_with_range (0.00,99.99,0.01);
      gtk_spin_button_set_value
         (GTK_SPIN_BUTTON(Element -> p_Selecteur[2]),5.0);
      Element -> p_Selecteur[3] = gtk_spin_button_new_with_range (1,30,1);
      gtk_spin_button_set_value
         (GTK_SPIN_BUTTON(Element -> p_Selecteur[3]),15);
      Element -> p_Selecteur[4] = gtk_spin_button_new_with_range (1,9999999,100);
      gtk_spin_button_set_value
         (GTK_SPIN_BUTTON(Element -> p_Selecteur[4]),100000);
   // création des étiquettes
      Element -> p_Etiq[0] = gtk_label_new("Salaire net emprunteur n°1 : ");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[0]),1.0,0.5);
      Element -> p_Etiq[1] = gtk_label_new("Salaire net emprunteur n°2 : ");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[1]),1.0,0.5);
      Element -> p_Etiq[2] = gtk_label_new("   €   ");
      Element -> p_Etiq[3] = gtk_label_new("   €   ");
      Element -> p_Etiq[4] = gtk_label_new("Taux d'intérêt annuel : ");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[4]),1.0,0.5);
      Element -> p_Etiq[5] = gtk_label_new("Durée de l'emprunt : ");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[5]),1.0,0.5);
      Element -> p_Etiq[6] = gtk_label_new("Somme empruntée : ");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[6]),1.0,0.5);
      Element -> p_Etiq[7] = gtk_label_new(" % ");
      Element -> p_Etiq[8] = gtk_label_new(" ans ");
      Element -> p_Etiq[9] = gtk_label_new("   €   ");
      Element -> p_Etiq[10] = gtk_label_new(" Votre mensualité :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[10]),1.0,0.5);
      Element -> p_Etiq[11] = gtk_label_new(" Votre mensualité maxi :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[11]),1.0,0.5);
      Element -> p_Etiq[12] = gtk_label_new(" Votre endettement :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[12]),1.0,0.5);
      Element -> p_Etiq[13] = gtk_label_new(" Votre capacité d'emprunt :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[13]),1.0,0.5);
      Element -> p_Etiq[14] = gtk_label_new(" Le montant des intérêts :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[14]),1.0,0.5);
      Element -> p_Etiq[15] = gtk_label_new(" Le coût total du crédit :");
      gtk_misc_set_alignment(GTK_MISC(Element -> p_Etiq[15]),1.0,0.5);
      Element -> p_Etiq[16] = gtk_label_new(" 0000 € ");
      Element -> p_Etiq[17] = gtk_label_new(" 0000 € ");
      Element -> p_Etiq[18] = gtk_label_new(" 00 % ");
      Element -> p_Etiq[19] = gtk_label_new("   €   ");
      Element -> p_Etiq[20] = gtk_label_new("   €   ");
      Element -> p_Etiq[21] = gtk_label_new("   €   ");
      Element -> p_Etiq[22] = gtk_label_new("- TABLEAU D'AMORTISSEMENT -");
   // création des boites à bouton
      p_Bouton_boite[0] = gtk_hbutton_box_new();
   // création des boutons
      Element -> p_Bouton[0] = gtk_button_new_with_label("CALCULER");  
      Element -> p_Bouton[1] = gtk_button_new_with_label("QUITTER");  

// construction de la fenêtre principale
   Element -> p_Fenetre[0] = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_position(GTK_WINDOW(Element -> p_Fenetre[0]),
      GTK_WIN_POS_CENTER);
   gtk_window_set_default_size(GTK_WINDOW(Element -> p_Fenetre[0]), 
     LARGEUR_FENETRE, HAUTEUR_FENETRE);
   gtk_window_set_title(GTK_WINDOW(Element -> p_Fenetre[0]),TITRE_FENETRE);
   gtk_window_set_icon_from_file(GTK_WINDOW(Element -> p_Fenetre[0]),
      ICONE,NULL);

// Assemblage des boites 
	gtk_container_add(GTK_CONTAINER(Element -> p_Fenetre[0]), Element -> p_Vboite[0]);
	gtk_box_pack_start(GTK_BOX(Element -> p_Vboite[0]), p_Hboite[0], FALSE,FALSE,5);
	gtk_box_pack_start(GTK_BOX(p_Hboite[0]), Element -> p_Vboite[1], TRUE,TRUE,5);
	gtk_box_pack_start(GTK_BOX(p_Hboite[0]), Element -> p_Vboite[2], TRUE,TRUE,5);
	gtk_box_pack_end(GTK_BOX(Element -> p_Vboite[0]), p_Bouton_boite[0], FALSE,FALSE,5);

// Cadre pour les revenus 
	gtk_box_pack_start(GTK_BOX(Element -> p_Vboite[1]), p_Cadre[0], TRUE,TRUE,5);
	gtk_container_add(GTK_CONTAINER(p_Cadre[0]), p_Tableau[0]);
// premier tableau 
   for (i = 0; i < 2 ; i++ )
   {
     gtk_table_attach(GTK_TABLE(p_Tableau[0]), Element -> p_Etiq[i],
        0, 1, i, i+1,GTK_EXPAND | GTK_FILL ,GTK_EXPAND,
        5, 5);
     gtk_table_attach(GTK_TABLE(p_Tableau[0]), Element -> p_Selecteur[i],
        1, 2, i, i+1,GTK_FILL, GTK_EXPAND,
        0, 0);
     gtk_table_attach(GTK_TABLE(p_Tableau[0]), Element -> p_Etiq[i+2],
        2, 3, i, i+1,GTK_FILL, GTK_EXPAND,
        0, 0);
   }
// Cadre pour le prêt 
	gtk_box_pack_start(GTK_BOX(Element -> p_Vboite[1]), p_Cadre[1], TRUE,TRUE,5);
	gtk_container_add(GTK_CONTAINER(p_Cadre[1]), p_Tableau[1]);
// deuxième tableau 
   for (i = 2; i < 5 ; i++ )
   {
     gtk_table_attach(GTK_TABLE(p_Tableau[1]), Element -> p_Etiq[i+2],
        0, 1, i-2, i-1,GTK_EXPAND | GTK_FILL ,GTK_EXPAND,
        5, 5);
     gtk_table_attach(GTK_TABLE(p_Tableau[1]), Element -> p_Selecteur[i],
        1, 2, i-2, i-1,GTK_FILL, GTK_EXPAND,
        0, 0);
     gtk_table_attach(GTK_TABLE(p_Tableau[1]), Element -> p_Etiq[i+5],
        2, 3, i-2, i-1,GTK_FILL, GTK_EXPAND,
        0, 0);
   }
// Cadre pour les résultats
	gtk_box_pack_start(GTK_BOX(Element -> p_Vboite[2]), p_Cadre[2], TRUE,TRUE,5);
	gtk_container_add(GTK_CONTAINER(p_Cadre[2]), p_Tableau[2]);
// troisième tableau 
   for (i = 10; i < 16 ; i++ )
   {
     gtk_table_attach(GTK_TABLE(p_Tableau[2]), Element -> p_Etiq[i],
        0, 1, i-10, i-9,GTK_EXPAND | GTK_FILL ,GTK_EXPAND,
        5, 5);
     gtk_table_attach(GTK_TABLE(p_Tableau[2]), Element -> p_Etiq[i+6],
        1, 3, i-10, i-9,GTK_EXPAND | GTK_FILL ,GTK_EXPAND,
        5, 5);
   }
// Ajoute des boutons dans la boite spécifique
	gtk_button_box_set_layout
      (GTK_BUTTON_BOX(p_Bouton_boite[0]),GTK_BUTTONBOX_CENTER);
	gtk_box_pack_start(GTK_BOX(p_Bouton_boite[0]), Element -> p_Bouton[0], FALSE,FALSE,5);
	gtk_box_pack_end(GTK_BOX(p_Bouton_boite[0]), Element -> p_Bouton[1], FALSE,FALSE,5);
// Définition des callbacks
     g_signal_connect (
        G_OBJECT (Element -> p_Fenetre[0]), 
        "destroy",G_CALLBACK(gtk_main_quit),NULL
        );
     g_signal_connect (
        G_OBJECT (Element -> p_Bouton[1]), 
        "clicked",G_CALLBACK(gtk_main_quit),NULL
        );
     g_signal_connect (
        G_OBJECT (Element -> p_Bouton[0]), 
        "clicked",G_CALLBACK(Calcul_pret),Element
        );
}
Beispiel #4
0
GtkWidget *
gimp_thumb_box_new (GimpContext *context)
{
  GimpThumbBox   *box;
  GtkWidget      *vbox;
  GtkWidget      *vbox2;
  GtkWidget      *ebox;
  GtkWidget      *hbox;
  GtkWidget      *button;
  GtkWidget      *label;
  gchar          *str;
  gint            h, v;
  GtkRequisition  info_requisition;
  GtkRequisition  progress_requisition;

  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);

  box = g_object_new (GIMP_TYPE_THUMB_BOX, NULL);

  box->context = context;

  ebox = gtk_event_box_new ();
  gtk_container_add (GTK_CONTAINER (box), ebox);
  gtk_widget_show (ebox);

  g_signal_connect (ebox, "button-press-event",
                    G_CALLBACK (gimp_thumb_box_ebox_button_press),
                    box);

  str = g_strdup_printf (_("Click to update preview\n"
                           "%s-Click to force update even "
                           "if preview is up-to-date"),
                         gimp_get_mod_string (gimp_get_toggle_behavior_mask ()));

  gimp_help_set_help_data (ebox, str, NULL);

  g_free (str);

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_container_add (GTK_CONTAINER (ebox), vbox);
  gtk_widget_show (vbox);

  button = gtk_button_new ();
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  label = gtk_label_new_with_mnemonic (_("Pr_eview"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_container_add (GTK_CONTAINER (button), label);
  gtk_widget_show (label);

  g_signal_connect (button, "button-press-event",
                    G_CALLBACK (gtk_true),
                    NULL);
  g_signal_connect (button, "button-release-event",
                    G_CALLBACK (gtk_true),
                    NULL);
  g_signal_connect (button, "enter-notify-event",
                    G_CALLBACK (gtk_true),
                    NULL);
  g_signal_connect (button, "leave-notify-event",
                    G_CALLBACK (gtk_true),
                    NULL);

  vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
  gtk_box_pack_start (GTK_BOX (vbox), vbox2, TRUE, TRUE, 0);
  gtk_widget_show (vbox2);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  box->imagefile = gimp_imagefile_new (context->gimp, NULL);

  g_signal_connect (box->imagefile, "info-changed",
                    G_CALLBACK (gimp_thumb_box_imagefile_info_changed),
                    box);

  g_signal_connect (gimp_imagefile_get_thumbnail (box->imagefile),
                    "notify::thumb-state",
                    G_CALLBACK (gimp_thumb_box_thumb_state_notify),
                    box);

  gimp_view_renderer_get_frame_size (&h, &v);

  box->preview = gimp_view_new (context,
                                GIMP_VIEWABLE (box->imagefile),
                                /* add padding for the shadow frame */
                                context->gimp->config->thumbnail_size +
                                MAX (h, v),
                                0, FALSE);

  gtk_box_pack_start (GTK_BOX (hbox), box->preview, TRUE, FALSE, 2);
  gtk_widget_show (box->preview);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label), box->preview);

  g_signal_connect (box->preview, "clicked",
                    G_CALLBACK (gimp_thumb_box_thumbnail_clicked),
                    box);

  box->filename = gtk_label_new (_("No selection"));
  gtk_label_set_ellipsize (GTK_LABEL (box->filename), PANGO_ELLIPSIZE_MIDDLE);
  gtk_label_set_justify (GTK_LABEL (box->filename), GTK_JUSTIFY_CENTER);
  gimp_label_set_attributes (GTK_LABEL (box->filename),
                             PANGO_ATTR_STYLE, PANGO_STYLE_OBLIQUE,
                             -1);
  gtk_box_pack_start (GTK_BOX (vbox2), box->filename, FALSE, FALSE, 0);
  gtk_widget_show (box->filename);

  box->info = gtk_label_new (" \n \n \n ");
  gtk_misc_set_alignment (GTK_MISC (box->info), 0.5, 0.0);
  gtk_label_set_justify (GTK_LABEL (box->info), GTK_JUSTIFY_CENTER);
  gtk_label_set_line_wrap (GTK_LABEL (box->info), TRUE);
  gimp_label_set_attributes (GTK_LABEL (box->info),
                             PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
                             -1);
  gtk_box_pack_start (GTK_BOX (vbox2), box->info, FALSE, FALSE, 0);
  gtk_widget_show (box->info);

  box->progress = gtk_progress_bar_new ();
  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), "Fog");
  gtk_box_pack_end (GTK_BOX (vbox2), box->progress, FALSE, FALSE, 0);
  gtk_widget_set_no_show_all (box->progress, TRUE);
  /* don't gtk_widget_show (box->progress); */

  /* eek */
  gtk_widget_size_request (box->info,     &info_requisition);
  gtk_widget_size_request (box->progress, &progress_requisition);

  gtk_widget_set_size_request (box->info,
                               -1, info_requisition.height);
  gtk_widget_set_size_request (box->filename,
                               progress_requisition.width, -1);

  gtk_widget_set_size_request (box->progress,
                               -1, progress_requisition.height);
  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), "");

  return GTK_WIDGET (box);
}
Beispiel #5
0
static void
anjuta_app_instance_init (AnjutaApp *app)
{
	gint merge_id;
	GtkWidget *menubar, *about_menu;
	GtkWidget *view_menu, *hbox;
	GtkWidget *main_box;
	GtkWidget *dockbar;
	GtkAction* action;
	GList *plugins_dirs = NULL;
	gchar* style;
	GdkGeometry size_hints = {
    	100, 100, 0, 0, 100, 100, 1, 1, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
  	};
	
	DEBUG_PRINT ("%s", "Initializing Anjuta...");
	
	gtk_window_set_geometry_hints (GTK_WINDOW (app), GTK_WIDGET (app),
								   &size_hints, GDK_HINT_RESIZE_INC);
	gtk_window_set_resizable (GTK_WINDOW (app), TRUE);
	
	/*
	 * Main box
	 */
	main_box = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (app), main_box);
	gtk_widget_show (main_box);
	
	app->values = NULL;
	app->widgets = NULL;
	
	/* Status bar */
	app->status = ANJUTA_STATUS (anjuta_status_new ());
	anjuta_status_set_title_window (app->status, GTK_WIDGET (app));
	gtk_widget_show (GTK_WIDGET (app->status));
	gtk_box_pack_end (GTK_BOX (main_box),
					  GTK_WIDGET (app->status), FALSE, TRUE, 0);
	g_object_ref (G_OBJECT (app->status));
	g_object_add_weak_pointer (G_OBJECT (app->status), (gpointer)&app->status);
	
	/* configure dock */
	hbox = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox);
	app->dock = gdl_dock_new ();
	gtk_widget_show (app->dock);
	gtk_box_pack_end(GTK_BOX (hbox), app->dock, TRUE, TRUE, 0);
	
	dockbar = gdl_dock_bar_new (GDL_DOCK(app->dock));
	gtk_widget_show (dockbar);
	gtk_box_pack_start(GTK_BOX (hbox), dockbar, FALSE, FALSE, 0);
	
	app->layout_manager = gdl_dock_layout_new (GDL_DOCK (app->dock));
	g_signal_connect (app->layout_manager, "notify::dirty",
					  G_CALLBACK (on_layout_dirty_notify), app);
	g_signal_connect (app->layout_manager->master, "notify::locked",
					  G_CALLBACK (on_layout_locked_notify), app);
	
	/* UI engine */
	app->ui = anjuta_ui_new ();
	g_object_add_weak_pointer (G_OBJECT (app->ui), (gpointer)&app->ui);
	/* show tooltips in the statusbar */
	g_signal_connect (app->ui,
			  "connect_proxy",
			  G_CALLBACK (connect_proxy_cb),
			  app);
	g_signal_connect (app->ui,
			  "disconnect_proxy",
			  G_CALLBACK (disconnect_proxy_cb),
			  app);
	
	/* Plugin Manager */
	plugins_dirs = g_list_prepend (plugins_dirs, PACKAGE_PLUGIN_DIR);
	app->plugin_manager = anjuta_plugin_manager_new (G_OBJECT (app),
													 app->status,
													 plugins_dirs);
	app->profile_manager = anjuta_profile_manager_new (app->plugin_manager);
	g_list_free (plugins_dirs);
	
	/* Preferences */
	app->preferences = anjuta_preferences_new (app->plugin_manager);
	g_object_add_weak_pointer (G_OBJECT (app->preferences),
							   (gpointer)&app->preferences);
	
	anjuta_preferences_notify_add_string (app->preferences, "anjuta.gdl.style",
	                                      on_gdl_style_changed, app, NULL);
	style = anjuta_preferences_get (app->preferences, "anjuta.gdl.style");
	
	on_gdl_style_changed (app->preferences, NULL, 
	                      style, app);
	g_free (style);
	
	/* Register actions */
	anjuta_ui_add_action_group_entries (app->ui, "ActionGroupFile", _("File"),
										menu_entries_file,
										G_N_ELEMENTS (menu_entries_file),
										GETTEXT_PACKAGE, TRUE, app);
	anjuta_ui_add_action_group_entries (app->ui, "ActionGroupEdit", _("Edit"),
										menu_entries_edit,
										G_N_ELEMENTS (menu_entries_edit),
										GETTEXT_PACKAGE, TRUE, app);
	anjuta_ui_add_action_group_entries (app->ui, "ActionGroupView", _("View"),
										menu_entries_view,
										G_N_ELEMENTS (menu_entries_view),
										GETTEXT_PACKAGE, TRUE, app);
	anjuta_ui_add_toggle_action_group_entries (app->ui, "ActionGroupToggleView",
										_("View"),
										menu_entries_toggle_view,
										G_N_ELEMENTS (menu_entries_toggle_view),
										GETTEXT_PACKAGE, TRUE, app);
	anjuta_ui_add_action_group_entries (app->ui, "ActionGroupHelp", _("Help"),
										menu_entries_help,
										G_N_ELEMENTS (menu_entries_help),
										GETTEXT_PACKAGE, TRUE, app);

	/* Merge UI */
	merge_id = anjuta_ui_merge (app->ui, UI_FILE);
	
	/* Adding accels group */
	gtk_window_add_accel_group (GTK_WINDOW (app), 
								gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (app->ui)));
	
	/* create main menu */
	menubar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (app->ui),
										 "/MenuMain");
	gtk_box_pack_start (GTK_BOX (main_box), menubar, FALSE, FALSE, 0);
	gtk_widget_show (menubar);
	
	/* create toolbar */	
	app->toolbar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (app->ui),
										 "/ToolbarMain");
    if (!anjuta_preferences_get_bool (app->preferences, "anjuta.toolbar.visible"))
		gtk_widget_hide (app->toolbar);
	gtk_box_pack_start (GTK_BOX (main_box), app->toolbar, FALSE, FALSE, 0);
	action = gtk_ui_manager_get_action (GTK_UI_MANAGER (app->ui),
										"/MenuMain/MenuView/Toolbar");
	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action),
								  anjuta_preferences_get_bool_with_default (app->preferences,
																		   "anjuta.toolbar.visible",
																		   TRUE));
	anjuta_preferences_notify_add_string (app->preferences, "anjuta.toolbar.style",
								   on_toolbar_style_changed, app, NULL);
	style = anjuta_preferences_get (app->preferences, "anjuta.toolbar.style");
	on_toolbar_style_changed (app->preferences, NULL, style, app);
	g_free (style);

	/* Create widgets menu */
	view_menu = 
		gtk_ui_manager_get_widget (GTK_UI_MANAGER(app->ui),
								  "/MenuMain/MenuView");
	app->view_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (view_menu));	

	/* Disable unavailible tutorials */
	action = anjuta_ui_get_action(app->ui, "ActionGroupHelp", "ActionHelpTutorial");
	g_object_set(G_OBJECT(action), "visible", FALSE, NULL);
	action = anjuta_ui_get_action(app->ui, "ActionGroupHelp", "ActionHelpAdvancedTutorial");
	g_object_set(G_OBJECT(action), "visible", FALSE, NULL);
	
	/* Create about plugins menu */
	about_menu = 
		gtk_ui_manager_get_widget (GTK_UI_MANAGER(app->ui),
								   "/MenuMain/PlaceHolderHelpMenus/MenuHelp/"
								   "PlaceHolderHelpAbout/AboutPlugins");
	about_create_plugins_submenu (ANJUTA_SHELL (app), about_menu);
	
	/* Add main view */
	gtk_box_pack_start (GTK_BOX (main_box), hbox, TRUE, TRUE, 0);
						
	/* Connect to session */
	g_signal_connect (G_OBJECT (app), "save_session",
					  G_CALLBACK (on_session_save), app);
	g_signal_connect (G_OBJECT (app), "load_session",
					  G_CALLBACK (on_session_load), app);
	
	/* Loading accels */
	anjuta_ui_load_accels (NULL);

	app->save_count = 0;
}
Beispiel #6
0
GtkWidget *
gtkam_main_new (void)
{
    GtkamMain *m;
    GdkPixbuf *pixbuf;
    GtkActionGroup *action_group;
    GtkUIManager *ui_manager;
    GtkAccelGroup *accel_group;
    GtkWidget *widget, *vbox, *scrolled, *hpaned, *t;

    m = g_object_new (GTKAM_TYPE_MAIN, NULL);
    gtk_window_set_title (GTK_WINDOW (m), PACKAGE);
    pixbuf = gdk_pixbuf_new_from_file (IMAGE_DIR "/gtkam-camera.png", NULL);
    if (pixbuf != NULL) {
        gtk_window_set_icon (GTK_WINDOW (m), pixbuf);
        gdk_pixbuf_unref (pixbuf);
    }

    m->priv->view_thumbs = TRUE;

    vbox = gtk_vbox_new (FALSE, 1);
    gtk_widget_show (vbox);
    gtk_container_add (GTK_CONTAINER (m), vbox);

    /* Menu */
    action_group = gtk_action_group_new ("MenuActions");
#ifdef GETTEXT_PACKAGE
    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
#endif
    gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), m);
    gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), m);

    ui_manager = gtk_ui_manager_new ();
    gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);

    accel_group = gtk_ui_manager_get_accel_group (ui_manager);
    gtk_window_add_accel_group (GTK_WINDOW (m), accel_group);

    gtk_ui_manager_add_ui_from_string(ui_manager, ui_description, -1, NULL);
    widget = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
    gtk_widget_show (widget);
    gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
    m->priv->ui_manager = GTK_UI_MANAGER (ui_manager);

    /* Toolbar */
    t = gtk_ui_manager_get_widget (ui_manager, "/MainToolbar");
    gtk_toolbar_set_style (GTK_TOOLBAR (t), GTK_TOOLBAR_BOTH);
    gtk_box_pack_start (GTK_BOX (vbox), t, FALSE, FALSE, 0);

    /*
     * Context information
     */
    m->priv->status = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (m->priv->status);
    gtk_box_pack_end (GTK_BOX (vbox), m->priv->status, FALSE, FALSE, 0);

    /*
     * Main content
     */
    hpaned = gtk_hpaned_new ();
    gtk_widget_show (hpaned);
    gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (hpaned), 2);
    gtk_paned_set_position (GTK_PANED (hpaned), 200);

    /*
     * Left
     */
    scrolled = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show (scrolled);
    gtk_paned_pack1 (GTK_PANED (hpaned), scrolled, TRUE, TRUE);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    m->priv->tree = gtkam_tree_new ();
    gtk_widget_show (m->priv->tree);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled),
                                           m->priv->tree);
    g_signal_connect (G_OBJECT (m->priv->tree), "folder_selected",
                      G_CALLBACK (on_folder_selected), m);
    g_signal_connect (G_OBJECT (m->priv->tree), "folder_unselected",
                      G_CALLBACK (on_folder_unselected), m);
    g_signal_connect (G_OBJECT (m->priv->tree), "new_status",
                      G_CALLBACK (on_new_status), m);
    g_signal_connect (G_OBJECT (m->priv->tree), "new_error",
                      G_CALLBACK (on_tree_new_error), m);
    g_signal_connect (G_OBJECT (m->priv->tree), "file_added",
                      G_CALLBACK (on_tree_file_added), m);
    g_signal_connect (G_OBJECT (m->priv->tree), "new_dialog",
                      G_CALLBACK (on_new_dialog), m);

    /*
     * Right
     */
    scrolled = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show (scrolled);
    gtk_paned_pack2 (GTK_PANED (hpaned), scrolled, TRUE, TRUE);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    m->priv->list = gtkam_list_new ();
    gtk_widget_show (m->priv->list);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled),
                                           m->priv->list);
    g_signal_connect (G_OBJECT (m->priv->list), "file_selected",
                      G_CALLBACK (on_file_selected), m);
    g_signal_connect (G_OBJECT (m->priv->list), "file_unselected",
                      G_CALLBACK (on_file_unselected), m);
    g_signal_connect (G_OBJECT (m->priv->list), "new_status",
                      G_CALLBACK (on_new_status), m);
    g_signal_connect (G_OBJECT (m->priv->list), "new_dialog",
                      G_CALLBACK (on_new_dialog), m);

    gtkam_main_update_sensitivity (m);

    return (GTK_WIDGET (m));
}
Beispiel #7
0
gint main (gint argc, gchar **argv)
{
	GFile     *file;
	GXPSFile  *xps;
	GXPSView  *view;
	GtkWidget *win;
	GtkWidget *hbox, *vbox, *sw;
        GtkWidget *button;
	guint      page = 0;
	GError    *error = NULL;

	if (argc < 2) {
		g_printerr ("Use: test-xps file\n");

		return 1;
	}

	gtk_init (&argc, &argv);

	file = g_file_new_for_commandline_arg (argv[1]);
	xps = gxps_file_new (file, &error);
	g_object_unref (file);

	if (error) {
		g_printerr ("Error creating file: %s\n", error->message);
		g_error_free (error);
		g_object_unref (xps);

		return 1;
	}

	view = g_new0 (GXPSView, 1);
	view->doc = gxps_file_get_document (xps, 0, &error);
	if (error) {
		g_printerr ("Error getting document 0: %s\n", error->message);
		g_error_free (error);
		g_object_unref (xps);

		return 1;
	}

	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW (win), 600, 600);
	g_signal_connect (win, "delete-event",
			  G_CALLBACK (gtk_main_quit),
			  NULL);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);

	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	view->spin_button = gtk_spin_button_new_with_range  (0,
							     gxps_document_get_n_pages (view->doc) - 1,
							     1);
	g_signal_connect (view->spin_button,
			  "value-changed",
			  G_CALLBACK (page_changed_callback),
			  view);
	gtk_box_pack_end (GTK_BOX (hbox), view->spin_button, FALSE, TRUE, 0);
	gtk_widget_show (view->spin_button);

        button = gtk_button_new ();
        g_signal_connect (button, "clicked",
                          G_CALLBACK (properties_button_clicked),
                          xps);
        gtk_button_set_image (GTK_BUTTON (button),
                              gtk_image_new_from_icon_name ("document-properties", GTK_ICON_SIZE_SMALL_TOOLBAR));
        gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
        gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
	gtk_widget_show (hbox);

	view->darea = gtk_drawing_area_new ();
	g_signal_connect (view->darea, "draw",
			  G_CALLBACK (drawing_area_draw),
			  view);

	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);
	gtk_container_add (GTK_CONTAINER (sw), view->darea);
	gtk_widget_show (view->darea);

	gtk_box_pack_end (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
	gtk_widget_show (sw);

	gtk_container_add (GTK_CONTAINER (win), vbox);
	gtk_widget_show (vbox);

	gtk_widget_show (win);

	if (argc > 2)
		page = atoi (argv[2]);
	gtk_spin_button_set_value (GTK_SPIN_BUTTON (view->spin_button), page);
	if (page == 0)
		page_changed_callback (GTK_SPIN_BUTTON (view->spin_button), view);

	gtk_main ();

	g_object_unref (view->doc);
	g_object_unref (xps);
	cairo_surface_destroy (view->surface);
	g_free (view);

	return 0;
}
Beispiel #8
0
//
// Object hierarchy:
//      parentWindow
//        |-- background (event-box)
//             |-- screen_alignment
//                   |-- topLevelVBox (vbox)
//                         |-- title_hbox
//                         |     |-- title_padding (event box)
//                         |     |-- title_background (event box)
//                         |           |-- g_titleItem (label)
//                         |-- g_settingsArea (event box)
//
static GtkWidget *bg_screen_create(GtkWidget *parentWindow)
{
    GtkWidget *background;
    GtkWidget *topLevelVBox;
    GtkWidget *title_background;
    GtkWidget *title_hbox;
    GtkWidget *title_padding;
    GtkWidget *screen_alignment;

    // background
    background = gtk_event_box_new();
    gtk_widget_set_name(GTK_WIDGET(background), "screen_background");
    gtk_container_add(GTK_CONTAINER(parentWindow), background);

    // screen_alignment
    screen_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
    gtk_widget_set_name(GTK_WIDGET(screen_alignment), "screen_background");
    gtk_alignment_set_padding(GTK_ALIGNMENT(screen_alignment),
                              SCREEN_BORDER_TOP,
                              SCREEN_BORDER_BOTTOM,
                              1,
                              SCREEN_BORDER_RIGHT);
    gtk_container_add(GTK_CONTAINER(background), screen_alignment);

    // topLevelVBox
    topLevelVBox = gtk_vbox_new(FALSE, SCREEN_ITEM_SPACING);
    gtk_container_add(GTK_CONTAINER(screen_alignment), topLevelVBox);

    // title_hbox
    title_hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(topLevelVBox), title_hbox, FALSE, FALSE, 0);

    // title_padding
    title_padding = gtk_event_box_new();
    gtk_widget_set_name(GTK_WIDGET(title_padding), "title_padding");
    gtk_widget_set_size_request(GTK_WIDGET(title_padding), 
                                SCREEN_BORDER_LEFT, -1);
    gtk_box_pack_start(GTK_BOX(title_hbox), title_padding, FALSE, FALSE, 0);

    // title_background
    title_background = gtk_event_box_new();
    gtk_widget_set_name(GTK_WIDGET(title_background), "title_background");
    gtk_widget_set_size_request(GTK_WIDGET(title_background), 
                                TITLE_MIN_WIDTH, TITLE_MIN_HEIGHT);
    gtk_box_pack_start(GTK_BOX(title_hbox), title_background, 
                       FALSE, FALSE, 0);

    // g_titleItem: screen title text
    g_titleItem = gtk_label_new("");
    gtk_misc_set_alignment(GTK_MISC(g_titleItem), 0.0, 0.5);
    gtk_misc_set_padding(GTK_MISC(g_titleItem), BACKGROUND_TITLE_OFFSET, 0);
    gtk_widget_set_name(GTK_WIDGET(g_titleItem), "title_item");
    gtk_container_add(GTK_CONTAINER(title_background), g_titleItem);

    // g_settingsArea: area to place remaining objects
    g_settingsArea = gtk_event_box_new();
    gtk_widget_set_name(GTK_WIDGET(g_settingsArea), "settings_area");
    gtk_box_pack_end(GTK_BOX(topLevelVBox), g_settingsArea, TRUE, TRUE, 0);

    gtk_widget_show_all(background);

    return g_settingsArea;
}
Beispiel #9
0
void  l_poimatdok(const char *nomdok,GtkWidget *wpredok)
{
char strsql[512];
iceb_u_str soob;
class poimatdok_data data;
data.nomdok_p.new_plus(nomdok);

data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);

sprintf(strsql,"%s %s",name_system,gettext("Поиск документа по номеру"));

gtk_window_set_title (GTK_WINDOW (data.window),strsql);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);

gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);


if(wpredok != NULL)
 {
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
  //Удерживать окно над породившем его окном всегда
  gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
  //Закрыть окно если окно предок удалено
  gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
 }

gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(poimatdok_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);

GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (data.window), hbox);

GtkWidget *vbox1 = gtk_vbox_new (FALSE, 1);
GtkWidget *vbox2 = gtk_vbox_new (FALSE, 1);

gtk_box_pack_start (GTK_BOX (hbox), vbox1, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_widget_show(hbox);

soob.new_plus("");

data.label_kolstr=gtk_label_new (soob.ravno_toutf());


gtk_box_pack_start (GTK_BOX (vbox2),data.label_kolstr,FALSE, FALSE, 0);

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);

data.sw = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_usize(GTK_WIDGET(data.sw),400,300);

gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (data.sw),GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (data.sw),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
//gtk_box_pack_start (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);

//Кнопки
GtkTooltips *tooltips[KOL_F_KL];


sprintf(strsql,"F2 %s",gettext("Просмотр"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK2],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]), "clicked",GTK_SIGNAL_FUNC(poimatdok_knopka),&data);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Просмотр выбранного документа"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_widget_show(data.knopka[FK2]);

sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1),data.knopka[FK10],TRUE,TRUE, 0);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]), "clicked",GTK_SIGNAL_FUNC(poimatdok_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_widget_show(data.knopka[FK10]);


gtk_widget_realize(data.window);
gdk_window_set_cursor(data.window->window,gdk_cursor_new(ICEB_CURSOR));

gtk_widget_grab_focus(data.knopka[FK10]);

poimatdok_create_list(&data);

gtk_widget_show(data.window);

gtk_window_maximize(GTK_WINDOW(data.window));
//gtk_window_fullscreen(GTK_WINDOW(data.window));

gtk_main();


printf("l_poimatdok end\n");
if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));


}
Beispiel #10
0
static void home_window_construct (GenesisController *controller)
{
  GtkWidget *window;
  GtkWidget *hbox, *vbox;
  GtkWidget *app_treeview, *cat_treeview;
  GtkWidget *scrolledwindow;
  GtkTreeModel *app_model, *cat_model;
  GtkTreeSelection *app_selection, *cat_selection;
  GtkWidget *textview, *button;
  GenesisAppEntry *entry = NULL;
  guint n = 0;
  GList *cat_list;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Genesis Face");
  g_signal_connect (G_OBJECT (window), "delete-event",  (GCallback) gtk_main_quit, NULL);

  hbox = gtk_hbox_new (FALSE,0);
  gtk_container_add (GTK_CONTAINER (window), hbox);

  vbox = gtk_vbox_new (FALSE,0);
  gtk_box_pack_end (GTK_BOX(hbox), vbox, FALSE, FALSE, 0);

  textview = gtk_text_view_new ();
  gtk_box_pack_start (GTK_BOX(vbox), textview, FALSE, FALSE, 0);

  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_box_pack_end (GTK_BOX(hbox), scrolledwindow, FALSE, FALSE, 0);

  app_treeview = gtk_tree_view_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (app_treeview),
                                               -1, "Applications",
                                               gtk_cell_renderer_text_new(),
                                               "text", 0, NULL);
  app_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app_treeview));

  gtk_tree_selection_set_mode (app_selection, GTK_SELECTION_SINGLE);
  g_signal_connect (G_OBJECT (app_selection), "changed",
                    G_CALLBACK (app_selection_changed_callback), textview);
  gtk_container_add (GTK_CONTAINER (scrolledwindow), app_treeview);

  app_model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
  gtk_tree_view_set_model (GTK_TREE_VIEW(app_treeview), app_model);

  do
  {
    entry = genesis_controller_get_nth_entry (controller, n++);
    if (entry)
    {
      gchar *entry_name = genesis_app_entry_get_name (entry);

      tree_view_append_entry (app_model, entry_name);
    }
  }while (entry);

  cat_list = genesis_controller_get_categories (controller);

  if (!cat_list)
    g_print ("failed to get categories list.\n");
  else
  {
    GList *tmp;

    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
                                    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_box_pack_end (GTK_BOX(hbox), scrolledwindow, FALSE, FALSE, 0);

    cat_treeview = gtk_tree_view_new ();
    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cat_treeview),
                                                 -1, "Categories",
                                                 gtk_cell_renderer_text_new(),
                                                 "text", 0, NULL);
    cat_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cat_treeview));

    gtk_tree_selection_set_mode (cat_selection, GTK_SELECTION_SINGLE);
    g_signal_connect (G_OBJECT (cat_selection), "changed",
                      G_CALLBACK (cat_selection_changed_callback), app_treeview);
    gtk_container_add (GTK_CONTAINER (scrolledwindow), cat_treeview);

    cat_model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
    gtk_tree_view_set_model (GTK_TREE_VIEW(cat_treeview), cat_model);

    tmp = cat_list;
    while (tmp) 
    {
      GenesisCategory *category = tmp->data;
      tree_view_append_entry (cat_model, category->name);
      tmp = tmp->next;
    }
    g_list_free(cat_list);
  }

  button = gtk_button_new_with_label ("Start");

  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (start_button_clicked_callback), app_treeview);

  gtk_box_pack_start (GTK_BOX(vbox), button, FALSE, FALSE, 0);

  gtk_widget_show_all (window);
}
Beispiel #11
0
static void
gimp_container_popup_create_view (GimpContainerPopup *popup)
{
  GimpEditor *editor;
  GtkWidget  *button;

  popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR,
                                "view-type",         popup->view_type,
                                "container",         popup->container,
                                "context",           popup->context,
                                "view-size",         popup->view_size,
                                "view-border-width", popup->view_border_width,
                                NULL);

  gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view),
                                       FALSE);

  if (popup->view_type == GIMP_VIEW_TYPE_LIST)
    {
      GtkWidget *search_entry;

      search_entry = gtk_entry_new ();
      gtk_box_pack_end (GTK_BOX (popup->editor->view), search_entry,
                        FALSE, FALSE, 0);
      gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GIMP_CONTAINER_TREE_VIEW (GIMP_CONTAINER_VIEW (popup->editor->view))->view),
                                      GTK_ENTRY (search_entry));
      gtk_widget_show (search_entry);
    }

  gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view),
                                       6  * (popup->default_view_size +
                                             2 * popup->view_border_width),
                                       10 * (popup->default_view_size +
                                             2 * popup->view_border_width));

  if (GIMP_IS_EDITOR (popup->editor->view))
    gimp_editor_set_show_name (GIMP_EDITOR (popup->editor->view), FALSE);

  gtk_container_add (GTK_CONTAINER (popup->frame), GTK_WIDGET (popup->editor));
  gtk_widget_show (GTK_WIDGET (popup->editor));

  editor = GIMP_EDITOR (popup->editor->view);

  gimp_editor_add_button (editor, "zoom-out",
                          _("Smaller Previews"), NULL,
                          G_CALLBACK (gimp_container_popup_smaller_clicked),
                          NULL,
                          popup);
  gimp_editor_add_button (editor, "zoom-in",
                          _("Larger Previews"), NULL,
                          G_CALLBACK (gimp_container_popup_larger_clicked),
                          NULL,
                          popup);

  button = gimp_editor_add_icon_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp",
                                     G_CALLBACK (gimp_container_popup_view_type_toggled),
                                     popup);
  gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), popup->view_type);

  if (popup->dialog_factory)
    gimp_editor_add_button (editor, popup->dialog_icon_name,
                            popup->dialog_tooltip, NULL,
                            G_CALLBACK (gimp_container_popup_dialog_clicked),
                            NULL,
                            popup);

  gtk_widget_grab_focus (GTK_WIDGET (popup->editor));
}
Beispiel #12
0
static void
start (void)
{
    GtkWidget *button;
    GtkWidget *vbox;

    window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));

    g_signal_connect (G_OBJECT (window), "delete_event",
                      G_CALLBACK (delete_event), NULL);

    g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (destroy), NULL);

    g_signal_connect (G_OBJECT (window), "key-press-event",
                      G_CALLBACK (key_press), NULL);

    gtk_container_set_border_width (GTK_CONTAINER (window), 0);

    vbox = gtk_vbox_new (FALSE, 0);

    gtk_container_add (GTK_CONTAINER (window), vbox);

    gtk_widget_show (vbox);

    controls = gtk_hbox_new (FALSE, 0);

    gtk_box_pack_end (GTK_BOX (vbox), controls, FALSE, FALSE, 2);

    gtk_widget_show (controls);

    {
        GdkColor color;

        gdk_color_parse ("black", &color);
        video_output = gtk_drawing_area_new ();
        gtk_widget_modify_bg (GTK_WIDGET (video_output), GTK_STATE_NORMAL, &color);

        gtk_box_pack_start (GTK_BOX (vbox), video_output, TRUE, TRUE, 0);

        gtk_widget_set_size_request (video_output, 0x200, 0x100);

        gtk_widget_show (video_output);
    }

    {
        button = gtk_button_new_with_label ("Pause");

        g_signal_connect (G_OBJECT (button), "clicked",
                          G_CALLBACK (pause_cb), NULL);

        gtk_box_pack_start (GTK_BOX (controls), button, FALSE, FALSE, 2);

        gtk_widget_show (button);

        pause_button = button;
    }

    {
        button = gtk_button_new_with_label ("Reset");

        g_signal_connect (G_OBJECT (button), "clicked",
                          G_CALLBACK (reset_cb), NULL);

        gtk_box_pack_start (GTK_BOX (controls), button, FALSE, FALSE, 2);

        gtk_widget_show (button);
    }

    {
        GtkObject *adjustment;
        adjustment = gtk_adjustment_new (0, 0, 101, 1, 5, 1);
        scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));

        gtk_box_pack_end (GTK_BOX (controls), scale, TRUE, TRUE, 2);

        g_signal_connect (G_OBJECT (scale), "change-value",
                          G_CALLBACK (seek_cb), NULL);

        gtk_widget_show (scale);
    }

    gtk_widget_show (GTK_WIDGET (window));

    {
        DBusError error;

        dbus_error_init (&error);
        session = dbus_bus_get (DBUS_BUS_SESSION, &error);
        if (!session)
            g_warning ("%s: %s\n", error.name, error.message);
    }
}
Beispiel #13
0
static void
gimp_histogram_editor_init (GimpHistogramEditor *editor)
{
  GimpHistogramView *view;
  GtkWidget         *hbox;
  GtkWidget         *label;
  GtkWidget         *menu;
  GtkWidget         *table;
  gint               i;

  const gchar *gimp_histogram_editor_labels[] =
    {
      N_("Mean:"),
      N_("Std dev:"),
      N_("Median:"),
      N_("Pixels:"),
      N_("Count:"),
      N_("Percentile:")
    };

  editor->drawable     = NULL;
  editor->histogram    = NULL;
  editor->bg_histogram = NULL;
  editor->valid        = FALSE;
  editor->idle_id      = 0;
  editor->box          = gimp_histogram_box_new ();

  gimp_editor_set_show_name (GIMP_EDITOR (editor), TRUE);

  view = GIMP_HISTOGRAM_BOX (editor->box)->view;

  hbox = gtk_hbox_new (FALSE, 6);
  gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  label = gtk_label_new (_("Channel:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  editor->menu = menu = gimp_prop_enum_combo_box_new (G_OBJECT (view),
                                                      "histogram-channel",
                                                      0, 0);
  gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu),
                                        "gimp-channel");
  gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (editor->menu),
                                      gimp_histogram_menu_sensitivity,
                                      editor, NULL);
  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (editor->menu),
                                 view->channel);
  gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
  gtk_widget_show (menu);

  menu = gimp_prop_enum_stock_box_new (G_OBJECT (view),
                                       "histogram-scale", "gimp-histogram",
                                       0, 0);
  gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
  gtk_widget_show (menu);

  gtk_box_pack_start (GTK_BOX (editor), editor->box, TRUE, TRUE, 0);
  gtk_widget_show (GTK_WIDGET (editor->box));

  g_signal_connect_swapped (view, "range-changed",
                            G_CALLBACK (gimp_histogram_editor_info_update),
                            editor);
  g_signal_connect_swapped (view, "notify::histogram-channel",
                            G_CALLBACK (gimp_histogram_editor_info_update),
                            editor);

  g_signal_connect_swapped (view, "expose-event",
                            G_CALLBACK (gimp_histogram_view_expose),
                            editor);

  table = gtk_table_new (3, 4, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
  gtk_table_set_col_spacing (GTK_TABLE (table), 1, 6);
  gtk_box_pack_start (GTK_BOX (editor), table, FALSE, FALSE, 0);
  gtk_widget_show (table);

  for (i = 0; i < 6; i++)
    {
      gint x = (i / 3) * 2;
      gint y = (i % 3);

      label = gtk_label_new (gettext (gimp_histogram_editor_labels[i]));
      gimp_label_set_attributes (GTK_LABEL (label),
                                 PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
                                 PANGO_ATTR_SCALE,  PANGO_SCALE_SMALL,
                                 -1);
      gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
      gtk_table_attach (GTK_TABLE (table), label, x, x + 1, y, y + 1,
                        GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 2);
      gtk_widget_show (label);

      editor->labels[i] =
        label = g_object_new (GTK_TYPE_LABEL,
                              "xalign",      0.0,
                              "yalign",      0.5,
                              "width-chars", i > 2 ? 9 : 5,
                              NULL);
      gimp_label_set_attributes (GTK_LABEL (editor->labels[i]),
                                 PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
                                 -1);
      gtk_table_attach (GTK_TABLE (table), label, x + 1, x + 2, y, y + 1,
                        GTK_FILL, GTK_FILL, 2, 2);
      gtk_widget_show (label);
    }
}
Beispiel #14
0
Datei: cardman.c Projekt: gpg/gpa
static void
construct_widgets (GpaCardManager *cardman)
{
  GtkWidget *vbox;
  GtkWidget *hbox, *hbox1, *hbox2;
  GtkWidget *label;
  GtkWidget *icon;
  gchar *markup;
  GtkWidget *menubar;
  GtkWidget *toolbar;
  GtkWidget *statusbar;

  /* Set a default size for the main window.  */
  gtk_window_set_default_size (GTK_WINDOW (cardman), 680, 480);

  /* Realize the window so that we can create pixmaps without warnings.  */
  gtk_widget_realize (GTK_WIDGET (cardman));

  /* Use a vbox to show the menu, toolbar and the file container.  */
  vbox = gtk_vbox_new (FALSE, 0);

  /* Get the menu and the toolbar.  */
  cardman_action_new (cardman, &menubar, &toolbar);
  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);

  /* Add a fancy label that tells us: This is the card manager.  */
  hbox1 = gtk_hbox_new (FALSE, 0);

  icon = gtk_image_new_from_stock (GPA_STOCK_CARDMAN, GTK_ICON_SIZE_DND);
  gtk_box_pack_start (GTK_BOX (hbox1), icon, FALSE, TRUE, 0);

  label = gtk_label_new (NULL);
  markup = g_strdup_printf ("<span font_desc=\"16\">%s</span>",
                            _("Card Manager"));
  gtk_label_set_markup (GTK_LABEL (label), markup);
  g_free (markup);
  gtk_box_pack_start (GTK_BOX (hbox1), label, TRUE, TRUE, 10);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

  /* Add a application selection box.  */
  hbox2 = gtk_hbox_new (FALSE, 0);
  label = gtk_label_new (_("Application selection:"));
  gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, TRUE, 5);
  cardman->app_selector = gtk_combo_box_new_text ();
  gtk_combo_box_append_text (GTK_COMBO_BOX (cardman->app_selector),
                             _("Auto"));
  gtk_combo_box_set_active (GTK_COMBO_BOX (cardman->app_selector), 0);
  gtk_box_pack_start (GTK_BOX (hbox2), cardman->app_selector, FALSE, TRUE, 0);

  /* Put Card Manager label and application selector into the same line.  */
  hbox = gtk_hbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), hbox1, FALSE, FALSE, 0);
  gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);

  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);


  /* Create a container (a scolled window) which will take the actual
     card widget.  This container is required so that we can easily
     change to a differet card widget. */
  cardman->card_container = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy
    (GTK_SCROLLED_WINDOW (cardman->card_container),
     GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (vbox), cardman->card_container, TRUE, TRUE, 0);

  /* Update the container using the current card application.  */
  update_card_widget (cardman, NULL);

  statusbar = statusbar_new (cardman);
  gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);

  gtk_container_add (GTK_CONTAINER (cardman), vbox);

}
Beispiel #15
0
static void
GyahtzeeCreateMainWindow (GApplication *app, gpointer user_data)
{
  GtkWidget *hbox, *vbox;
  GtkWidget *toolbar;
  GtkWidget *tmp;
  GtkWidget *dicebox;
  GtkWidget *undo_button;
  GtkWidget *menu_button;
  GtkWidget *icon;
  GtkBuilder *builder;
  GMenuModel *appmenu;
  int i, j;

  window = gtk_application_window_new (application);
  gtk_window_set_application (GTK_WINDOW (window), application);
  gtk_window_set_title (GTK_WINDOW (window), _(appName));
  gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), FALSE);
  gtk_window_set_icon_name (GTK_WINDOW (window), "org.gnome.Tali");

  //games_conf_add_window (GTK_WINDOW (window), NULL);

  g_signal_connect (GTK_WIDGET (window), "key_press_event",
		    G_CALLBACK (key_press), NULL);

  g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
  const gchar *vaccels_help[] = {"F1", NULL};
  const gchar *vaccels_new[] = {"<Primary>n", NULL};
  const gchar *vaccels_roll[] = {"<Primary>r", NULL};
  const gchar *vaccels_undo[] = {"<Primary>z", NULL};

  gtk_application_set_accels_for_action (application, "app.help", vaccels_help);
  gtk_application_set_accels_for_action (application, "app.new-game", vaccels_new);
  gtk_application_set_accels_for_action (application, "app.roll", vaccels_roll);
  gtk_application_set_accels_for_action (application, "app.undo", vaccels_undo);

  scores_action = g_action_map_lookup_action (G_ACTION_MAP (application), "scores");
  undo_action   = g_action_map_lookup_action (G_ACTION_MAP (application), "undo");
  update_undo_sensitivity ();

        /*--- Headerbar ---*/
  hbar = gtk_header_bar_new ();
  gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (hbar), TRUE);
  gtk_header_bar_set_title (GTK_HEADER_BAR (hbar), _(appName));
  gtk_widget_show (hbar);
  gtk_window_set_titlebar (GTK_WINDOW (window), hbar);

  if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
    undo_button = gtk_button_new_from_icon_name ("edit-undo-rtl-symbolic", GTK_ICON_SIZE_BUTTON);
  else
    undo_button = gtk_button_new_from_icon_name ("edit-undo-symbolic", GTK_ICON_SIZE_BUTTON);
  gtk_widget_set_valign (undo_button, GTK_ALIGN_CENTER);
  gtk_actionable_set_action_name (GTK_ACTIONABLE (undo_button), "app.undo");
  gtk_widget_set_tooltip_text (undo_button, _("Undo your most recent move"));
  gtk_widget_show (undo_button);
  gtk_header_bar_pack_start (GTK_HEADER_BAR (hbar), undo_button);

  builder = gtk_builder_new_from_resource ("/org/gnome/Tali/ui/menus.ui");
  appmenu = (GMenuModel *) gtk_builder_get_object (builder, "app-menu");

  menu_button = gtk_menu_button_new();
  icon = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_BUTTON);
  gtk_button_set_image (GTK_BUTTON (menu_button), icon);
  gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), appmenu);
  gtk_widget_show (menu_button);
  gtk_header_bar_pack_end (GTK_HEADER_BAR (hbar), menu_button);

	/*---- Content ----*/

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

  gtk_container_add (GTK_CONTAINER (window), vbox);

  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);

  /* Retreive dice pixmaps from memory or files */
  LoadDicePixmaps ();

  /* Put all the dice in a vertical column */
  dicebox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (hbox), dicebox, FALSE, TRUE, 0);
  gtk_widget_show (dicebox);

  rollLabel = gtk_label_new (NULL);
  gtk_label_set_use_markup (GTK_LABEL (rollLabel), TRUE);
  gtk_widget_show (rollLabel);
  gtk_box_pack_start (GTK_BOX (dicebox), rollLabel, FALSE, TRUE, 5);

  mbutton = gtk_button_new_with_label (_("Roll!"));
  gtk_box_pack_end (GTK_BOX (dicebox), mbutton, FALSE, FALSE, 5);
  g_signal_connect (GTK_BUTTON (mbutton), "clicked",
		    G_CALLBACK (roll_button_pressed_cb), NULL);
  gtk_widget_show (GTK_WIDGET (mbutton));

  toolbar = gtk_toolbar_new ();
  gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar),
			       GTK_ORIENTATION_VERTICAL);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
  gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
  gtk_box_pack_end (GTK_BOX (dicebox), toolbar, TRUE, TRUE, 0);

  for (i = 0; i < NUMBER_OF_DICE; i++) {
    tmp = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

    for (j = 0; j < NUMBER_OF_PIXMAPS; j++) {
      gtk_box_pack_start (GTK_BOX (tmp), dicePixmaps[i][j][GAME_YAHTZEE], FALSE, FALSE, 0);
      gtk_box_pack_start (GTK_BOX (tmp), dicePixmaps[i][j][GAME_KISMET], FALSE, FALSE, 0);
    }

    diceBox[i] = gtk_toggle_tool_button_new ();
    gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (diceBox[i]), tmp);
    g_signal_connect (GTK_TOOL_BUTTON (diceBox[i]), "clicked",
		      G_CALLBACK (modify_dice), &DiceValues[i]);

    gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
			GTK_TOOL_ITEM (diceBox[i]), -1);

    gtk_widget_show (GTK_WIDGET (diceBox[i]));
    gtk_widget_show (tmp);
  /*gtk_widget_show (dicePixmaps[i][0][game_type]);*/
  }
  gtk_widget_show (toolbar);

  /* Scores displayed in score list */
  ScoreList = create_score_list ();
  gtk_box_pack_end (GTK_BOX (hbox), ScoreList, TRUE, TRUE, 0);
  setup_score_list (ScoreList);
  gtk_widget_show (ScoreList);

  gtk_widget_show (hbox);
  gtk_widget_show (vbox);
}
GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle,
                                     CtkConfig *ctk_config,
                                     CtkEvent *ctk_event,
                                     char *name)
{
    GObject *object;
    CtkDisplayDeviceTv *ctk_display_device_tv;
    GtkWidget *banner;
    GtkWidget *frame;
    GtkWidget *eventbox;
    GtkWidget *tmpbox;
    GtkWidget *hbox;
    GtkWidget *alignment;

    
    object = g_object_new(CTK_TYPE_DISPLAY_DEVICE_TV, NULL);
    if (!object) return NULL;
    
    ctk_display_device_tv = CTK_DISPLAY_DEVICE_TV(object);
    ctk_display_device_tv->handle = handle;
    ctk_display_device_tv->ctk_config = ctk_config;
    ctk_display_device_tv->ctk_event = ctk_event;
    ctk_display_device_tv->name = g_strdup(name);
    
    gtk_box_set_spacing(GTK_BOX(object), 10);
    
    /* banner */

    banner = ctk_banner_image_new(BANNER_ARTWORK_TV);
    gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0);

    /* Information */

    frame = gtk_frame_new(NULL);
    gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0);
    ctk_display_device_tv->info_frame = frame;
    
    hbox = gtk_hbox_new(FALSE, FRAME_PADDING);
    gtk_container_set_border_width(GTK_CONTAINER(hbox), FRAME_PADDING);
    gtk_container_add(GTK_CONTAINER(frame), hbox);
    
    tmpbox = gtk_vbox_new(FALSE, 5);
    gtk_container_add(GTK_CONTAINER(hbox), tmpbox);
    
    ctk_display_device_tv->txt_encoder_name = gtk_label_new("");
    ctk_display_device_tv->txt_refresh_rate = gtk_label_new("");
    
    /* pack the Refresh Rate Label */
    {
        typedef struct {
            GtkWidget *label;
            GtkWidget *txt;
            const gchar *tooltip;
        } TextLineInfo;

        TextLineInfo lines[] = {
            {
                gtk_label_new("TV Encoder:"),
                ctk_display_device_tv->txt_encoder_name,
                __tv_encoder_name_help,
            },
            {
                gtk_label_new("TV Refresh Rate:"),
                ctk_display_device_tv->txt_refresh_rate,
                __tv_refresh_rate_help,
            },
            { NULL, NULL, NULL }
        };
        
        int i;
        GtkRequisition req;
        int max_width;

        /* Compute max width of lables and setup text alignments */
        max_width = 0;
        for (i = 0; lines[i].label; i++) {
            gtk_misc_set_alignment(GTK_MISC(lines[i].label), 0.0f, 0.5f);
            gtk_misc_set_alignment(GTK_MISC(lines[i].txt), 0.0f, 0.5f);
            gtk_widget_size_request(lines[i].label, &req);
            
            if (max_width < req.width) {
                max_width = req.width;
            }
        }

        /* Pack labels */
        for (i = 0; lines[i].label; i++) {
            GtkWidget *tmphbox;

            /* Add separators */
            
            if (i == 1) {
                GtkWidget *separator = gtk_hseparator_new();
                gtk_box_pack_start(GTK_BOX(tmpbox), separator,
                                   FALSE, FALSE, 0);
            }
            /* Set the label's width */
            gtk_widget_set_size_request(lines[i].label, max_width, -1);
            /* add the widgets for this line */
            tmphbox = gtk_hbox_new(FALSE, 5);
            gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].label,
                               FALSE, TRUE, 5);
            gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].txt,
                               FALSE, TRUE, 5);

            /* Include tooltips */
            if (!lines[i].tooltip) {
                gtk_box_pack_start(GTK_BOX(tmpbox), tmphbox, FALSE, FALSE, 0);
            } else {
                eventbox = gtk_event_box_new();
                gtk_container_add(GTK_CONTAINER(eventbox), tmphbox);
                ctk_config_set_tooltip(ctk_config, eventbox, lines[i].tooltip);
                gtk_box_pack_start(GTK_BOX(tmpbox), eventbox, FALSE, FALSE, 0);
            }
        }
    }
    
    /* NV_CTRL_REFRESH_RATE */
    
    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_REFRESH_RATE),
                     G_CALLBACK(info_update_received),
                     (gpointer) ctk_display_device_tv);
    

    /* NV_CTRL_TV_OVERSCAN */

    ctk_display_device_tv->overscan =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_OVERSCAN,
                  "TV OverScan", __tv_overscan_help);

    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_OVERSCAN),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);
    
    /* NV_CTRL_TV_FLICKER_FILTER */

    ctk_display_device_tv->flicker_filter =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_FLICKER_FILTER,
                  "TV Flicker Filter", __tv_flicker_filter_help);

    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_FLICKER_FILTER),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);

    /* NV_CTRL_TV_BRIGHTNESS */

    ctk_display_device_tv->brightness =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_BRIGHTNESS,
                  "TV Brightness", __tv_brightness_help);

    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_BRIGHTNESS),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);

    /* NV_CTRL_TV_HUE */
    
    ctk_display_device_tv->hue =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_HUE,
                  "TV Hue", __tv_hue_help);
    
    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_HUE),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);

    /* NV_CTRL_TV_CONTRAST */
    
    ctk_display_device_tv->contrast =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_CONTRAST,
                  "TV Contrast", __tv_contrast_help);

    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_CONTRAST),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);

    /* NV_CTRL_TV_SATURATION */
    
    ctk_display_device_tv->saturation =
        add_scale(ctk_display_device_tv, NV_CTRL_TV_SATURATION,
                  "TV Saturation", __tv_saturation_help);
    
    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_SATURATION),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);

    /* Create the reset button here so it can be used by the image sliders */

    ctk_display_device_tv->reset_button =
        gtk_button_new_with_label("Reset TV Hardware Defaults");
    
    /* create and pack the image sliders */
    
    ctk_display_device_tv->image_sliders =
        ctk_image_sliders_new(handle, ctk_config, ctk_event,
                              ctk_display_device_tv->reset_button,
                              name);
    if (ctk_display_device_tv->image_sliders) {
        gtk_box_pack_start(GTK_BOX(object),
                           ctk_display_device_tv->image_sliders,
                           FALSE, FALSE, 0);
    }
    
    /* reset button */

    g_signal_connect(G_OBJECT(ctk_display_device_tv->reset_button), "clicked",
                     G_CALLBACK(reset_button_clicked),
                     (gpointer) ctk_display_device_tv);
    
    alignment = gtk_alignment_new(1, 1, 0, 0);
    gtk_container_add(GTK_CONTAINER(alignment),
                      ctk_display_device_tv->reset_button);
    gtk_box_pack_end(GTK_BOX(object), alignment, TRUE, TRUE, 0);
    
    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_TV_RESET_SETTINGS),
                     G_CALLBACK(value_received),
                     (gpointer) ctk_display_device_tv);
    
    ctk_config_set_tooltip(ctk_config, ctk_display_device_tv->reset_button,
                           ctk_help_create_reset_hardware_defaults_text("TV", name));

    /* EDID button box */

    ctk_display_device_tv->edid =
        ctk_edid_new(ctk_display_device_tv->handle,
                     ctk_display_device_tv->ctk_config,
                     ctk_display_device_tv->ctk_event,
                     ctk_display_device_tv->name);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), ctk_display_device_tv->edid,
                       TRUE, TRUE, 0);

    /* finally, display the widget */

    gtk_widget_show_all(GTK_WIDGET(object));

    /* update the GUI */

    update_display_enabled_flag(ctk_display_device_tv->handle,
                                &ctk_display_device_tv->display_enabled);

    ctk_display_device_tv_setup(ctk_display_device_tv);
    
    /* handle enable/disable events on the display device */

    g_signal_connect(G_OBJECT(ctk_event),
                     CTK_EVENT_NAME(NV_CTRL_ENABLED_DISPLAYS),
                     G_CALLBACK(enabled_displays_received),
                     (gpointer) ctk_display_device_tv);
    
    return GTK_WIDGET(object);
    
} /* ctk_display_device_tv_new() */
Beispiel #17
0
static void
action_about (GtkAction *action, gpointer callback_data)
{
    GtkamMain *m = GTKAM_MAIN (callback_data);
    GtkWidget *d;
    const gchar *comments =
        N_("gtkam is a program that lets you download\n"
           "images from many digital cameras. It uses\n"
           "libgphoto2. More info is available at\n"
           "http://www.gphoto.org.\n"
           "\n"
           "Enjoy the wonderful world of gphoto!");
#ifdef HAVE_GNOME
    GtkWidget *w;
    const gchar *authors[] = {
        "Scott Fritzinger <*****@*****.**>",
        "Lutz Mueller <*****@*****.**>",
        _("Many others"), NULL
    };
    const gchar *documenters[] = {
        "Michael J. Rensing <*****@*****.**>", NULL
    };
    const gchar *translator_credits =
        "Keld Simonsen <*****@*****.**>\n"
        "Marcus Meissner <*****@*****.**>\n"
        "Fabian Mandelbaum <*****@*****.**>\n"
        "Kjartan Maraas <*****@*****.**>\n"
        "Andraz Tori <*****@*****.**>";
    GdkPixbuf *p;
#else
    gchar *buf;
#endif

    gchar *gcomments = NULL;
    int n;

    for (n = 0; module_versions[n].name != NULL; n++) {
        gchar *features;
        const char **v = NULL;
        char *name = module_versions[n].name;
        GPVersionFunc func = module_versions[n].version_func;
        CHECK_NULL (name);
        CHECK_NULL (func);
        v = func(GP_VERSION_SHORT);
        CHECK_NULL (v);
        CHECK_NULL (v[0]);
        CHECK_NULL (v[1]);

        /* FIXME: implicit conversion from char to gchar */
        features = g_strjoinv(", ", &v[1]);

        if (gcomments == NULL) {
            gcomments = g_strdup_printf(_("%s\n\n%s %s with options:\n    %s\n"),
                                        _(comments), name, v[0], features);
        } else {
            gchar *old = gcomments;
            gcomments = g_strdup_printf(_("%s\n%s %s with options:\n    %s\n"),
                                        gcomments, name, v[0], features);
            free(old);
        }

        free(features);
    }

#ifdef HAVE_GNOME
    p = gdk_pixbuf_new_from_file (IMAGE_DIR "/gtkam-camera.png", NULL);
    d = gnome_about_new (PACKAGE, VERSION, "GPL", gcomments, authors,
                         documenters, translator_credits, p);
    g_object_unref (G_OBJECT (p));
    w = gnome_href_new ("http://www.gphoto.org", "http://www.gphoto.org");
    gtk_widget_show (w);
    gtk_box_pack_end (GTK_BOX (GTK_DIALOG (d)->vbox), w, FALSE, FALSE, 0);
#else
    buf = g_strdup_printf ("%s-%s\n\n%s", PACKAGE, VERSION, gcomments);
    d = gtkam_close_new (buf);
    g_free (buf);
#endif
    gtk_window_set_transient_for (GTK_WINDOW (d), GTK_WINDOW (m));
    gtk_widget_show (d);
    /* FIXME free(gcomments); */
}
Beispiel #18
0
int  l_zkartmat1(const char *skl,const char *n_kart,GtkWidget *wpredok)
{
zkartmat_data data;
char strsql[512];
char bros[512];
GdkColor color;
SQL_str row;
SQLCURSOR cur;
iceb_u_str soob;
short ddd,mmm,ggg;
iceb_u_poltekdat(&ddd,&mmm,&ggg);


//Чтаем наименование склада
sprintf(strsql,"select naik from Sklad where kod=%s",skl);
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) != 1)
 {
  iceb_u_str repl;
  repl.plus(gettext("Не найден код склада"));
  repl.plus(" ");
  repl.plus(skl);
  repl.plus(" !");
  iceb_menu_soob(&repl,wpredok);
  data.rk.naimskl.new_plus("");
 }
else
  data.rk.naimskl.new_plus(row[0]);

//читаем реквизиты карточки
sprintf(strsql,"select * from Kart where sklad=%s and nomk=%s",skl,n_kart);
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) != 1)
 {
  iceb_u_str repl;
  repl.plus(gettext("Не найдена карточка"));
  repl.plus(" ");
  repl.plus(n_kart);
  repl.ps_plus(gettext("Склад"));
  repl.plus(skl);
  iceb_menu_soob(&repl,wpredok);
  return(1);
   
 }
data.rk.kodm.plus(row[2]);
data.rk.skl.plus(skl);
data.rk.n_kart.plus(n_kart);
data.rk.shet.plus(row[5]);
data.rk.cena.plus(row[6]);
data.rk.ei.plus(row[4]);
data.rk.nds.plus(row[9]);
data.rk.krat.plus(row[8]);
data.rk.cenapr.plus(row[7]);
data.rk.innom.plus(row[15]);
data.rk.rnd.plus(row[16]);
data.rk.nomzak.plus(row[17]);
data.rk.mnds.plus(row[3]);
data.rk.fas.plus(row[10]);
data.rk.kodtar.plus(row[11]);
short d,m,g;
if(iceb_u_rsdat(&d,&m,&g,row[14],2) == 0)
 {
  sprintf(strsql,"%d.%d.%d",d,m,g);
  data.rk.datv.plus(strsql);
 }
else
  data.rk.datv.plus("");

data.rk.data_kon_is.plus_sqldata(row[18]);

data.dn=1;
data.mn=1;
data.gn=startgod;
if(startgod == 0)
  data.gn=ggg;
  
data.dk=ddd;
data.mk=mmm;
data.gk=ggg;

sprintf(strsql,"%d.%d.%d",data.dn,data.mn,data.gn);
data.poi.datan.new_plus(strsql);

sprintf(strsql,"%d.%d.%d",data.dk,data.mk,data.gk);
data.poi.datak.new_plus(strsql);

//Читаем наименование материалла
sprintf(strsql,"select kodgr,naimat from Material where kodm=%s",data.rk.kodm.ravno());
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) == 1)
 {
  data.rk.kodgr.plus(row[0]);
  data.rk.naimat.plus(row[1]);
 }
else 
 {
  data.rk.kodgr.plus("");
  data.rk.naimat.plus("");
 }

//читаем наименование группы
sprintf(strsql,"select naik from Grup where kod=%s",data.rk.kodgr.ravno());
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) == 1)
 data.rk.naimgr.plus(row[0]);
else 
 data.rk.naimgr.plus("");

data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);

//gtk_window_set_default_size (GTK_WINDOW  (data.window),400,-1);
//gdk_color_parse("black",&color);
//gtk_widget_modify_bg(data.window,GTK_STATE_NORMAL,&color);


sprintf(bros,"%s %s",name_system,gettext("Просмотр карточки"));

gtk_window_set_title (GTK_WINDOW (data.window),bros);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);

gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);


if(wpredok != NULL)
 {
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
  //Удерживать окно над породившем его окном всегда
  gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
  //Закрыть окно если окно предок удалено
  gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
 }

gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(zkartmat_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);

GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (data.window), hbox);

GtkWidget *vbox1 = gtk_vbox_new (FALSE, 1);
GtkWidget *vbox2 = gtk_vbox_new (FALSE, 1);

gtk_box_pack_start (GTK_BOX (hbox), vbox1, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_widget_show(hbox);

soob.new_plus(gettext("Просмотр карточки"));
soob.ps_plus(data.rk.kodm.ravno());
soob.plus(" ");
soob.plus(data.rk.naimat.ravno());

data.label_kolstr=gtk_label_new (soob.ravno_toutf());


gtk_box_pack_start (GTK_BOX (vbox2),data.label_kolstr,FALSE, FALSE, 0);

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);

data.label_poisk=gtk_label_new ("");
data.label_ost=gtk_label_new ("");

PangoFontDescription *font_pango=pango_font_description_from_string(shrift_ravnohir.ravno());
gtk_widget_modify_font(GTK_WIDGET(data.label_ost),font_pango);
pango_font_description_free(font_pango);


gdk_color_parse("red",&color);
gtk_widget_modify_fg(data.label_poisk,GTK_STATE_NORMAL,&color);

gtk_box_pack_start (GTK_BOX (vbox2),data.label_ost,FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2),data.label_poisk,FALSE, FALSE, 0);

data.sw = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_usize(GTK_WIDGET(data.sw),-1,200);

gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (data.sw),GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (data.sw),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
//gtk_box_pack_start (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);

//Кнопки
GtkTooltips *tooltips[KOL_F_KL];


sprintf(bros,"F2 %s",gettext("Корректировать"));
data.knopka[FK2]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK2],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Корректировка реквизитов карточки материалла"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_widget_show(data.knopka[FK2]);

sprintf(bros,"F3 %s",gettext("Удалить"));
data.knopka[FK3]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK3],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK3]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK3]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK3],data.knopka[FK3],gettext("Удаление выбранной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK3]),(gpointer)FK3);
gtk_widget_show(data.knopka[FK3]);

sprintf(bros,"F4 %s",gettext("Поиск"));
data.knopka[FK4]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK4],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK4]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK4],data.knopka[FK4],gettext("Поиск нужных записей"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK4]),(gpointer)FK4);
gtk_widget_show(data.knopka[FK4]);

sprintf(bros,"F5 %s",gettext("Печать"));
data.knopka[FK5]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK5],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK5]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK5]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK5],data.knopka[FK5],gettext("Распечатка записей"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK5]),(gpointer)FK5);
gtk_widget_show(data.knopka[FK5]);

sprintf(bros,"F6 %s",gettext("Смена даты"));
data.knopka[FK6]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK6],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK6]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK6]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK6],data.knopka[FK6],gettext("Включение/выключение просмотра записей за текущий месяц"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK6]),(gpointer)FK6);
gtk_widget_show(data.knopka[FK6]);

sprintf(bros,"F7 %s",gettext("Остаток"));
data.knopka[FK7]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK7],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK7]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK7]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK7],data.knopka[FK7],gettext("Показать остатки по карточке или по записям в документах"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK7]),(gpointer)FK7);
gtk_widget_show(data.knopka[FK7]);

sprintf(bros,"F8 %s",gettext("Слияние"));
data.knopka[FK8]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK8],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK8]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
tooltips[FK8]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK8],data.knopka[FK8],gettext("Слияние записей из нужной карточки в текущюю с удалением первой"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK8]),(gpointer)FK8);
gtk_widget_show(data.knopka[FK8]);

sprintf(bros,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1),data.knopka[FK10],TRUE,TRUE, 0);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]), "clicked",GTK_SIGNAL_FUNC(zkartmat_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_widget_show(data.knopka[FK10]);


gtk_widget_realize(data.window);
gdk_window_set_cursor(data.window->window,gdk_cursor_new(ICEB_CURSOR));

gtk_widget_grab_focus(data.knopka[FK10]);

zkartmat_create_list(&data);

//gtk_window_maximize(GTK_WINDOW(data.window));
//gtk_window_fullscreen(GTK_WINDOW(data.window));
gtk_widget_show(data.window);


gtk_main();


printf("l_zkartmat end\n");
if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));

return(data.metka_voz);

}
Beispiel #19
0
static GtkWidget*
create_prefs_dialog(GtkWidget* parent, GConfClient* client)
{
    GConfChangeSet* cs;
    GtkWidget* dialog;
    GtkWidget* bbox;
    GtkWidget* apply;
    GtkWidget* revert;
    GtkWidget* ok;
    GtkWidget* cancel;
    GtkWidget* vbox_outer;
    GtkWidget* vbox_inner;
    GtkWidget* entry;

    dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    apply = gtk_button_new_with_label("Apply");
    revert = gtk_button_new_with_label("Revert");

    ok = gtk_button_new_with_label("OK");
    cancel = gtk_button_new_with_label("Cancel");

    g_object_set_data(dialog, "apply", apply);
    g_object_set_data(dialog, "revert", revert);
    g_object_set_data(dialog, "ok", ok);
    g_object_set_data(dialog, "cancel", cancel);

    bbox = gtk_hbutton_box_new();

    vbox_outer = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);

    vbox_inner = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);

    gtk_container_add(GTK_CONTAINER(dialog), vbox_outer);

    gtk_box_pack_start(GTK_BOX(vbox_outer), vbox_inner, TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(vbox_outer), bbox, FALSE, FALSE, 0);

    gtk_container_add(GTK_CONTAINER(bbox), apply);
    gtk_container_add(GTK_CONTAINER(bbox), revert);
    gtk_container_add(GTK_CONTAINER(bbox), ok);
    gtk_container_add(GTK_CONTAINER(bbox), cancel);

    cs = gconf_change_set_new();

    g_object_set_data(dialog, "changeset", cs);
    g_object_set_data(dialog, "client", client);

    /* Grab a reference */
    g_object_ref(G_OBJECT(client));

    g_signal_connect(dialog, "destroy",
                     G_CALLBACK(prefs_dialog_destroy_callback),
                     NULL);

    prefs_dialog_update_sensitivity(dialog);

    g_signal_connect(apply, "clicked",
                     G_CALLBACK(apply_button_callback),
                     dialog);

    g_signal_connect(revert, "clicked",
                     G_CALLBACK(revert_button_callback),
                     dialog);

    g_signal_connect(ok, "clicked",
                     G_CALLBACK(ok_button_callback),
                     dialog);

    g_signal_connect(cancel, "clicked",
                     G_CALLBACK(cancel_button_callback),
                     dialog);

    gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));

    entry = create_config_entry(dialog, client, "/apps/basic-gconf-app/foo");
    gtk_box_pack_start(GTK_BOX(vbox_inner), entry,
                       FALSE, FALSE, 0);

    entry = create_config_entry(dialog, client, "/apps/basic-gconf-app/bar");
    gtk_box_pack_start(GTK_BOX(vbox_inner), entry,
                       FALSE, FALSE, 0);

    entry = create_config_entry(dialog, client, "/apps/basic-gconf-app/baz");
    gtk_box_pack_start(GTK_BOX(vbox_inner), entry,
                       FALSE, FALSE, 0);

    entry = create_config_entry(dialog, client, "/apps/basic-gconf-app/blah");
    gtk_box_pack_start(GTK_BOX(vbox_inner), entry,
                       FALSE, FALSE, 0);

    return dialog;
}
Beispiel #20
0
MetaTabPopup*
meta_ui_tab_popup_new (const MetaTabEntry *entries,
                       int                 screen_number,
                       int                 entry_count,
                       int                 width,
                       gboolean            outline)
{
  MetaTabPopup *popup;
  int i, left, right, top, bottom;
  int height;
  GtkWidget *table;
  GtkWidget *vbox;
  GtkWidget *align;
  GList *tmp;
  GtkWidget *frame;
  int max_label_width; /* the actual max width of the labels we create */
  AtkObject *obj;
  GdkScreen *screen;
  int screen_width;
  
  popup = g_new (MetaTabPopup, 1);

  popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP);

  screen = gdk_display_get_screen (gdk_display_get_default (),
                                   screen_number);
  gtk_window_set_screen (GTK_WINDOW (popup->outline_window),
                         screen);

  gtk_widget_set_app_paintable (popup->outline_window, TRUE);
  gtk_widget_realize (popup->outline_window);

  g_signal_connect (G_OBJECT (popup->outline_window), "draw",
                    G_CALLBACK (outline_window_draw), popup);
  
  popup->window = gtk_window_new (GTK_WINDOW_POPUP);

  gtk_window_set_screen (GTK_WINDOW (popup->window),
                         screen);

  gtk_window_set_position (GTK_WINDOW (popup->window),
                           GTK_WIN_POS_CENTER_ALWAYS);
  /* enable resizing, to get never-shrink behavior */
  gtk_window_set_resizable (GTK_WINDOW (popup->window),
                            TRUE);
  popup->current = NULL;
  popup->entries = NULL;
  popup->current_selected_entry = NULL;
  popup->outline = outline;

  screen_width = gdk_screen_get_width (screen);
  for (i = 0; i < entry_count; ++i)
    {
      TabEntry* new_entry = tab_entry_new (&entries[i], screen_width, outline);
      popup->entries = g_list_prepend (popup->entries, new_entry);
    }

  popup->entries = g_list_reverse (popup->entries);
    
  g_assert (width > 0);
  height = i / width;
  if (i % width)
    height += 1;

  table = gtk_table_new (height, width, FALSE);
  vbox = gtk_vbox_new (FALSE, 0);
  
  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  gtk_container_set_border_width (GTK_CONTAINER (table), 1);
  gtk_container_add (GTK_CONTAINER (popup->window),
                     frame);
  gtk_container_add (GTK_CONTAINER (frame),
                     vbox);

  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);

  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);

  gtk_container_add (GTK_CONTAINER (align),
                     table);

  popup->label = gtk_label_new ("");

  /* Set the accessible role of the label to a status bar so it
   * will emit name changed events that can be used by screen
   * readers.
   */
  obj = gtk_widget_get_accessible (popup->label);
  atk_object_set_role (obj, ATK_ROLE_STATUSBAR);

  gtk_misc_set_padding (GTK_MISC (popup->label), 3, 3);

  gtk_box_pack_end (GTK_BOX (vbox), popup->label, FALSE, FALSE, 0);

  max_label_width = 0;
  top = 0;
  bottom = 1;
  tmp = popup->entries;

  while (tmp && top < height)
    {      
      left = 0;
      right = 1;

      while (tmp && left < width)
        {
          GtkWidget *image;
          GtkRequisition req;

          TabEntry *te;

          te = tmp->data;

          if (te->blank)
            {
              /* just stick a widget here to avoid special cases */
              image = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
            }
          else if (outline)
            {
              if (te->dimmed_icon)
                {
                  image = selectable_image_new (te->dimmed_icon);
                }
              else 
                {
                  image = selectable_image_new (te->icon);
                }

              gtk_misc_set_padding (GTK_MISC (image),
                                    INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1,
                                    INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1);
              gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
            }   
          else
            {
              image = selectable_workspace_new ((MetaWorkspace *) te->key);
            }

          te->widget = image;

          gtk_table_attach (GTK_TABLE (table),
                            te->widget,
                            left, right,           top, bottom,
                            0,                     0,
                            0,                     0);

          /* Efficiency rules! */
          gtk_label_set_markup (GTK_LABEL (popup->label),
                              te->title);
          gtk_widget_size_request (popup->label, &req);
          max_label_width = MAX (max_label_width, req.width);
          
          tmp = tmp->next;
          
          ++left;
          ++right;
        }
      
      ++top;
      ++bottom;
    }

  /* remove all the temporary text */
  gtk_label_set_text (GTK_LABEL (popup->label), "");
  /* Make it so that we ellipsize if the text is too long */
  gtk_label_set_ellipsize (GTK_LABEL (popup->label), PANGO_ELLIPSIZE_END);

  /* Limit the window size to no bigger than screen_width/4 */
  if (max_label_width>(screen_width/4)) 
    {
      max_label_width = screen_width/4;
    }

  max_label_width += 20; /* add random padding */
  
  gtk_window_set_default_size (GTK_WINDOW (popup->window),
                               max_label_width,
                               -1);
  
  return popup;
}
Beispiel #21
0
GtkWidget *create_main_win(void)
{
	GtkWidget *win_main;
	GtkWidget *main_box;
	GtkWidget *menubar;
	GtkWidget *black_label;
	GtkWidget *black_label_frame;
	GtkWidget *white_label;
	GtkWidget *white_label_frame;
	GtkWidget *label_box;
	GtkWidget *again_button;
	GtkWidget *drawingarea;
	GtkWidget *statusbar;
	GtkAccelGroup *accel_group;

	accel_group = gtk_accel_group_new();

	win_main = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_object_set_data(G_OBJECT(win_main), "main_win", win_main);
	gtk_window_set_title(GTK_WINDOW(win_main), _("Reversi"));

	main_box = gtk_vbox_new(FALSE, 0);
	gtk_widget_ref(main_box);
	g_object_set_data_full(G_OBJECT(win_main), "main_box", main_box,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(main_box);
	gtk_container_add(GTK_CONTAINER(win_main), main_box);

	menubar = create_menus(win_main);
	gtk_widget_ref(menubar);
	g_object_set_data_full(G_OBJECT(win_main), "menubar", menubar,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(menubar);
	gtk_box_pack_start(GTK_BOX(main_box), menubar, FALSE, FALSE, 0);

	// Create labels frames
	white_label_frame = gtk_frame_new(NULL);
	gtk_widget_ref(white_label_frame);
	g_object_set_data_full(G_OBJECT(win_main), "white_label_frame",
			       white_label_frame,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(white_label_frame);

	black_label_frame = gtk_frame_new(NULL);
	gtk_widget_ref(black_label_frame);
	g_object_set_data_full(G_OBJECT(win_main), "black_label_frame",
			       black_label_frame,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(black_label_frame);

	// Create labels
	white_label = gtk_label_new("White: 0");
	// Why is that? Really don't know, but all the other scripts have it!
	gtk_widget_ref(white_label);
	g_object_set_data_full(G_OBJECT(win_main), "white_label",
			       white_label,
			       (GtkDestroyNotify) gtk_widget_unref);

	black_label = gtk_label_new("Black: 0");
	gtk_widget_ref(black_label);
	g_object_set_data_full(G_OBJECT(win_main), "black_label",
			       black_label,
			       (GtkDestroyNotify) gtk_widget_unref);

	gtk_container_add(GTK_CONTAINER(white_label_frame), white_label);
	gtk_container_add(GTK_CONTAINER(black_label_frame), black_label);
	gtk_widget_show(white_label);
	gtk_widget_show(black_label);

	// Play again button
	again_button = gtk_button_new_with_label("Play again");
	gtk_widget_ref(again_button);
	g_object_set_data_full(G_OBJECT(win_main), "again_button",
			       again_button,
			       (GtkDestroyNotify) gtk_widget_unref);
	//gtk_container_add(GTK_CONTAINER(win_main), again_button);


	// Label box
	label_box = gtk_hbox_new(TRUE, 5);
	gtk_widget_ref(label_box);
	g_object_set_data_full(G_OBJECT(win_main), "label_box", label_box,
			       (GtkDestroyNotify) gtk_widget_unref);

	gtk_box_pack_start(GTK_BOX(label_box), black_label_frame, FALSE,
			   TRUE, 0);
	gtk_box_pack_start(GTK_BOX(label_box), again_button, TRUE, TRUE,
			   0);
	gtk_box_pack_end(GTK_BOX(label_box), white_label_frame, FALSE,
			 TRUE, 0);
	gtk_widget_show(label_box);
	gtk_box_pack_start(GTK_BOX(main_box), label_box, FALSE, TRUE, 0);

	// Drawing area
	drawingarea = gtk_drawing_area_new();
	gtk_widget_ref(drawingarea);
	g_object_set_data_full(G_OBJECT(win_main), "drawingarea",
			       drawingarea,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(drawingarea);
	gtk_box_pack_start(GTK_BOX(main_box), drawingarea, TRUE, TRUE, 0);
	gtk_widget_set_size_request(drawingarea, 48 * 8, 48 * 8);
	gtk_widget_set_events(drawingarea,
			      GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);

	// Status bar
	statusbar = gtk_statusbar_new();
	gtk_widget_ref(statusbar);
	g_object_set_data_full(G_OBJECT(win_main), "statusbar", statusbar,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(statusbar);
	gtk_box_pack_start(GTK_BOX(main_box), statusbar, FALSE, FALSE, 0);

	g_signal_connect(GTK_OBJECT(win_main), "delete_event",
			 GTK_SIGNAL_FUNC(main_exit), NULL);
	g_signal_connect(GTK_OBJECT(win_main), "realize",
			 GTK_SIGNAL_FUNC(on_main_win_realize), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "configure_event",
			 GTK_SIGNAL_FUNC(configure_handle), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "expose_event",
			 GTK_SIGNAL_FUNC(expose_handle), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "button_press_event",
			 GTK_SIGNAL_FUNC(handle_move), NULL);
	g_signal_connect(GTK_OBJECT(again_button), "clicked",
			 GTK_SIGNAL_FUNC(play_again), NULL);

	gtk_window_add_accel_group(GTK_WINDOW(win_main), accel_group);

	return win_main;
}
static void
add_provider_to_list (GisGoaPage *page, const char *provider_type)
{
  GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
  GtkWidget *row;
  GtkWidget *box;
  GtkWidget *image;
  GtkWidget *label;
  GtkWidget *checkmark;
  GtkWidget *account_label;
  GIcon *icon;
  gchar *markup, *provider_name;
  GoaProvider *provider;
  ProviderWidget *provider_widget;

  provider = goa_provider_get_for_provider_type (provider_type);
  if (provider == NULL)
    return;

  row = gtk_list_box_row_new ();
  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  g_object_set (box, "margin", 4, NULL);
  gtk_widget_set_hexpand (box, TRUE);

  icon = goa_provider_get_provider_icon (provider, NULL);
  image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
  g_object_unref (icon);

  provider_name = goa_provider_get_provider_name (provider, NULL);
  markup = g_strdup_printf ("<b>%s</b>", provider_name);
  label = gtk_label_new (NULL);
  gtk_label_set_markup (GTK_LABEL (label), markup);
  g_free (markup);
  g_free (provider_name);

  checkmark = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);

  account_label = gtk_label_new (NULL);

  gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
  gtk_box_pack_end (GTK_BOX (box), checkmark, FALSE, FALSE, 8);
  gtk_box_pack_end (GTK_BOX (box), account_label, FALSE, FALSE, 0);

  gtk_container_add (GTK_CONTAINER (row), box);

  gtk_widget_show (label);
  gtk_widget_show (image);
  gtk_widget_show (box);
  gtk_widget_show (row);

  provider_widget = g_new0 (ProviderWidget, 1);
  provider_widget->page = page;
  provider_widget->provider = provider;
  provider_widget->row = row;
  provider_widget->checkmark = checkmark;
  provider_widget->account_label = account_label;

  g_object_set_data_full (G_OBJECT (row), "widget", provider_widget, g_free);

  g_hash_table_insert (priv->providers, (char *) provider_type, provider_widget);

  gtk_container_add (GTK_CONTAINER (priv->accounts_list), row);
}
Beispiel #23
0
int main(int argc, char **argv)
{
	int i;
	GtkWidget *win;
	GtkWidget *divelist;
	GtkWidget *table;
	GtkWidget *notebook;
	GtkWidget *frame;
	GtkWidget *menubar;
	GtkWidget *vbox;

	parse_xml_init();

	gtk_init(&argc, &argv);

	for (i = 1; i < argc; i++) {
		const char *a = argv[i];

		if (a[0] == '-') {
			parse_argument(a);
			continue;
		}
		parse_xml_file(a);
	}

	report_dives();

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(on_destroy), NULL);
	main_window = win;

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(win), vbox);

	menubar = get_menubar_menu(win);
	gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);

	/* Table for the list of dives, cairo window, and dive info */
	table = gtk_table_new(2, 2, FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(table), 5);
	gtk_box_pack_end(GTK_BOX(vbox), table, TRUE, TRUE, 0);
	gtk_widget_show(table);

	/* Create the atual divelist */
	divelist = create_dive_list();
	gtk_table_attach(GTK_TABLE(table), divelist, 0, 1, 0, 2,
		0, GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0);

	/* Frame for minimal dive info */
	frame = dive_info_frame();
	gtk_table_attach(GTK_TABLE(table), frame, 1, 2, 0, 1,
		 GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);

	/* Notebook for dive info vs profile vs .. */
	notebook = gtk_notebook_new();
	gtk_table_attach_defaults(GTK_TABLE(table), notebook, 1, 2, 1, 2);

	/* Frame for dive profile */
	frame = dive_profile_frame();
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, gtk_label_new("Dive Profile"));
	dive_profile = frame;

	/* Frame for extended dive info */
	frame = extended_dive_info_frame();
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, gtk_label_new("Extended dive Info"));

	gtk_widget_set_app_paintable(win, TRUE);
	gtk_widget_show_all(win);

	gtk_main();
	return 0;
}
Beispiel #24
0
static void
cw_window_init (CWWindow *cw_window)
{

	CWWindowPrivate *priv   = CW_WINDOW_GET_PRIVATE(cw_window);
	cw_window_screen_changed(GTK_WIDGET(cw_window), NULL, NULL);

	//gtk_window_set_type_hint(GTK_WINDOW(cw_window),
	//GDK_WINDOW_TYPE_HINT_DOCK);

	gtk_window_set_decorated(GTK_WINDOW(cw_window), FALSE);
	//gtk_window_set_resizable(GTK_WINDOW(cw_window), FALSE);
	//gtk_window_set_position(GTK_WINDOW(cw_window), GTK_WIN_POS_CENTER_ALWAYS);
	//gtk_window_set_skip_taskbar_hint(GTK_WINDOW(cw_window), FALSE);
	//gtk_window_set_skip_pager_hint(GTK_WINDOW(cw_window), FALSE);
	//gtk_window_set_default_size(GTK_WINDOW(cw_window), 800, 480);
	cw_window_set_pos_size(GTK_WIDGET(cw_window), priv);
	//gtk_window_maximize(GTK_WINDOW(cw_window));

	gtk_widget_add_events(GTK_WIDGET(cw_window),
			GDK_POINTER_MOTION_MASK
			| GDK_KEY_RELEASE_MASK
			| GDK_BUTTON_PRESS_MASK
			| GDK_BUTTON_RELEASE_MASK);


	priv->picture_window = cw_picture_window_new();
	//priv->picture_alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
	//gtk_alignment_set_padding(
			//GTK_ALIGNMENT(priv->picture_alignment),
			//0, 0, 0, 0);

	//gtk_container_add(
			//GTK_CONTAINER(priv->picture_alignment),
			//priv->picture_window);

	priv->thumbnails_window = cw_thumbnails_window_new();
	priv->thumbnails_alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
	gtk_alignment_set_padding(
			GTK_ALIGNMENT(priv->thumbnails_alignment),
			THUMBNAIL_WINDOW_SIDE_SIZE,
			THUMBNAIL_WINDOW_SIDE_SIZE,
			THUMBNAIL_WINDOW_SIDE_SIZE,
			THUMBNAIL_WINDOW_SIDE_SIZE);

	gtk_container_add(
			GTK_CONTAINER(priv->thumbnails_alignment),
			priv->thumbnails_window);

	priv->main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	gtk_box_pack_end(
			GTK_BOX(priv->main_box),
			priv->thumbnails_alignment,
			TRUE,
			TRUE,
			0);

	gtk_box_pack_end(
			GTK_BOX(priv->main_box),
			priv->picture_window,
			TRUE,
			TRUE,
			0);

	gtk_container_add(
		GTK_CONTAINER(cw_window),
		priv->main_box);

	GdkRGBA rgba = { 1, 1, 1, 0.0};
	gtk_widget_override_background_color(GTK_WIDGET(cw_window),
			GTK_STATE_FLAG_NORMAL, &rgba);

	gtk_widget_override_background_color(GTK_WIDGET(priv->main_box),
			GTK_STATE_FLAG_NORMAL, &rgba);

	gtk_widget_show_all(GTK_WIDGET (priv->thumbnails_alignment));
	gtk_widget_show(GTK_WIDGET (priv->main_box));
	gtk_widget_show(GTK_WIDGET (cw_window));

	cw_window_set_child_window(GTK_WIDGET(cw_window), priv);

	gtk_widget_shape_combine_region(GTK_WIDGET(cw_window), NULL);

	g_signal_connect(
			priv->picture_window,
			"picture-switch",
			G_CALLBACK(cw_thumbnails_window_on_picture_switch),
			priv->thumbnails_window);

	g_signal_connect(
			priv->thumbnails_window,
			"active_large_image",
			G_CALLBACK(cw_window_active_large_image),
			cw_window);

	/* TODO: Add initialization code here */
}
Beispiel #25
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_splittoning_gui_data_t));
  dt_iop_splittoning_gui_data_t *g = (dt_iop_splittoning_gui_data_t *)self->gui_data;
  dt_iop_splittoning_params_t *p = (dt_iop_splittoning_params_t *)self->params;

  self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 0));
  // Shadows
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(dtgtk_label_new(_("shadows"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT)), FALSE, FALSE, 5);

  g->colorpick1 = DTGTK_BUTTON(dtgtk_button_new(dtgtk_cairo_paint_color,CPF_IGNORE_FG_STATE|CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER));
  gtk_widget_set_size_request(GTK_WIDGET(g->colorpick1),32,32);

  GtkWidget *hbox=GTK_WIDGET(gtk_hbox_new(FALSE, 0));
  g->vbox1 = GTK_VBOX(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
  g->vbox2 = GTK_VBOX(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->vbox1), FALSE, FALSE, 5);
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->vbox2), TRUE, TRUE, 5);
  gtk_box_pack_end(GTK_BOX(hbox),GTK_WIDGET(g->colorpick1),FALSE,FALSE,0);
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 5);

  g->label1 = dtgtk_reset_label_new (_("hue"), self, &p->shadow_hue, sizeof(float));
  g->label2 = dtgtk_reset_label_new (_("saturation"), self, &p->shadow_saturation, sizeof(float));
  gtk_box_pack_start(GTK_BOX(g->vbox1), GTK_WIDGET(g->label1), TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(g->vbox1), GTK_WIDGET(g->label2), TRUE, TRUE, 0);
  int lightness=32768;
  g->gslider1=DTGTK_GRADIENT_SLIDER(dtgtk_gradient_slider_new_with_color((GdkColor)
  {
    0,lightness,0,0
  },(GdkColor)
  {
    0,lightness,0,0
  }));
  dtgtk_gradient_slider_set_stop(g->gslider1,0.166,(GdkColor)
  {
    0,lightness,lightness,0
  });
  dtgtk_gradient_slider_set_stop(g->gslider1,0.332,(GdkColor)
  {
    0,0,lightness,0
  });
  dtgtk_gradient_slider_set_stop(g->gslider1,0.498,(GdkColor)
  {
    0,0,lightness,lightness
  });
  dtgtk_gradient_slider_set_stop(g->gslider1,0.664,(GdkColor)
  {
    0,0,0,lightness
  });
  dtgtk_gradient_slider_set_stop(g->gslider1,0.83,(GdkColor)
  {
    0,lightness,0,lightness
  });
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->gslider1), TRUE, TRUE, 0);
  g_object_set(G_OBJECT(g->gslider1), "tooltip-text", _("select the hue tone for shadows"), (char *)NULL);

  g->gslider2=DTGTK_GRADIENT_SLIDER(dtgtk_gradient_slider_new_with_color((GdkColor)
  {
    0,lightness,lightness,lightness
  },(GdkColor)
  {
    0,lightness,lightness,lightness
  }));
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->gslider2), TRUE, TRUE, 0);
  g_object_set(G_OBJECT(g->gslider2), "tooltip-text", _("select the saturation shadow tone"), (char *)NULL);

  // Highlights
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(dtgtk_label_new(_("highlights"),DARKTABLE_LABEL_TAB|DARKTABLE_LABEL_ALIGN_RIGHT)), FALSE, FALSE, 5);

  g->colorpick2 = DTGTK_BUTTON(dtgtk_button_new(dtgtk_cairo_paint_color,CPF_IGNORE_FG_STATE|CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER));
  gtk_widget_set_size_request(GTK_WIDGET(g->colorpick2),32,32);

  hbox=GTK_WIDGET(gtk_hbox_new(FALSE, 0));
  g->vbox1 = GTK_VBOX(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
  g->vbox2 = GTK_VBOX(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->vbox1), FALSE, FALSE, 5);
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->vbox2), TRUE, TRUE, 5);
  gtk_box_pack_end(GTK_BOX(hbox),GTK_WIDGET(g->colorpick2),FALSE,FALSE,0);
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 5);

  g->label3 = dtgtk_reset_label_new (_("hue"), self, &p->highlight_hue, sizeof(float));
  g->label4 = dtgtk_reset_label_new (_("saturation"), self, &p->highlight_saturation, sizeof(float));
  gtk_box_pack_start(GTK_BOX(g->vbox1), GTK_WIDGET(g->label3), TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(g->vbox1), GTK_WIDGET(g->label4), TRUE, TRUE, 0);


  g->gslider3=DTGTK_GRADIENT_SLIDER(dtgtk_gradient_slider_new_with_color((GdkColor)
  {
    0,lightness,0,0
  },(GdkColor)
  {
    0,lightness,0,0
  }));
  dtgtk_gradient_slider_set_stop(g->gslider3,0.166,(GdkColor)
  {
    0,lightness,lightness,0
  });
  dtgtk_gradient_slider_set_stop(g->gslider3,0.332,(GdkColor)
  {
    0,0,lightness,0
  });
  dtgtk_gradient_slider_set_stop(g->gslider3,0.498,(GdkColor)
  {
    0,0,lightness,lightness
  });
  dtgtk_gradient_slider_set_stop(g->gslider3,0.664,(GdkColor)
  {
    0,0,0,lightness
  });
  dtgtk_gradient_slider_set_stop(g->gslider3,0.83,(GdkColor)
  {
    0,lightness,0,lightness
  });
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->gslider3), TRUE, TRUE, 0);
  g_object_set(G_OBJECT(g->gslider3), "tooltip-text", _("select the hue tone for highlights"), (char *)NULL);

  g->gslider4=DTGTK_GRADIENT_SLIDER(dtgtk_gradient_slider_new_with_color((GdkColor)
  {
    0,lightness,lightness,lightness
  },(GdkColor)
  {
    0,lightness,lightness,lightness
  }));
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->gslider4), TRUE, TRUE, 0);
  g_object_set(G_OBJECT(g->gslider4), "tooltip-text", _("select the saturation highlights tone"), (char *)NULL);

  // Additional paramters
  hbox=GTK_WIDGET(gtk_hbox_new(FALSE, 0));
  g->vbox2 = GTK_VBOX(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->vbox2), TRUE, TRUE, 5);
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 5);

  g->scale1 = dt_bauhaus_slider_new_with_range(self, 0.0, 100.0, 0.1, p->balance*100.0, 2);
  dt_bauhaus_slider_set_format(g->scale1, "%.2f");
  dt_bauhaus_widget_set_label(g->scale1, _("balance"));
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->scale1), TRUE, TRUE, 0);

  g->scale2 = dt_bauhaus_slider_new_with_range(self, 0.0, 100.0, 1.0, p->compress, 2);
  dt_bauhaus_slider_set_format(g->scale2, "%.2f%%");
  dt_bauhaus_widget_set_label(g->scale2,_("compress"));
  gtk_box_pack_start(GTK_BOX(g->vbox2), GTK_WIDGET(g->scale2), TRUE, TRUE, 0);


  g_object_set(G_OBJECT(g->scale1), "tooltip-text", _("the balance of center of splittoning"), (char *)NULL);
  g_object_set(G_OBJECT(g->scale2), "tooltip-text", _("compress the effect on highlighs/shadows and\npreserve midtones"), (char *)NULL);

  g_signal_connect (G_OBJECT (g->gslider1), "value-changed",
                    G_CALLBACK (hue_callback), self);
  g_signal_connect (G_OBJECT (g->gslider3), "value-changed",
                    G_CALLBACK (hue_callback), self);

  g_signal_connect (G_OBJECT (g->gslider2), "value-changed",
                    G_CALLBACK (saturation_callback), self);
  g_signal_connect (G_OBJECT (g->gslider4), "value-changed",
                    G_CALLBACK (saturation_callback), self);

  g_signal_connect (G_OBJECT (g->scale1), "value-changed",
                    G_CALLBACK (balance_callback), self);
  g_signal_connect (G_OBJECT (g->scale2), "value-changed",
                    G_CALLBACK (compress_callback), self);


  g_signal_connect (G_OBJECT (g->colorpick1), "clicked",
                    G_CALLBACK (colorpick_callback), self);
  g_signal_connect (G_OBJECT (g->colorpick2), "clicked",
                    G_CALLBACK (colorpick_callback), self);

}
GimpColorProfilePolicy
color_profile_import_dialog_run (GimpImage         *image,
                                 GimpContext       *context,
                                 GtkWidget         *parent,
                                 GimpColorProfile **dest_profile,
                                 gboolean          *dont_ask)
{
  GtkWidget              *dialog;
  GtkWidget              *main_vbox;
  GtkWidget              *frame;
  GtkWidget              *label;
  GtkWidget              *toggle;
  GimpColorProfile       *src_profile;
  GimpColorProfilePolicy  policy;
  const gchar            *title;
  const gchar            *frame_title;
  gchar                  *text;

  g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_COLOR_PROFILE_POLICY_KEEP);
  g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_COLOR_PROFILE_POLICY_KEEP);
  g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent),
                        GIMP_COLOR_PROFILE_POLICY_KEEP);
  g_return_val_if_fail (dest_profile != NULL, GIMP_COLOR_PROFILE_POLICY_KEEP);

  src_profile   = gimp_image_get_color_profile (image);
  *dest_profile = gimp_image_get_builtin_color_profile (image);

  if (gimp_image_get_base_type (image) == GIMP_GRAY)
    {
      title       = _("Convert to Grayscale Working Space?");
      frame_title = _("Convert the image to the grayscale working space?");
    }
  else
    {
      title       = _("Convert to RGB Working Space?");
      frame_title = _("Convert the image to the RGB working space?");
    }

  dialog =
    gimp_viewable_dialog_new (GIMP_VIEWABLE (image), context,
                              title,
                              "gimp-image-color-profile-import",
                              NULL,
                              _("Import the image from a color profile"),
                              parent,
                              gimp_standard_help_func,
                              GIMP_HELP_IMAGE_COLOR_PROFILE_IMPORT,

                              _("Keep"),    GTK_RESPONSE_CANCEL,
                              _("Convert"), GTK_RESPONSE_OK,

                              NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);

  main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                      main_vbox, TRUE, TRUE, 0);
  gtk_widget_show (main_vbox);

  text = g_strdup_printf (_("The image '%s' has an embedded color profile"),
                          gimp_image_get_display_name (image));
  frame = gimp_frame_new (text);
  g_free (text);
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  label = gimp_color_profile_label_new (src_profile);
  gtk_container_add (GTK_CONTAINER (frame), label);
  gtk_widget_show (label);

  frame = gimp_frame_new (frame_title);
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  label = gimp_color_profile_label_new (*dest_profile);
  gtk_container_add (GTK_CONTAINER (frame), label);
  gtk_widget_show (label);

  if (dont_ask)
    {
      toggle = gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
      gtk_box_pack_end (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
      gtk_widget_show (toggle);
    }

  switch (gtk_dialog_run (GTK_DIALOG (dialog)))
    {
    case GTK_RESPONSE_OK:
      policy = GIMP_COLOR_PROFILE_POLICY_CONVERT;
      g_object_ref (*dest_profile);
      break;

    default:
      policy = GIMP_COLOR_PROFILE_POLICY_KEEP;
      break;
    }

  if (dont_ask)
    {
      *dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
    }

  gtk_widget_destroy (dialog);

  return policy;
}
static void
run_filebrowser_gtk2style(gboolean play_button, gboolean show)
{
    static GtkWidget *window = NULL;
    GtkWidget *vbox, *hbox, *bbox;
    GtkWidget *chooser;
    GtkWidget *action_button, *close_button;
    GtkWidget *toggle;
    gchar *window_title, *toggle_text;
    gpointer action_stock, storage;

    if (!show) {
        if (window){
            gtk_widget_hide(window);
            return;
        }
        else
            return;
    }
    else {
        if (window) {
            gtk_window_present(GTK_WINDOW(window)); /* raise filebrowser */
            return;
        }
    }

    window_title = play_button ? _("Open Files") : _("Add Files");
    toggle_text = play_button ?
        _("Close dialog on Open") : _("Close dialog on Add");
    action_stock = play_button ? GTK_STOCK_OPEN : GTK_STOCK_ADD;

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_window_set_title(GTK_WINDOW(window), window_title);
    gtk_window_set_default_size(GTK_WINDOW(window), 700, 450);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_container_set_border_width(GTK_CONTAINER(window), 10);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN);
    gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE);

    gchar * path = aud_get_string ("audgui", "filesel_path");
    if (path[0])
        gtk_file_chooser_set_current_folder ((GtkFileChooser *) chooser, path);
    g_free (path);

    gtk_box_pack_start(GTK_BOX(vbox), chooser, TRUE, TRUE, 3);

    hbox = gtk_hbox_new(TRUE, 0);
    gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);

    toggle = gtk_check_button_new_with_label(toggle_text);
    gtk_toggle_button_set_active ((GtkToggleButton *) toggle, aud_get_bool
     ("audgui", "close_dialog_open"));
    gtk_box_pack_start(GTK_BOX(hbox), toggle, TRUE, TRUE, 3);

    bbox = gtk_hbutton_box_new();
    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
    gtk_box_set_spacing(GTK_BOX(bbox), 6);
    gtk_box_pack_end(GTK_BOX(hbox), bbox, TRUE, TRUE, 3);

    close_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
    action_button = gtk_button_new_from_stock(action_stock);
    gtk_container_add(GTK_CONTAINER(bbox), close_button);
    gtk_container_add(GTK_CONTAINER(bbox), action_button);

    gtk_widget_set_can_default (action_button, TRUE);
    gtk_widget_grab_default (action_button);

    /* this storage object holds several other objects which are used in the
     * callback functions
     */
    storage = g_object_new(G_TYPE_OBJECT, NULL);
    g_object_set_data(storage, "window", window);
    g_object_set_data(storage, "chooser", chooser);
    g_object_set_data(storage, "toggle-button", toggle);
    g_object_set_data(storage, "play-button", GINT_TO_POINTER(play_button));

    g_signal_connect(chooser, "file-activated",
                     G_CALLBACK(action_button_cb), storage);
    g_signal_connect(action_button, "clicked",
                     G_CALLBACK(action_button_cb), storage);
    g_signal_connect(close_button, "clicked",
                     G_CALLBACK(close_button_cb), window);
    g_signal_connect(window, "destroy",
                     G_CALLBACK(gtk_widget_destroyed), &window);

    audgui_destroy_on_escape (window);
    gtk_widget_show_all (window);
}
Beispiel #28
0
void anypaper_window_create (AnypaperWindow *self)
{
	AnypaperWindowPrivate *priv = self->priv;

	GtkWidget *window;
	GtkWidget *label;
	GtkWidget *image, *background;
	GtkWidget *rmenu;
	GtkWidget *button;
	GtkWidget *note, *vbox1, *vbox2, *hbox1, *table, *halign;
	gchar *filename, *buffer;
	GdkPixbuf *tempbuf;
	GdkColor color;

	self->priv->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	gtk_window_set_title (GTK_WINDOW (window), "anyPaper " VERSION);
	gtk_window_set_default_size(GTK_WINDOW(window), 500, 100);

	gtk_window_set_icon_from_file (GTK_WINDOW(window), ANYPAPER_DATA "anypaper.png", NULL);

	g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);

	gtk_container_set_border_width (GTK_CONTAINER (window), 10);
	
	vbox2 = gtk_vbox_new (FALSE, 0);

	gtk_container_add (GTK_CONTAINER (window), vbox2);

	note = gtk_notebook_new ();

	vbox1 = gtk_vbox_new (FALSE, 10);

	label = gtk_label_new ("Wallpaper");
	gtk_notebook_append_page (GTK_NOTEBOOK(note), vbox1, label);
	gtk_widget_show (label);
	
	table = gtk_table_new (3, 4, FALSE);

	label = gtk_label_new ("File: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->file_entry = gtk_entry_new();
	gtk_entry_set_text (GTK_ENTRY (priv->file_entry), self->parameters->file);
	g_signal_connect (G_OBJECT (priv->file_entry), "activate", G_CALLBACK (set_image_file_cb), self);
	gtk_table_attach (GTK_TABLE (table), priv->file_entry, 1, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->file_entry);

	button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
	image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (open_image_file_cb), self);
	gtk_table_attach (GTK_TABLE (table), button, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (button);

	label = gtk_label_new ("Style: ");
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	halign = gtk_alignment_new(0, 1, 0, 0);
	priv->combo = gtk_combo_box_new_text ();
	gtk_container_add(GTK_CONTAINER(halign), priv->combo);
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Fullscreen");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Normal");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Tiled");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Adjusted");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Scaled");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), "Custom Scale");
	gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), self->parameters->style);
	g_signal_connect (G_OBJECT (priv->combo), "changed", G_CALLBACK (set_image_style_cb), self);
	gtk_table_attach (GTK_TABLE (table), halign, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->combo);
	gtk_widget_show (halign);

	priv->custom_table = gtk_table_new (2, 3, FALSE);

	label = gtk_label_new ("Scale x: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (priv->custom_table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->spin5 = gtk_spin_button_new_with_range (0, 100, .1);
	gtk_spin_button_set_digits (GTK_SPIN_BUTTON (priv->spin5), 4);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin5), self->parameters->scalex);
	g_signal_connect (G_OBJECT (priv->spin5), "value-changed", G_CALLBACK (change_other_scale_cb), self);
	g_signal_connect_after (G_OBJECT (priv->spin5), "value-changed", G_CALLBACK (set_image_scale_cb), self);
	gtk_table_attach (GTK_TABLE (priv->custom_table), priv->spin5, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin5);

	button = gtk_toggle_button_new_with_mnemonic("linked");
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(button), priv->custom_scale_connect_state);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (connect_custom_scale_cb), self);
	gtk_table_attach (GTK_TABLE (priv->custom_table), button, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (button);

	label = gtk_label_new ("Scale y: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (priv->custom_table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->spin6 = gtk_spin_button_new_with_range (0, 100, .1);
	gtk_spin_button_set_digits (GTK_SPIN_BUTTON (priv->spin6), 4);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin6), self->parameters->scaley);
	g_signal_connect (G_OBJECT (priv->spin6), "value-changed", G_CALLBACK (change_other_scale_cb), self);
	g_signal_connect_after (G_OBJECT (priv->spin6), "value-changed", G_CALLBACK (set_image_scale_cb), self);
	gtk_table_attach (GTK_TABLE (priv->custom_table), priv->spin6, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin6);

	gtk_table_attach (GTK_TABLE (table), priv->custom_table, 2, 4, 1, 3, GTK_FILL, GTK_FILL, 0, 0);
	if (self->parameters->style == 5) gtk_widget_show (priv->custom_table);
	else gtk_widget_hide (priv->custom_table);

	label = gtk_label_new ("Background: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	gdk_color_parse (self->parameters->background, &color);
	halign = gtk_alignment_new(0, 1, 0, 0);
	priv->cbutton = gtk_color_button_new_with_color (&color);
	gtk_container_add(GTK_CONTAINER(halign), priv->cbutton);
	g_signal_connect (G_OBJECT (priv->cbutton), "color-set", G_CALLBACK (set_image_background_cb), self);
	gtk_table_attach (GTK_TABLE (table), halign, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->cbutton);

	gtk_widget_show (halign);

	gtk_box_pack_start (GTK_BOX(vbox1), table, FALSE, TRUE, 0);
	gtk_widget_show (table);

	hbox1 = gtk_hbox_new (FALSE, 0);

	priv->preview = gtk_image_new_from_pixbuf(self->image->preview);
	gtk_box_pack_start (GTK_BOX(hbox1), priv->preview, TRUE, FALSE, 2);
	gtk_widget_show (priv->preview);

	table = gtk_table_new (5, 2, FALSE);

	priv->label1 = gtk_label_new ("Position x: ");
	gtk_misc_set_alignment (GTK_MISC(priv->label1), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (priv->label1), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), priv->label1, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->label1);

	priv->spin1 = gtk_spin_button_new_with_range (-65535, 65535, 1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin1), self->parameters->positionx);
	g_signal_connect (G_OBJECT (priv->spin1), "value-changed", G_CALLBACK (set_image_position_cb), self);
	gtk_table_attach (GTK_TABLE (table), priv->spin1, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin1);

	priv->label2 = gtk_label_new ("Position y: ");
	gtk_misc_set_alignment (GTK_MISC(priv->label2), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (priv->label2), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), priv->label2, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->label2);

	priv->spin2 = gtk_spin_button_new_with_range (-65535, 65535, 1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin2), self->parameters->positiony);
	g_signal_connect (G_OBJECT (priv->spin2), "value-changed", G_CALLBACK (set_image_position_cb), self);
	gtk_table_attach (GTK_TABLE (table), priv->spin2, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin2);

	label = gtk_label_new ("Width: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->spin3 = gtk_spin_button_new_with_range (0, 65535, 1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin3), self->parameters->width);
	g_signal_connect (G_OBJECT (priv->spin3), "value-changed", G_CALLBACK (set_image_size_cb), self);
	gtk_table_attach (GTK_TABLE (table), priv->spin3, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin3);

	label = gtk_label_new ("Height: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->spin4 = gtk_spin_button_new_with_range (0, 65535, 1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON (priv->spin4), self->parameters->height);
	g_signal_connect (G_OBJECT (priv->spin4), "value-changed", G_CALLBACK (set_image_size_cb), self);
	gtk_table_attach (GTK_TABLE (table), priv->spin4, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->spin4);

	button = gtk_button_new_with_mnemonic ("_Center");
	g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(center_image_cb), self);
	gtk_table_attach (GTK_TABLE (table), button, 0, 2, 4, 5, GTK_SHRINK, GTK_SHRINK, 0, 0);
	gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX(hbox1), table, FALSE, TRUE, 0);
	gtk_widget_show (table);

	gtk_box_pack_start (GTK_BOX(vbox1), hbox1, FALSE, TRUE, 2);
	gtk_widget_show (hbox1);

	hbox1 = gtk_hbox_new (FALSE, 0);

	button = gtk_button_new_with_mnemonic ("Show _Preview");
	g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(show_window_preview_cb), self);
	gtk_box_pack_start (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	button = gtk_button_new_with_mnemonic ("Load lastwallpaper file");
	image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (load_lastwallpaperfile_cb), self);
	gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX(vbox1), hbox1, FALSE, TRUE, 2);
	gtk_widget_show (hbox1);

	gtk_widget_show (vbox1);

	vbox1 = gtk_vbox_new (FALSE, 2);

	label = gtk_label_new ("Configuration");
	gtk_notebook_append_page (GTK_NOTEBOOK(note), vbox1, label);
	gtk_widget_show (label);

	table = gtk_table_new (3, 3, FALSE);

	label = gtk_label_new ("Default output file: ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	priv->def_entry = gtk_entry_new();
	gtk_entry_set_text (GTK_ENTRY (priv->def_entry), self->parameters->defaultfile);
	gtk_table_attach_defaults (GTK_TABLE (table), priv->def_entry, 1, 2, 0, 1);
	gtk_widget_show (priv->def_entry);

	button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
	image = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (save_default_file_cb), self);
	gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (button);

	label = gtk_label_new ("Command (Wallpapersetter): ");
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);
	
	button = gtk_button_new_with_mnemonic ("Detect");
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (detect_popup_cb), self);
	gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (button);

	priv->com_entry = gtk_entry_new();
	gtk_entry_set_text (GTK_ENTRY (priv->com_entry), self->parameters->command);
	gtk_table_attach_defaults (GTK_TABLE (table), priv->com_entry, 1, 2, 1, 2);
	gtk_widget_show (priv->com_entry);

	label = gtk_label_new ("Interpolation: ");
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (label);

	halign = gtk_alignment_new(0, 1, 0, 0);
	priv->combo_interpolation = gtk_combo_box_new_text ();
	gtk_container_add(GTK_CONTAINER(halign), priv->combo_interpolation);
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_interpolation), "GDK_INTERP_NEAREST");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_interpolation), "GDK_INTERP_TILES");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_interpolation), "GDK_INTERP_BILINEAR");
	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_interpolation), "GDK_INTERP_HYPER");
	gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_interpolation), interpolation_int (self->parameters->interpolation));
	g_signal_connect (G_OBJECT (priv->combo_interpolation), "changed", G_CALLBACK (set_image_interpolation_cb), self);
	gtk_table_attach (GTK_TABLE (table), halign, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
	gtk_widget_show (priv->combo_interpolation);
	gtk_widget_show (halign);

	gtk_box_pack_start (GTK_BOX(vbox1), table, FALSE, TRUE, 0);
	gtk_widget_show (table);

	hbox1 = gtk_hbox_new (FALSE, 0);

	button = gtk_button_new_with_mnemonic ("Load anypaperrc file");
	image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (load_rcfile_cb), self);
	gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	gtk_box_pack_end (GTK_BOX(vbox1), hbox1, FALSE, TRUE, 2);
	gtk_widget_show (hbox1);

	gtk_widget_show (vbox1);

	gtk_box_pack_start (GTK_BOX(vbox2), note, FALSE, TRUE, 0);
	
	hbox1 = gtk_hbox_new (FALSE, 0);

	if (no_set == FALSE)
	{	
		button = gtk_button_new_from_stock (GTK_STOCK_OK);
		image = gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON);

	}
	else
	{
		button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
		image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_BUTTON);
	}
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	if (no_set == FALSE)
	{
		g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(ok_cb), self);
	}
	else g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (delete_event), NULL);
	gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	if (no_set == FALSE)
	{
		button = gtk_button_new_from_stock (GTK_STOCK_APPLY);
		image = gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
		gtk_button_set_image (GTK_BUTTON(button), image);
		gtk_widget_show (image);
		g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(apply_cb), self);
		gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
		gtk_widget_show (button);

		button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
		image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON);
		gtk_button_set_image (GTK_BUTTON(button), image);
		gtk_widget_show (image);
		g_signal_connect (G_OBJECT (button), "clicked",	G_CALLBACK (delete_event), NULL);
		gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
		gtk_widget_show (button);
	}

	button = gtk_button_new_from_stock (GTK_STOCK_SAVE_AS);
	image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (save_file_as_cb), self);
	gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	button = gtk_button_new_from_stock (GTK_STOCK_ABOUT);
	image = gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON(button), image);
	gtk_widget_show (image);
	g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(about_window_cb), G_OBJECT (window));
	gtk_box_pack_start (GTK_BOX(hbox1), button, FALSE, FALSE, 2);
	gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX(vbox2), hbox1, FALSE, TRUE, 0);
	gtk_widget_show (hbox1);

	gtk_widget_show (vbox2);

	gtk_widget_show (note);

	gtk_widget_show (window);
}
Beispiel #29
0
static PanelAddtoDialog *
panel_addto_dialog_new (PanelWidget *panel_widget)
{
	PanelAddtoDialog *dialog;
	GtkWidget *dialog_vbox;
#if !GTK_CHECK_VERSION (3, 0, 0)
	GtkWidget *vbox;
#endif
	GtkWidget *inner_vbox;
	GtkWidget *find_hbox;
	GtkWidget *sw;
	GtkCellRenderer *renderer;
	GtkTreeSelection *selection;
	GtkTreeViewColumn *column;

	dialog = g_new0 (PanelAddtoDialog, 1);

	g_object_set_qdata_full (G_OBJECT (panel_widget->toplevel),
				 panel_addto_dialog_quark,
				 dialog,
				 (GDestroyNotify) panel_addto_dialog_free);

	dialog->panel_widget = panel_widget;

	g_signal_connect (dialog->panel_widget->toplevel->settings,
			  "changed::" PANEL_TOPLEVEL_NAME_KEY,
			  G_CALLBACK (panel_addto_name_notify),
			  dialog);

	dialog->addto_dialog = gtk_dialog_new ();
	gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
			       GTK_STOCK_HELP, GTK_RESPONSE_HELP);
	dialog->back_button = gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
						     GTK_STOCK_GO_BACK,
						     PANEL_ADDTO_RESPONSE_BACK);
	dialog->add_button = gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
						     GTK_STOCK_ADD,
						     PANEL_ADDTO_RESPONSE_ADD);
	gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
			       GTK_STOCK_CLOSE,
			       GTK_RESPONSE_CLOSE);
	gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), FALSE);

	gtk_dialog_set_default_response (GTK_DIALOG (dialog->addto_dialog),
					 PANEL_ADDTO_RESPONSE_ADD);

	gtk_container_set_border_width (GTK_CONTAINER (dialog->addto_dialog), 5);

	dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog->addto_dialog));
#if GTK_CHECK_VERSION (3, 0, 0)
	gtk_box_set_spacing (GTK_BOX (dialog_vbox), 12);
	gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
#else
	gtk_box_set_spacing (GTK_BOX (dialog_vbox), 2);
#endif

	g_signal_connect (G_OBJECT (dialog->addto_dialog), "response",
			  G_CALLBACK (panel_addto_dialog_response), dialog);
	g_signal_connect (dialog->addto_dialog, "destroy",
			  G_CALLBACK (panel_addto_dialog_destroy), dialog);

#if !GTK_CHECK_VERSION (3, 0, 0)
	vbox = gtk_vbox_new (FALSE, 12);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
	gtk_container_add (GTK_CONTAINER (dialog_vbox), vbox);
#endif

	inner_vbox = gtk_vbox_new (FALSE, 6);
#if GTK_CHECK_VERSION (3, 0, 0)
	gtk_box_pack_start (GTK_BOX (dialog_vbox), inner_vbox, TRUE, TRUE, 0);
#else
	gtk_box_pack_start (GTK_BOX (vbox), inner_vbox, TRUE, TRUE, 0);
#endif

	find_hbox = gtk_hbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (inner_vbox), find_hbox, FALSE, FALSE, 0);

	dialog->label = gtk_label_new_with_mnemonic ("");
	gtk_misc_set_alignment (GTK_MISC (dialog->label), 0.0, 0.5);
	gtk_label_set_use_markup (GTK_LABEL (dialog->label), TRUE);

	gtk_box_pack_start (GTK_BOX (find_hbox), dialog->label,
			    FALSE, FALSE, 0);

	dialog->search_entry = gtk_entry_new ();
	g_signal_connect (G_OBJECT (dialog->search_entry), "changed",
			  G_CALLBACK (panel_addto_search_entry_changed), dialog);
	g_signal_connect (G_OBJECT (dialog->search_entry), "activate",
			  G_CALLBACK (panel_addto_search_entry_activated), dialog);

	gtk_box_pack_end (GTK_BOX (find_hbox), dialog->search_entry,
			  TRUE, TRUE, 0);

	gtk_label_set_mnemonic_widget (GTK_LABEL (dialog->label),
				       dialog->search_entry);

	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
					     GTK_SHADOW_IN);
	gtk_box_pack_start (GTK_BOX (inner_vbox), sw, TRUE, TRUE, 0);

	dialog->tree_view = gtk_tree_view_new ();
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->tree_view),
					   FALSE);
	gtk_tree_view_expand_all (GTK_TREE_VIEW (dialog->tree_view));

	renderer = g_object_new (GTK_TYPE_CELL_RENDERER_PIXBUF,
				 "xpad", 4,
				 "ypad", 4,
				 NULL);

	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (dialog->tree_view),
						     -1, NULL,
						     renderer,
						     "pixbuf", COLUMN_ICON,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (dialog->tree_view),
						     -1, NULL,
						     renderer,
						     "markup", COLUMN_TEXT,
						     NULL);

	//FIXME use the same search than the one for the search entry?
	gtk_tree_view_set_search_column (GTK_TREE_VIEW (dialog->tree_view),
					 COLUMN_SEARCH);

	gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (dialog->tree_view),
					      panel_addto_separator_func,
					      GINT_TO_POINTER (COLUMN_TEXT),
					      NULL);


	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tree_view));
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);

	column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->tree_view),
					   COLUMN_TEXT);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);

	g_signal_connect (selection, "changed",
			  G_CALLBACK (panel_addto_selection_changed),
			  dialog);

	g_signal_connect (dialog->tree_view, "row-activated",
			  G_CALLBACK (panel_addto_selection_activated),
			  dialog);

	gtk_container_add (GTK_CONTAINER (sw), dialog->tree_view);

#if GTK_CHECK_VERSION (3, 0, 0)
	gtk_widget_show_all (dialog_vbox);
#else
	gtk_widget_show_all (vbox);
#endif

	panel_toplevel_push_autohide_disabler (dialog->panel_widget->toplevel);
	panel_widget_register_open_dialog (panel_widget,
					   dialog->addto_dialog);

	panel_addto_name_change (dialog,
				 panel_toplevel_get_name (dialog->panel_widget->toplevel));

	return dialog;
}
Beispiel #30
0
static void
tree_menu (void)
{
  GtkWidget *window, *widget;
  GtkWidget *menubar, *vbox;
  GtkCellArea *area;
  GtkTreeModel *store;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_window_set_title (GTK_WINDOW (window), "GtkTreeMenu");

  vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
  gtk_widget_show (vbox);

  menubar = gtk_menu_bar_new ();
  gtk_widget_show (menubar);

  store = simple_tree_model ();
  area  = create_cell_area ();

#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
  menuitem = gtk_menu_item_new_with_label ("Grid");
  menu = create_menu_grid_demo ();
  gtk_widget_show (menu);
  gtk_widget_show (menuitem);
  gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);

  menuitem = gtk_menu_item_new_with_label ("Tree");
  menu = simple_tree_menu ();
  gtk_widget_show (menu);
  gtk_widget_show (menuitem);
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menubar), menuitem);
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);

  g_signal_connect (menu, "menu-activate", G_CALLBACK (menu_activated_cb), NULL);

  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
#endif

  /* Add a combo box with the same menu ! */
  widget = gtk_combo_box_new_with_area (area);
  gtk_combo_box_set_model (GTK_COMBO_BOX (widget), store);
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);
  gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

  /* Now add some controls */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (orientation_changed), area);

  widget = gtk_check_button_new_with_label ("Align 2nd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (align_cell_2_toggled), area);

  widget = gtk_check_button_new_with_label ("Align 3rd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (align_cell_3_toggled), area);

  widget = gtk_check_button_new_with_label ("Expand 1st Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_1_toggled), area);

  widget = gtk_check_button_new_with_label ("Expand 2nd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_2_toggled), area);

  widget = gtk_check_button_new_with_label ("Expand 3rd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_3_toggled), area);

#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
  widget = gtk_check_button_new_with_label ("Submenu Headers");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (submenu_headers_toggled), menu);

  widget = gtk_check_button_new_with_label ("Tearoff menu");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (tearoff_toggled), menu);
#endif

  gtk_container_add (GTK_CONTAINER (window), vbox);

  gtk_widget_show (window);
}