]> Pileus Git - ~andy/gtk/blobdiff - tests/testcombochange.c
reftests: Mark windows as popup
[~andy/gtk] / tests / testcombochange.c
index c9da7587965ab91d706af620673ac64dfaaedd71..6f254fe4a284b7e75adbe3ab9776610826db167e 100644 (file)
@@ -13,9 +13,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -31,12 +29,8 @@ static char next_value = 'A';
 static void
 test_init (void)
 {
-  if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
-                  G_FILE_TEST_EXISTS))
-    {
-      g_setenv ("GDK_PIXBUF_MODULE_FILE", "../gdk-pixbuf/loaders.cache", TRUE);
-      g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
-    }
+  if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
+    g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
 }
 
 static void
@@ -94,16 +88,9 @@ create_combo (const char *name,
 {
   GtkCellRenderer *cell_renderer;
   GtkWidget *combo;
-  char *rc_string;
-  
-  rc_string = g_strdup_printf ("style \"%s-style\" {\n"
-                              "  GtkComboBox::appears-as-list = %d\n"
-                              "}\n"
-                              "\n"
-                              "widget \"*.%s\" style \"%s-style\"",
-                              name, is_list, name, name);
-  gtk_rc_parse_string (rc_string);
-  g_free (rc_string);
+  GtkCssProvider *provider;
+  GtkStyleContext *context;
+  gchar *css_data;
 
   combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
   cell_renderer = gtk_cell_renderer_text_new ();
@@ -112,7 +99,19 @@ create_combo (const char *name,
                                  "text", 0, NULL);
 
   gtk_widget_set_name (combo, name);
-  
+
+  context = gtk_widget_get_style_context (combo);
+
+  provider = gtk_css_provider_new ();
+  css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
+                              name, is_list ? "true" : "false");
+  gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
+  g_free (css_data);
+
+  gtk_style_context_add_provider (context,
+                                  GTK_STYLE_PROVIDER (provider),
+                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
   return combo;
 }