~ubuntu-branches/ubuntu/karmic/photoprint/karmic

« back to all changes in this revision

Viewing changes to profilemanager/profileselector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Milan Zamazal
  • Date: 2007-05-01 16:32:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070501163213-ni1933khtg9fdvn5
Tags: 0.3.5-2
Move to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
}
136
136
 
137
137
 
138
 
static void     profileselector_entry_changed(GtkEntry *entry,gpointer user_data)
 
138
static void     profileselector_changed(GtkWidget *widget,gpointer user_data)
139
139
{
140
140
        ProfileSelector *c=PROFILESELECTOR(user_data);
141
141
        GtkOptionMenu *om=GTK_OPTION_MENU(c->optionmenu);
193
193
        gtk_widget_show(c->optionmenu);
194
194
 
195
195
        profileselector_build_options(c);
196
 
        g_signal_connect(c->optionmenu,"changed",G_CALLBACK(profileselector_entry_changed),c);
 
196
        g_signal_connect(c->optionmenu,"changed",G_CALLBACK(profileselector_changed),c);
 
197
 
 
198
        gint index=gtk_option_menu_get_history(GTK_OPTION_MENU(c->optionmenu));
 
199
        const char *val=NULL;
 
200
        if(c->optionlist)
 
201
                val=(const char *)g_list_nth_data(c->optionlist,index);
 
202
        if(val)
 
203
                profileselector_set_filename(c,val);
 
204
 
 
205
//      profileselector_changed(c->optionmenu,c);
197
206
        
198
207
        return(GTK_WIDGET(c));
199
208
}
258
267
}
259
268
 
260
269
 
 
270
void profileselector_set_type(ProfileSelector *c,IS_TYPE colourspace)
 
271
{
 
272
        colourspace=IS_TYPE(STRIP_ALPHA(colourspace));
 
273
        IS_TYPE oldcolourspace=c->colourspace;
 
274
        if(colourspace!=IS_TYPE_NULL && (oldcolourspace!=colourspace))
 
275
        {
 
276
                c->colourspace=colourspace;
 
277
                profileselector_build_options(c);
 
278
                rebuild_menu(c);
 
279
                const char *def=NULL;
 
280
                CMSProfile *defp=c->pm->GetDefaultProfile(colourspace);
 
281
                if(defp)
 
282
                {
 
283
                        if((def=defp->GetFilename()))
 
284
                                profileselector_set_filename(c,def);
 
285
                        delete defp;
 
286
                }
 
287
        }
 
288
}
 
289
 
 
290
 
261
291
void profileselector_set_filename(ProfileSelector *c,const char *filename)
262
292
{
263
293
        char *fn=c->pm->MakeRelative(filename);
292
322
 
293
323
                try
294
324
                {
295
 
                        char *fn=c->pm->Search(c->filename);
296
 
                        if(fn && strlen(fn))
 
325
                        CMSProfile *profile=c->pm->GetProfile(c->filename);
 
326
                        if(profile)
297
327
                        {
298
 
                                CMSProfile profile(fn);
299
 
                                free(fn);
300
328
                                gsize in,out;
301
 
                                gchar *entry=g_locale_to_utf8(profile.GetDescription(),-1,&in,&out,NULL);
 
329
                                gchar *entry=g_locale_to_utf8(profile->GetDescription(),-1,&in,&out,NULL);
302
330
                                gtk_label_set_text(GTK_LABEL(c->description),entry);
 
331
                                delete profile;
303
332
                        }
 
333
                        else
 
334
                                gtk_label_set_text(GTK_LABEL(c->description),"Warning: can't open profile!");
304
335
                }
305
336
                catch(const char *err)
306
337
                {