~ubuntu-branches/ubuntu/saucy/nvidia-settings-updates/saucy

« back to all changes in this revision

Viewing changes to src/gtk+-2.x/ctkedid.c

  • Committer: Package Import Robot
  • Author(s): Alberto Milone
  • Date: 2012-06-25 16:39:50 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120625163950-qsci6udwk8mbyrdu
Tags: 302.17-0ubuntu1
* New upstream release.
* Refresh 04_nvidia-settings_natty_ftbs.patch.
* Drop 02_nvidia-settings-format-string.patch which
  is now upstream.
* debian/rules:
  - Make sure to install the new sources correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
            sizeof (CtkEdid),
73
73
            0, /* n_preallocs */
74
74
            NULL, /* instance_init */
 
75
            NULL  /* value_table */
75
76
        };
76
77
 
77
78
        ctk_edid_type = g_type_register_static (GTK_TYPE_VBOX,
82
83
}
83
84
 
84
85
 
 
86
void ctk_edid_setup(CtkEdid *ctk_object)
 
87
{
 
88
    ReturnStatus ret;
 
89
    gint val;
 
90
 
 
91
    ret = NvCtrlGetAttribute(ctk_object->handle, NV_CTRL_EDID_AVAILABLE, &val);
 
92
 
 
93
    if ((ret != NvCtrlSuccess) || (val != NV_CTRL_EDID_AVAILABLE_TRUE)) {
 
94
        gtk_widget_set_sensitive(ctk_object->button, FALSE);
 
95
        return;
 
96
    }
 
97
 
 
98
    gtk_widget_set_sensitive(ctk_object->button, TRUE);
 
99
}
 
100
 
 
101
 
85
102
GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle,
86
103
                        CtkConfig *ctk_config, CtkEvent *ctk_event,
87
 
                        GtkWidget *reset_button,
88
 
                        unsigned int display_device_mask,
89
104
                        char *name)
90
105
{
91
106
    CtkEdid *ctk_edid;
92
107
    GObject *object;
93
108
    GtkWidget *frame, *vbox, *label, *hbox, *alignment;
94
 
    ReturnStatus ret;
95
 
    gint val;
96
 
 
97
 
    /* check if EDID is available for this display device */
98
 
 
99
 
    ret = NvCtrlGetDisplayAttribute(handle, display_device_mask,
100
 
                                    NV_CTRL_EDID_AVAILABLE, &val);
101
 
    
102
 
    if ((ret != NvCtrlSuccess) || (val != NV_CTRL_EDID_AVAILABLE_TRUE)) {
103
 
        return NULL;
104
 
    }
105
109
 
106
110
    /* create the object */
107
 
    
 
111
 
108
112
    object = g_object_new(CTK_TYPE_EDID, NULL);
 
113
    if (!object) return NULL;
109
114
 
110
115
    ctk_edid = CTK_EDID(object);
111
 
    
 
116
 
112
117
    ctk_edid->handle = handle;
113
118
    ctk_edid->ctk_config = ctk_config;
114
 
    ctk_edid->reset_button = reset_button;
115
 
    ctk_edid->display_device_mask = display_device_mask;
116
119
    ctk_edid->name = name;
117
120
    ctk_edid->filename = DEFAULT_EDID_FILENAME_BINARY;
118
121
    ctk_edid->file_format = FILE_FORMAT_BINARY;
197
200
 
198
201
    gtk_widget_show_all(GTK_WIDGET(object));
199
202
 
 
203
    ctk_edid_setup(ctk_edid);
 
204
 
200
205
    return GTK_WIDGET(object);
201
206
    
202
207
} /* ctk_edid_new() */
290
295
 
291
296
    /* Grab EDID information */
292
297
    
293
 
    ret = NvCtrlGetBinaryAttribute(ctk_edid->handle,
294
 
                                   ctk_edid->display_device_mask,
 
298
    ret = NvCtrlGetBinaryAttribute(ctk_edid->handle, 0,
295
299
                                   NV_CTRL_BINARY_DATA_EDID,
296
300
                                   &data, &len);
297
301
    if (ret != NvCtrlSuccess) {