~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-gui-factory.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-09-07 20:31:25 UTC
  • mto: (18.1.1 cairo-dock) (19.1.1 cairo-dock)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20100907203125-a91ch8odv2r6ziic
Tags: upstream-2.2.0~0rc1
ImportĀ upstreamĀ versionĀ 2.2.0~0rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
597
597
        {
598
598
                gchar *cFilePath = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pFileChooserDialog));
599
599
                gtk_entry_set_text (pEntry, cFilePath);
 
600
                g_free (cFilePath);
600
601
        }
601
602
        gtk_widget_destroy (pFileChooserDialog);
602
603
}
1138
1139
}
1139
1140
static void _cairo_dock_fill_modele_with_short_themes (const gchar *cThemeName, CairoDockPackage *pTheme, GtkListStore *pModele)
1140
1141
{
1141
 
        _fill_modele_with_themes (cThemeName, pTheme, pModele, TRUE, TRUE);
 
1142
        _fill_modele_with_themes (cThemeName, pTheme, pModele, FALSE/**TRUE*/, TRUE);
1142
1143
}
1143
1144
 
1144
1145
static void _got_themes_list (GHashTable *pThemeTable, gpointer *data)
1497
1498
        //g_free (cCommandToLaunch);
1498
1499
}
1499
1500
 
 
1501
static void _cairo_dock_render_theme_name (GtkCellLayout *cell_layout,
 
1502
        GtkCellRenderer *cell,
 
1503
        GtkTreeModel *model,
 
1504
        GtkTreeIter *iter,
 
1505
        gpointer data)
 
1506
{
 
1507
        const gchar *cState=NULL;
 
1508
        gint iState = 0;
 
1509
        gboolean bRed = FALSE;
 
1510
        gchar *cName=NULL;
 
1511
        gtk_tree_model_get (model, iter, CAIRO_DOCK_MODEL_STATE, &iState, CAIRO_DOCK_MODEL_NAME, &cName, -1);
 
1512
        switch (iState)
 
1513
        {
 
1514
                case CAIRO_DOCK_LOCAL_PACKAGE:
 
1515
                        cState = _("Local");
 
1516
                break;
 
1517
                case CAIRO_DOCK_USER_PACKAGE:
 
1518
                        cState = _("User");
 
1519
                break;
 
1520
                case CAIRO_DOCK_DISTANT_PACKAGE:
 
1521
                        cState = _("Net");
 
1522
                break;
 
1523
                case CAIRO_DOCK_NEW_PACKAGE:
 
1524
                        cState = _("New");
 
1525
                        bRed = TRUE;
 
1526
                break;
 
1527
                case CAIRO_DOCK_UPDATED_PACKAGE:
 
1528
                        cState = _("Updated");
 
1529
                        bRed = TRUE;  // "#FF0000"
 
1530
                break;
 
1531
                default:
 
1532
                break;
 
1533
        }
 
1534
        if (cState != NULL)
 
1535
        {
 
1536
                gchar *cName2 = g_strdup_printf ("(%s) %s", cState, cName);
 
1537
                if (bRed)
 
1538
                {
 
1539
                        gchar *tmp = cName2;
 
1540
                        cName2 = g_strdup_printf ("<span foreground='red'>(%s)</span> %s", cState, cName);
 
1541
                        g_free (tmp);
 
1542
                }
 
1543
                g_object_set (cell, "markup", cName2, NULL);
 
1544
                g_free (cName2);
 
1545
        }
 
1546
}
 
1547
 
1500
1548
#define _allocate_new_buffer\
1501
1549
        data = g_new (gconstpointer, 3); \
1502
1550
        g_ptr_array_add (pDataGarbage, data);
1866
1914
                        }
1867
1915
                        
1868
1916
                        //\______________ On cree le label descriptif et la boite du widget.
1869
 
                        ///if (iElementType != CAIRO_DOCK_WIDGET_EMPTY_WIDGET)
1870
 
                        {
1871
 
                                if (iElementType == CAIRO_DOCK_WIDGET_HANDBOOK)
1872
 
                                {
1873
 
                                        cValue = g_key_file_get_string (pKeyFile, cGroupName, cKeyName, NULL);
1874
 
                                        CairoDockModule *pModule = cairo_dock_find_module_from_name (cValue);
1875
 
                                        if (pModule != NULL)
1876
 
                                        {
1877
 
                                                gchar *cDescription = g_strdup_printf ("<i>%s (v%s) by %s</i>\n%s",
1878
 
                                                        pModule->pVisitCard->cModuleName,
1879
 
                                                        pModule->pVisitCard->cModuleVersion,
1880
 
                                                        pModule->pVisitCard->cAuthor,
1881
 
                                                        dgettext (pModule->pVisitCard->cGettextDomain,
1882
 
                                                                pModule->pVisitCard->cDescription));
1883
 
                                                pLabel = gtk_label_new (cDescription);
1884
 
                                                gtk_label_set_use_markup (GTK_LABEL (pLabel), TRUE);
1885
 
                                                gtk_widget_set (pLabel, "width-request", 500, NULL);  // CAIRO_DOCK_PREVIEW_WIDTH
1886
 
                                                gtk_label_set_justify (GTK_LABEL (pLabel), GTK_JUSTIFY_LEFT);
1887
 
                                                gtk_label_set_line_wrap (GTK_LABEL (pLabel), TRUE);
1888
 
                                                g_free (cDescription);
1889
 
                                        }
1890
 
                                        g_free (cValue);
1891
 
                                }
1892
 
                                else if (*cUsefulComment != '\0' && strcmp (cUsefulComment, "...") != 0)
1893
 
                                {
1894
 
                                        pLabel = gtk_label_new (NULL);
1895
 
                                        gtk_label_set_use_markup  (GTK_LABEL (pLabel), TRUE);
1896
 
                                        gtk_label_set_markup (GTK_LABEL (pLabel), dgettext (cGettextDomain, cUsefulComment));
1897
 
                                }
1898
 
                                if (pLabel != NULL)
1899
 
                                {
1900
 
                                        GtkWidget *pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
1901
 
                                        gtk_container_add (GTK_CONTAINER (pAlign), pLabel);
1902
 
                                        gtk_box_pack_start (GTK_BOX (pKeyBox),
1903
 
                                                pAlign,
1904
 
                                                FALSE,
1905
 
                                                FALSE,
1906
 
                                                0);
1907
 
                                }
1908
 
                                
1909
 
                                pWidgetBox = gtk_hbox_new (FALSE, CAIRO_DOCK_GUI_MARGIN);
1910
 
                                gtk_box_pack_end (GTK_BOX (pKeyBox),
1911
 
                                        pWidgetBox,
 
1917
                        if (iElementType == CAIRO_DOCK_WIDGET_HANDBOOK)
 
1918
                        {
 
1919
                                cValue = g_key_file_get_string (pKeyFile, cGroupName, cKeyName, NULL);
 
1920
                                CairoDockModule *pModule = cairo_dock_find_module_from_name (cValue);
 
1921
                                if (pModule != NULL)
 
1922
                                {
 
1923
                                        gchar *cDescription = g_strdup_printf ("<i>%s (v%s) by %s</i>\n%s",
 
1924
                                                pModule->pVisitCard->cModuleName,
 
1925
                                                pModule->pVisitCard->cModuleVersion,
 
1926
                                                pModule->pVisitCard->cAuthor,
 
1927
                                                dgettext (pModule->pVisitCard->cGettextDomain,
 
1928
                                                        pModule->pVisitCard->cDescription));
 
1929
                                        pLabel = gtk_label_new (cDescription);
 
1930
                                        gtk_label_set_use_markup (GTK_LABEL (pLabel), TRUE);
 
1931
                                        gtk_widget_set (pLabel, "width-request", 500, NULL);  // CAIRO_DOCK_PREVIEW_WIDTH
 
1932
                                        gtk_label_set_justify (GTK_LABEL (pLabel), GTK_JUSTIFY_LEFT);
 
1933
                                        gtk_label_set_line_wrap (GTK_LABEL (pLabel), TRUE);
 
1934
                                        g_free (cDescription);
 
1935
                                }
 
1936
                                g_free (cValue);
 
1937
                        }
 
1938
                        else if (*cUsefulComment != '\0' && strcmp (cUsefulComment, "...") != 0)
 
1939
                        {
 
1940
                                pLabel = gtk_label_new (NULL);
 
1941
                                gtk_label_set_use_markup  (GTK_LABEL (pLabel), TRUE);
 
1942
                                gtk_label_set_markup (GTK_LABEL (pLabel), dgettext (cGettextDomain, cUsefulComment));
 
1943
                        }
 
1944
                        if (pLabel != NULL)
 
1945
                        {
 
1946
                                GtkWidget *pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
 
1947
                                gtk_container_add (GTK_CONTAINER (pAlign), pLabel);
 
1948
                                gtk_box_pack_start (GTK_BOX (pKeyBox),
 
1949
                                        pAlign,
1912
1950
                                        FALSE,
1913
1951
                                        FALSE,
1914
1952
                                        0);
1915
1953
                        }
 
1954
                        
 
1955
                        pWidgetBox = gtk_hbox_new (FALSE, CAIRO_DOCK_GUI_MARGIN);
 
1956
                        gtk_box_pack_end (GTK_BOX (pKeyBox),
 
1957
                                pWidgetBox,
 
1958
                                FALSE,
 
1959
                                FALSE,
 
1960
                                0);
1916
1961
                }
1917
1962
                
1918
1963
                pSubWidgetList = NULL;
2130
2175
                        case CAIRO_DOCK_WIDGET_THEME_LIST_ENTRY :  // idem mais avec une combo-entry.
2131
2176
                                //\______________ On construit le widget de visualisation de themes.
2132
2177
                                modele = _cairo_dock_gui_allocate_new_model ();
2133
 
                                gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (modele), CAIRO_DOCK_MODEL_RESULT, GTK_SORT_ASCENDING);
 
2178
                                gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (modele), CAIRO_DOCK_MODEL_NAME, GTK_SORT_ASCENDING);
2134
2179
                                
 
2180
                                rend = NULL;
2135
2181
                                _add_combo_from_modele (modele, TRUE, iElementType == CAIRO_DOCK_WIDGET_THEME_LIST_ENTRY);
2136
2182
                                
 
2183
                                if (rend != NULL)
 
2184
                                        gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (pOneWidget),
 
2185
                                                rend,
 
2186
                                                (GtkCellLayoutDataFunc) _cairo_dock_render_theme_name,
 
2187
                                                NULL,
 
2188
                                                NULL);
 
2189
                                
2137
2190
                                //\______________ On recupere les themes.
2138
2191
                                if (pAuthorizedValuesList != NULL)
2139
2192
                                {
2928
2981
                        break ;
2929
2982
                        
2930
2983
                        case CAIRO_DOCK_WIDGET_TEXT_LABEL :  // juste le label de texte.
 
2984
                                gtk_widget_set_size_request (pLabel, 800, -1);  /// on coupe a 800; valeur a tester sur differentes resolutions ...
 
2985
                                gtk_label_set_justify (GTK_LABEL (pLabel), GTK_JUSTIFY_LEFT);
 
2986
                                gtk_label_set_line_wrap (GTK_LABEL (pLabel), TRUE);
2931
2987
                        break ;
2932
2988
                        
2933
2989
                        case CAIRO_DOCK_WIDGET_HANDBOOK :  // le label contenant le manuel de l'applet, il a ete place avant.